|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.hbase.replication.ReplicationStateZKBase
org.apache.hadoop.hbase.replication.ReplicationPeersZKImpl
public class ReplicationPeersZKImpl
This class provides an implementation of the ReplicationPeers interface using Zookeeper. The peers znode contains a list of all peer replication clusters and the current replication state of those clusters. It has one child peer znode for each peer cluster. The peer znode is named with the cluster id provided by the user in the HBase shell. The value of the peer znode contains the peers cluster key provided by the user in the HBase Shell. The cluster key contains a list of zookeeper quorum peers, the client port for the zookeeper quorum, and the base znode for HBase. For example: /hbase/replication/peers/1 [Value: zk1.host.com,zk2.host.com,zk3.host.com:2181:/hbase] /hbase/replication/peers/2 [Value: zk5.host.com,zk6.host.com,zk7.host.com:2181:/hbase] Each of these peer znodes has a child znode that indicates whether or not replication is enabled on that peer cluster. These peer-state znodes do not have child znodes and simply contain a boolean value (i.e. ENABLED or DISABLED). This value is read/maintained by the ReplicationPeer.PeerStateTracker class. For example: /hbase/replication/peers/1/peer-state [Value: ENABLED]
Nested Class Summary | |
---|---|
static class |
ReplicationPeersZKImpl.PeerRegionServerListener
Tracks changes to the list of region servers in a peer's cluster. |
Field Summary |
---|
Fields inherited from class org.apache.hadoop.hbase.replication.ReplicationStateZKBase |
---|
abortable, conf, DISABLED_ZNODE_BYTES, ENABLED_ZNODE_BYTES, ourClusterKey, peerStateNodeName, peersZNode, queuesZNode, replicationZNode, zookeeper |
Constructor Summary | |
---|---|
ReplicationPeersZKImpl(ZooKeeperWatcher zk,
org.apache.hadoop.conf.Configuration conf,
Abortable abortable)
|
Method Summary | |
---|---|
void |
addPeer(String id,
String clusterKey)
Add a new remote slave cluster for replication. |
boolean |
connectToPeer(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 |
disconnectFromPeer(String peerId)
Disconnect from a remote slave cluster. |
void |
enablePeer(String id)
Restart the replication to the specified remote slave cluster. |
Map<String,String> |
getAllPeerClusterKeys()
List the cluster keys 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. |
Set<String> |
getConnectedPeers()
Get a set of all connected remote slave clusters. |
org.apache.hadoop.conf.Configuration |
getPeerConf(String peerId)
Returns the configuration needed to talk to the remote slave cluster. |
UUID |
getPeerUUID(String peerId)
Returns the UUID of the provided peer id. |
List<ServerName> |
getRegionServersOfConnectedPeer(String peerId)
Returns all region servers from given connected remote slave cluster. |
boolean |
getStatusOfConnectedPeer(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. |
long |
getTimestampOfLastChangeToPeer(String peerId)
Get the timestamp of the last change in composition of a given peer cluster. |
void |
init()
Initialize the ReplicationPeers interface. |
void |
removePeer(String id)
Removes a remote slave cluster and stops the replication to it. |
Methods inherited from class org.apache.hadoop.hbase.replication.ReplicationStateZKBase |
---|
getListOfReplicators, isPeerPath, peerExists, toByteArray |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ReplicationPeersZKImpl(ZooKeeperWatcher zk, org.apache.hadoop.conf.Configuration conf, Abortable abortable)
Method Detail |
---|
public void init() throws ReplicationException
ReplicationPeers
init
in interface ReplicationPeers
ReplicationException
public void addPeer(String id, String clusterKey) throws ReplicationException
ReplicationPeers
addPeer
in interface ReplicationPeers
id
- a short that identifies the clusterclusterKey
- the concatenation of the slave cluster's:
hbase.zookeeper.quorum:hbase.zookeeper.property.clientPort:zookeeper.znode.parent
ReplicationException
public void removePeer(String id) throws ReplicationException
ReplicationPeers
removePeer
in interface ReplicationPeers
id
- a short that identifies the cluster
ReplicationException
public void enablePeer(String id) throws ReplicationException
ReplicationPeers
enablePeer
in interface ReplicationPeers
id
- a short that identifies the cluster
ReplicationException
public void disablePeer(String id) throws ReplicationException
ReplicationPeers
disablePeer
in interface ReplicationPeers
id
- a short that identifies the cluster
ReplicationException
public boolean getStatusOfConnectedPeer(String id)
ReplicationPeers
ReplicationPeers.getStatusOfPeerFromBackingStore(String)
if reading the state after enabling or disabling it.
getStatusOfConnectedPeer
in interface ReplicationPeers
id
- a short that identifies the cluster
public boolean getStatusOfPeerFromBackingStore(String id) throws ReplicationException
ReplicationPeers
getStatusOfPeerFromBackingStore
in interface ReplicationPeers
id
- a short that identifies the cluster
ReplicationException
public boolean connectToPeer(String peerId) throws ReplicationException
ReplicationPeers
connectToPeer
in interface ReplicationPeers
peerId
- a short that identifies the cluster
ReplicationException
public void disconnectFromPeer(String peerId)
ReplicationPeers
disconnectFromPeer
in interface ReplicationPeers
peerId
- a short that identifies the clusterpublic Map<String,String> getAllPeerClusterKeys()
ReplicationPeers
getAllPeerClusterKeys
in interface ReplicationPeers
public List<ServerName> getRegionServersOfConnectedPeer(String peerId)
ReplicationPeers
getRegionServersOfConnectedPeer
in interface ReplicationPeers
peerId
- a short that identifies the cluster
public UUID getPeerUUID(String peerId)
ReplicationPeers
getPeerUUID
in interface ReplicationPeers
peerId
- the peer's ID that will be converted into a UUID
public Set<String> getConnectedPeers()
ReplicationPeers
getConnectedPeers
in interface ReplicationPeers
public org.apache.hadoop.conf.Configuration getPeerConf(String peerId) throws ReplicationException
ReplicationPeers
getPeerConf
in interface ReplicationPeers
peerId
- a short that identifies the cluster
ReplicationException
public List<String> getAllPeerIds()
getAllPeerIds
in interface ReplicationPeers
public long getTimestampOfLastChangeToPeer(String peerId)
ReplicationPeers
getTimestampOfLastChangeToPeer
in interface ReplicationPeers
peerId
- identifier of the peer cluster for which the timestamp is requested
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |