|
||||||||||
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 URI |
getServiceUriFromToken(org.apache.hadoop.security.token.Token<org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenIdentifier> token)
Parse the HDFS URI out of the provided token. |
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<org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenIdentifier> 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 errorpublic 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(org.apache.hadoop.security.token.Token<org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenIdentifier> token) throws IOException
IOException
- if the token is invalidpublic 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<org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenIdentifier> 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
appliespublic 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.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |