|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.hadoop.hdfs.HAUtil
public class HAUtil
| Method Summary | |
|---|---|
static org.apache.hadoop.io.Text |
buildTokenServiceForLogicalUri(URI uri)
Get the service name used in the delegation token for the given logical HA service. |
static void |
cloneDelegationTokenForLogicalUri(org.apache.hadoop.security.UserGroupInformation ugi,
URI haUri,
Collection<InetSocketAddress> nnAddrs)
Locate a delegation token associated with the given HA cluster URI, and if one is found, clone it to also represent the underlying namenode address. |
static InetSocketAddress |
getAddressOfActive(org.apache.hadoop.fs.FileSystem fs)
Get the internet address of the currently-active NN. |
static org.apache.hadoop.conf.Configuration |
getConfForOtherNode(org.apache.hadoop.conf.Configuration myConf)
Given the configuration for this node, return a Configuration object for the other node in an HA setup. |
static String |
getNameNodeId(org.apache.hadoop.conf.Configuration conf,
String nsId)
Get the namenode Id by matching the addressKey
with the the address of the local node. |
static String |
getNameNodeIdFromAddress(org.apache.hadoop.conf.Configuration conf,
InetSocketAddress address,
String... keys)
Similar to DFSUtil.getNameServiceIdFromAddress(Configuration,
InetSocketAddress, String...) |
static String |
getNameNodeIdOfOtherNode(org.apache.hadoop.conf.Configuration conf,
String nsId)
Get the NN ID of the other node in an HA setup. |
static List<org.apache.hadoop.hdfs.protocol.ClientProtocol> |
getProxiesForAllNameNodesInNameservice(org.apache.hadoop.conf.Configuration conf,
String nsId)
Get an RPC proxy for each NN in an HA nameservice. |
static URI |
getServiceUriFromToken(String scheme,
org.apache.hadoop.security.token.Token<?> token)
Parse the file system URI out of the provided token. |
static boolean |
isAtLeastOneActive(List<org.apache.hadoop.hdfs.protocol.ClientProtocol> namenodes)
Used to ensure that at least one of the given HA NNs is currently in the active state.. |
static boolean |
isHAEnabled(org.apache.hadoop.conf.Configuration conf,
String nsId)
Returns true if HA for namenode is configured for the given nameservice |
static boolean |
isLogicalUri(org.apache.hadoop.conf.Configuration conf,
URI nameNodeUri)
|
static boolean |
isTokenForLogicalUri(org.apache.hadoop.security.token.Token<?> token)
|
static void |
setAllowStandbyReads(org.apache.hadoop.conf.Configuration conf,
boolean val)
|
static boolean |
shouldAllowStandbyReads(org.apache.hadoop.conf.Configuration conf)
This is used only by tests at the moment. |
static boolean |
usesSharedEditsDir(org.apache.hadoop.conf.Configuration conf)
Returns true if HA is using a shared edits directory. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static boolean isHAEnabled(org.apache.hadoop.conf.Configuration conf,
String nsId)
conf - ConfigurationnsId - nameservice, or null if no federated NS is configured
public static boolean usesSharedEditsDir(org.apache.hadoop.conf.Configuration conf)
conf - Configuration
public static String getNameNodeId(org.apache.hadoop.conf.Configuration conf,
String nsId)
addressKey
with the the address of the local node.
If DFSConfigKeys.DFS_HA_NAMENODE_ID_KEY is not specifically
configured, this method determines the namenode Id by matching the local
node's address with the configured addresses. When a match is found, it
returns the namenode Id from the corresponding configuration key.
conf - Configuration
org.apache.hadoop.HadoopIllegalArgumentException - on error
public static String getNameNodeIdFromAddress(org.apache.hadoop.conf.Configuration conf,
InetSocketAddress address,
String... keys)
DFSUtil.getNameServiceIdFromAddress(Configuration,
InetSocketAddress, String...)
public static String getNameNodeIdOfOtherNode(org.apache.hadoop.conf.Configuration conf,
String nsId)
conf - the configuration of this node
public static org.apache.hadoop.conf.Configuration getConfForOtherNode(org.apache.hadoop.conf.Configuration myConf)
myConf - the configuration of this node
public static boolean shouldAllowStandbyReads(org.apache.hadoop.conf.Configuration conf)
public static void setAllowStandbyReads(org.apache.hadoop.conf.Configuration conf,
boolean val)
public static boolean isLogicalUri(org.apache.hadoop.conf.Configuration conf,
URI nameNodeUri)
public static URI getServiceUriFromToken(String scheme,
org.apache.hadoop.security.token.Token<?> token)
public static org.apache.hadoop.io.Text buildTokenServiceForLogicalUri(URI uri)
uri - the logical URI of the cluster
public static boolean isTokenForLogicalUri(org.apache.hadoop.security.token.Token<?> token)
public static void cloneDelegationTokenForLogicalUri(org.apache.hadoop.security.UserGroupInformation ugi,
URI haUri,
Collection<InetSocketAddress> nnAddrs)
ugi - the UGI to modifyhaUri - the logical URI for the clusternnAddrs - collection of NNs in the cluster to which the token
applies
public static InetSocketAddress getAddressOfActive(org.apache.hadoop.fs.FileSystem fs)
throws IOException
fs - the file system to get the active address of.
IOException - if an error occurs while resolving the active NN.
public static List<org.apache.hadoop.hdfs.protocol.ClientProtocol> getProxiesForAllNameNodesInNameservice(org.apache.hadoop.conf.Configuration conf,
String nsId)
throws IOException
conf - configurationnsId - the nameservice to get all of the proxies for.
IOException - in the event of error.
public static boolean isAtLeastOneActive(List<org.apache.hadoop.hdfs.protocol.ClientProtocol> namenodes)
throws IOException
namenodes - list of RPC proxies for each NN to check.
IOException - in the event of error.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||