@InterfaceAudience.Private public class ReplicationPeerZKImpl extends ReplicationStateZKBase implements ReplicationPeer, Abortable, Closeable
限定符和类型 | 类和说明 |
---|---|
class |
ReplicationPeerZKImpl.PeerConfigTracker
Tracker for PeerConfigNode of this peer
|
class |
ReplicationPeerZKImpl.PeerStateTracker
Tracker for state of this peer
|
ReplicationPeer.PeerState
abortable, DISABLED_ZNODE_BYTES, ENABLED_ZNODE_BYTES, hfileRefsZNode, ourClusterKey, peerStateNodeName, peersZNode, queuesZNode, replicationZNode, tableCFsNodeName, zookeeper, ZOOKEEPER_ZNODE_REPLICATION_HFILE_REFS_DEFAULT, ZOOKEEPER_ZNODE_REPLICATION_HFILE_REFS_KEY
构造器和说明 |
---|
ReplicationPeerZKImpl(ZooKeeperWatcher zkWatcher,
org.apache.hadoop.conf.Configuration conf,
String id,
ReplicationPeerConfig peerConfig,
Abortable abortable)
Constructor that takes all the objects required to communicate with the specified peer, except
for the region server addresses.
|
限定符和类型 | 方法和说明 |
---|---|
void |
abort(String why,
Throwable e)
Abort the server or client.
|
void |
close() |
org.apache.hadoop.conf.Configuration |
getConfiguration()
Get the configuration object required to communicate with this peer
|
String |
getId()
Get the identifier of this peer
|
long |
getPeerBandwidth()
Get the per node bandwidth upper limit for this peer
|
ReplicationPeerConfig |
getPeerConfig()
Get the peer config object
|
ReplicationPeer.PeerState |
getPeerState()
Returns the state of the peer
|
Map<TableName,List<String>> |
getTableCFs()
Get replicable (table, cf-list) map of this peer
|
boolean |
isAborted()
Check if the server or client was aborted.
|
static boolean |
isStateEnabled(byte[] bytes)
Parse the raw data from ZK to get a peer's state
|
void |
removeListenerOfPeerConfig(ReplicationPeerConfigListener listener)
Remove a listener when it is closed or terminated
|
void |
startPeerConfigTracker(ZooKeeperWatcher zookeeper,
String peerConfigNode)
start a table-cfs tracker to listen the (table, cf-list) map change
|
void |
startStateTracker(String peerStateNode)
start a state tracker to check whether this peer is enabled or not
|
void |
trackPeerConfigChanges(ReplicationPeerConfigListener listener)
Setup a callback for chanages to the replication peer config
|
getListOfReplicatorsZK, getPeerNode, getPeerStateNode, getTableCFsNode, isPeerPath, peerExists, toByteArray
public ReplicationPeerZKImpl(ZooKeeperWatcher zkWatcher, org.apache.hadoop.conf.Configuration conf, String id, ReplicationPeerConfig peerConfig, Abortable abortable) throws ReplicationException
conf
- configuration object to this peerid
- string representation of this peer's identifierpeerConfig
- configuration for the replication peerReplicationException
public void startStateTracker(String peerStateNode) throws org.apache.zookeeper.KeeperException
peerStateNode
- path to zk node which stores peer stateorg.apache.zookeeper.KeeperException
public void startPeerConfigTracker(ZooKeeperWatcher zookeeper, String peerConfigNode) throws org.apache.zookeeper.KeeperException
zookeeper
- peerConfigNode
- path to zk node which stores table-cfsorg.apache.zookeeper.KeeperException
public ReplicationPeer.PeerState getPeerState()
ReplicationPeer
getPeerState
在接口中 ReplicationPeer
public String getId()
getId
在接口中 ReplicationPeer
public ReplicationPeerConfig getPeerConfig()
getPeerConfig
在接口中 ReplicationPeer
public org.apache.hadoop.conf.Configuration getConfiguration()
getConfiguration
在接口中 ReplicationPeer
public Map<TableName,List<String>> getTableCFs()
getTableCFs
在接口中 ReplicationPeer
public long getPeerBandwidth()
ReplicationPeer
getPeerBandwidth
在接口中 ReplicationPeer
public void trackPeerConfigChanges(ReplicationPeerConfigListener listener)
ReplicationPeer
trackPeerConfigChanges
在接口中 ReplicationPeer
listener
- Listener for config changes, usually a replication endpointpublic void removeListenerOfPeerConfig(ReplicationPeerConfigListener listener)
ReplicationPeer
removeListenerOfPeerConfig
在接口中 ReplicationPeer
listener
- Listener for config changes, usually a replication endpointpublic boolean isAborted()
Abortable
public void close() throws IOException
close
在接口中 Closeable
close
在接口中 AutoCloseable
IOException
public static boolean isStateEnabled(byte[] bytes) throws DeserializationException
bytes
- raw ZK databytes
are those of a pb serialized ENABLED state.DeserializationException
Copyright © 2007–2022 The Apache Software Foundation. All rights reserved.