| Modifier and Type | Method and Description |
|---|---|
static Text |
buildTokenServiceForLogicalUri(URI uri,
String scheme)
Get the service name used in the delegation token for the given logical
HA service.
|
static String |
buildTokenServicePrefixForLogicalUri(String scheme) |
static void |
cloneDelegationTokenForLogicalUri(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(FileSystem fs)
Get the internet address of the currently-active NN.
|
static Configuration |
getConfForOtherNode(Configuration myConf)
Given the configuration for this node, return a Configuration object for
the other node in an HA setup.
|
static String |
getNameNodeId(Configuration conf,
String nsId)
Get the namenode Id by matching the
addressKey
with the the address of the local node. |
static String |
getNameNodeIdFromAddress(Configuration conf,
InetSocketAddress address,
String... keys)
|
static String |
getNameNodeIdOfOtherNode(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(Configuration conf,
String nsId)
Get an RPC proxy for each NN in an HA nameservice.
|
static <T> List<NameNodeProxies.ProxyAndInfo<T>> |
getProxiesForAllNameNodesInNameservice(Configuration conf,
String nsId,
Class<T> xface)
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 |
isClientFailoverConfigured(Configuration conf,
URI nameNodeUri)
Check whether the client has a failover proxy provider configured
for the namenode/nameservice.
|
static boolean |
isHAEnabled(Configuration conf,
String nsId)
Returns true if HA for namenode is configured for the given nameservice
|
static boolean |
isLogicalUri(Configuration conf,
URI nameNodeUri) |
static boolean |
isTokenForLogicalUri(org.apache.hadoop.security.token.Token<?> token) |
static void |
setAllowStandbyReads(Configuration conf,
boolean val) |
static boolean |
shouldAllowStandbyReads(Configuration conf)
This is used only by tests at the moment.
|
static boolean |
useLogicalUri(Configuration conf,
URI nameNodeUri)
Check whether logical URI is needed for the namenode and
the corresponding failover proxy provider in the config.
|
static boolean |
usesSharedEditsDir(Configuration conf)
Returns true if HA is using a shared edits directory.
|
public static boolean isHAEnabled(Configuration conf, String nsId)
conf - ConfigurationnsId - nameservice, or null if no federated NS is configuredpublic static boolean usesSharedEditsDir(Configuration conf)
conf - Configurationpublic static String getNameNodeId(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 - ConfigurationHadoopIllegalArgumentException - on errorpublic static String getNameNodeIdFromAddress(Configuration conf, InetSocketAddress address, String... keys)
public static String getNameNodeIdOfOtherNode(Configuration conf, String nsId)
conf - the configuration of this nodepublic static Configuration getConfForOtherNode(Configuration myConf)
myConf - the configuration of this nodepublic static boolean shouldAllowStandbyReads(Configuration conf)
public static void setAllowStandbyReads(Configuration conf, boolean val)
public static boolean isLogicalUri(Configuration conf, URI nameNodeUri)
public static boolean isClientFailoverConfigured(Configuration conf, URI nameNodeUri)
conf - ConfigurationnameNodeUri - The URI of namenodepublic static boolean useLogicalUri(Configuration conf, URI nameNodeUri) throws IOException
conf - ConfigurationnameNodeUri - The URI of namenodeIOException - most likely due to misconfiguration.public static URI getServiceUriFromToken(String scheme, org.apache.hadoop.security.token.Token<?> token)
public static Text buildTokenServiceForLogicalUri(URI uri, String scheme)
uri - the logical URI of the clusterscheme - the scheme of the corresponding FileSystempublic static boolean isTokenForLogicalUri(org.apache.hadoop.security.token.Token<?> token)
public static String buildTokenServicePrefixForLogicalUri(String scheme)
public static void cloneDelegationTokenForLogicalUri(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(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(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 <T> List<NameNodeProxies.ProxyAndInfo<T>> getProxiesForAllNameNodesInNameservice(Configuration conf, String nsId, Class<T> xface) throws IOException
conf - configurationnsId - the nameservice to get all of the proxies for.xface - the protocol class.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.Copyright © 2018 CERN. All Rights Reserved.