public class ClusterSwitchUtil extends Object
| 限定符和类型 | 类和说明 |
|---|---|
static class |
ClusterSwitchUtil.ZKClusterKey |
| 限定符和类型 | 字段和说明 |
|---|---|
static Pattern |
CLUSTER_KEY_PATTERN |
static String |
CONF_SEPARATOR |
static Pattern |
ENDPOINT_PATTERN |
static String |
ZOOKEEPER_CONNECT_NODE |
static String |
ZOOKEEPER_CONNECT_NODE_DEFAULT |
static String |
ZOOKEEPER_CREATE_NODE |
static String |
ZOOKEEPER_CREATE_NODE_DEFAULT |
static String |
ZOOKEEPER_DUAL_TABLE_NODE |
static String |
ZOOKEEPER_DUAL_TABLE_NODE_DEFAULT |
static String |
ZOOKEEPER_DUAL_TRACE_NODE |
static String |
ZOOKEEPER_DUAL_TRACE_NODE_DEFAULT |
static String |
ZOOKEEPER_LINK_NODE |
static String |
ZOOKEEPER_LINK_NODE_DEFAULT |
static String |
ZOOKEEPER_MODIFY_NODE |
static String |
ZOOKEEPER_MODIFY_NODE_DEFAULT |
static String |
ZOOKEEPER_REDIRECT_NODE |
static String |
ZOOKEEPER_REDIRECT_NODE_DEFAULT |
| 构造器和说明 |
|---|
ClusterSwitchUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static void |
applyClusterKeyToConf(org.apache.hadoop.conf.Configuration conf,
String key)
Apply the settings in the given key to the given configuration, this is
used to communicate with distant clusters
|
static String |
buildQuorumServerString(String[] serverHosts,
String clientPort)
Build the ZK quorum server string with "server:clientport" list, separated by ','
|
static org.apache.hadoop.conf.Configuration |
createConfForSalveCluster(int index,
org.apache.hadoop.conf.Configuration conf) |
static org.apache.hadoop.conf.Configuration |
createConfWithConnectKey(String connectKey,
org.apache.hadoop.conf.Configuration conf) |
static String |
getBaseNode(String baseNode,
String hacluster)
get different base node for different hacluster
|
static String |
getConnectKey(org.apache.hadoop.conf.Configuration conf)
Get the connect key
|
static String |
getZooKeeperClusterKey(org.apache.hadoop.conf.Configuration conf)
Get the key to the ZK ensemble for this configuration and append
a name at the end
|
static boolean |
isValidClusterKey(String clusterKey)
Check whether the given cluster key is a valid format: zk1,zk2:port:/znode
|
static boolean |
isValidConnectKey(String key)
Check whether the given string is a valid endpoint or cluster key
|
static boolean |
isValidEndpoint(String endpoint)
Check whether the given endpoint is a valid format: hostname:port
|
static Map<Integer,String> |
parseSlaveClustersNames(org.apache.hadoop.conf.Configuration conf)
Return a map, the key is the index of the slave clusters, value is the actual
conf key for this slave clusters
|
static SwitchCommand |
toSwitchCommand(byte[] data) |
static byte[] |
toSwitchCommandBytes(String clusterKey,
long ts) |
static ClusterSwitchUtil.ZKClusterKey |
transformClusterKey(String key)
Separate the given key into the three configurations it should contain:
hbase.zookeeper.quorum, hbase.zookeeper.client.port
and zookeeper.znode.parent
|
public static String ZOOKEEPER_REDIRECT_NODE
public static String ZOOKEEPER_CONNECT_NODE
public static String ZOOKEEPER_LINK_NODE
public static String ZOOKEEPER_CREATE_NODE
public static String ZOOKEEPER_MODIFY_NODE
public static String ZOOKEEPER_DUAL_TABLE_NODE
public static String ZOOKEEPER_DUAL_TRACE_NODE
public static final Pattern CLUSTER_KEY_PATTERN
public static final Pattern ENDPOINT_PATTERN
public static String ZOOKEEPER_REDIRECT_NODE_DEFAULT
public static String ZOOKEEPER_CONNECT_NODE_DEFAULT
public static String ZOOKEEPER_LINK_NODE_DEFAULT
public static String ZOOKEEPER_CREATE_NODE_DEFAULT
public static String ZOOKEEPER_MODIFY_NODE_DEFAULT
public static String ZOOKEEPER_DUAL_TABLE_NODE_DEFAULT
public static String ZOOKEEPER_DUAL_TRACE_NODE_DEFAULT
public static String CONF_SEPARATOR
public static String buildQuorumServerString(String[] serverHosts, String clientPort)
serverHosts - a list of servers for ZK quorumclientPort - the default client portpublic static ClusterSwitchUtil.ZKClusterKey transformClusterKey(String key) throws IOException
key - IOExceptionpublic static void applyClusterKeyToConf(org.apache.hadoop.conf.Configuration conf,
String key)
throws IOException
conf - configuration object to configurekey - string that contains the 3 required configuratinsIOExceptionpublic static String getZooKeeperClusterKey(org.apache.hadoop.conf.Configuration conf)
conf - Configuration to use to build the keypublic static String getConnectKey(org.apache.hadoop.conf.Configuration conf)
conf - Configuration to use to build the keypublic static Map<Integer,String> parseSlaveClustersNames(org.apache.hadoop.conf.Configuration conf) throws IOException
conf - IOExceptionpublic static org.apache.hadoop.conf.Configuration createConfForSalveCluster(int index,
org.apache.hadoop.conf.Configuration conf)
throws IOException
IOExceptionpublic static org.apache.hadoop.conf.Configuration createConfWithConnectKey(String connectKey, org.apache.hadoop.conf.Configuration conf) throws IOException
IOExceptionpublic static byte[] toSwitchCommandBytes(String clusterKey, long ts)
public static SwitchCommand toSwitchCommand(byte[] data) throws IOException
IOExceptionpublic static boolean isValidClusterKey(String clusterKey)
clusterKey - public static boolean isValidEndpoint(String endpoint)
endpoint - public static boolean isValidConnectKey(String key)
key - Copyright © 2019. All rights reserved.