Modifier and Type | Method and Description |
---|---|
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.
|
public static boolean isHAEnabled(org.apache.hadoop.conf.Configuration conf, String nsId)
conf
- ConfigurationnsId
- nameservice, or null if no federated NS is configuredpublic static boolean usesSharedEditsDir(org.apache.hadoop.conf.Configuration conf)
conf
- Configurationpublic 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
- Configurationorg.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 nodepublic static org.apache.hadoop.conf.Configuration getConfForOtherNode(org.apache.hadoop.conf.Configuration myConf)
myConf
- the configuration of this nodepublic 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 clusterpublic 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.Copyright © 2013 Apache Software Foundation. All Rights Reserved.