@InterfaceAudience.Private public class ReplicationPeersZKImpl extends ReplicationStateZKBase implements ReplicationPeers
conf, 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| Constructor and Description |
|---|
ReplicationPeersZKImpl(ZooKeeperWatcher zk,
org.apache.hadoop.conf.Configuration conf,
ReplicationQueuesClient queuesClient,
Abortable abortable) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
createAndAddPeer(String peerId)
Attempt to connect to a new remote slave cluster.
|
void |
disablePeer(String id)
Stop the replication to the specified remote slave cluster.
|
void |
enablePeer(String id)
Restart the replication to the specified remote slave cluster.
|
Map<String,ReplicationPeerConfig> |
getAllPeerConfigs()
List the cluster replication configs of all remote slave clusters (whether they are
enabled/disabled or connected/disconnected).
|
List<String> |
getAllPeerIds()
List all registered peer clusters and set a watch on their znodes.
|
ReplicationPeer |
getConnectedPeer(String peerId)
Returns the ReplicationPeer for the specified connected peer.
|
Set<String> |
getConnectedPeerIds()
Returns the set of peerIds of the clusters that have been connected and have an underlying
ReplicationPeer.
|
Pair<ReplicationPeerConfig,org.apache.hadoop.conf.Configuration> |
getPeerConf(String peerId)
Returns the configuration needed to talk to the remote slave cluster.
|
Map<TableName,List<String>> |
getPeerTableCFsConfig(String id)
Get the table and column-family list string of the peer from the underlying storage.
|
ReplicationPeerConfig |
getReplicationPeerConfig(String peerId)
Returns a ReplicationPeerConfig from the znode or null for the given peerId.
|
boolean |
getStatusOfPeer(String id)
Get the replication status for the specified connected remote slave cluster.
|
boolean |
getStatusOfPeerFromBackingStore(String id)
Get the replication status for the specified remote slave cluster, which doesn't
have to be connected.
|
void |
init()
Initialize the ReplicationPeers interface.
|
boolean |
peerConnected(String peerId)
Method called after a peer has been connected.
|
void |
peerDisconnected(String peerId)
Method called after a peer has been disconnected.
|
void |
registerPeer(String id,
ReplicationPeerConfig peerConfig)
Add a new remote slave cluster for replication.
|
void |
setPeerTableCFsConfig(String id,
Map<TableName,? extends Collection<String>> tableCFs)
Set the table and column-family list string of the peer to the underlying storage.
|
void |
unregisterPeer(String id)
Removes a remote slave cluster and stops the replication to it.
|
void |
updatePeerConfig(String id,
ReplicationPeerConfig newConfig)
Update the peerConfig for the a given peer cluster
|
getListOfReplicators, getPeerNode, getPeerStateNode, getTableCFsNode, isPeerPath, peerExists, toByteArraypublic ReplicationPeersZKImpl(ZooKeeperWatcher zk, org.apache.hadoop.conf.Configuration conf, ReplicationQueuesClient queuesClient, Abortable abortable)
public void init()
throws ReplicationException
ReplicationPeersinit in interface ReplicationPeersReplicationExceptionpublic void registerPeer(String id, ReplicationPeerConfig peerConfig) throws ReplicationException
ReplicationPeersregisterPeer in interface ReplicationPeersid - a short that identifies the clusterpeerConfig - configuration for the replication slave clusterReplicationExceptionpublic void unregisterPeer(String id) throws ReplicationException
ReplicationPeersunregisterPeer in interface ReplicationPeersid - a short that identifies the clusterReplicationExceptionpublic void enablePeer(String id) throws ReplicationException
ReplicationPeersenablePeer in interface ReplicationPeersid - a short that identifies the clusterReplicationExceptionpublic void disablePeer(String id) throws ReplicationException
ReplicationPeersdisablePeer in interface ReplicationPeersid - a short that identifies the clusterReplicationExceptionpublic Map<TableName,List<String>> getPeerTableCFsConfig(String id) throws ReplicationException
ReplicationPeersgetPeerTableCFsConfig in interface ReplicationPeersid - a short that identifies the clusterReplicationExceptionpublic void setPeerTableCFsConfig(String id, Map<TableName,? extends Collection<String>> tableCFs) throws ReplicationException
ReplicationPeerssetPeerTableCFsConfig in interface ReplicationPeersid - a short that identifies the clustertableCFs - the table and column-family list which will be replicated for this peerReplicationExceptionpublic boolean getStatusOfPeer(String id)
ReplicationPeersReplicationPeers.getStatusOfPeerFromBackingStore(String)
if reading the state after enabling or disabling it.getStatusOfPeer in interface ReplicationPeersid - a short that identifies the clusterpublic boolean getStatusOfPeerFromBackingStore(String id) throws ReplicationException
ReplicationPeersgetStatusOfPeerFromBackingStore in interface ReplicationPeersid - a short that identifies the clusterReplicationException - thrown if there's an error contacting the storepublic Map<String,ReplicationPeerConfig> getAllPeerConfigs()
ReplicationPeersgetAllPeerConfigs in interface ReplicationPeerspublic ReplicationPeer getConnectedPeer(String peerId)
ReplicationPeersgetConnectedPeer in interface ReplicationPeerspeerId - id for the peerpublic Set<String> getConnectedPeerIds()
ReplicationPeersgetConnectedPeerIds in interface ReplicationPeerspublic ReplicationPeerConfig getReplicationPeerConfig(String peerId) throws ReplicationException
getReplicationPeerConfig in interface ReplicationPeerspeerId - a short name that identifies the clusterReplicationExceptionpublic Pair<ReplicationPeerConfig,org.apache.hadoop.conf.Configuration> getPeerConf(String peerId) throws ReplicationException
ReplicationPeersgetPeerConf in interface ReplicationPeerspeerId - a short that identifies the clusterReplicationExceptionpublic void updatePeerConfig(String id, ReplicationPeerConfig newConfig) throws ReplicationException
ReplicationPeersupdatePeerConfig in interface ReplicationPeersid - a short that identifies the clusternewConfig - new config for the peer clusterReplicationExceptionpublic List<String> getAllPeerIds()
getAllPeerIds in interface ReplicationPeerspublic boolean peerConnected(String peerId) throws ReplicationException
ReplicationPeerspeerConnected in interface ReplicationPeerspeerId - a short that identifies the clusterReplicationExceptionpublic void peerDisconnected(String peerId)
ReplicationPeerspeerDisconnected in interface ReplicationPeerspeerId - a short that identifies the clusterpublic boolean createAndAddPeer(String peerId) throws ReplicationException
peerId - a short that identifies the clusterReplicationExceptionCopyright © 2007–2017 The Apache Software Foundation. All rights reserved.