Class ZKReplicationPeerStorage
java.lang.Object
org.apache.hadoop.hbase.replication.ZKReplicationStorageBase
org.apache.hadoop.hbase.replication.ZKReplicationPeerStorage
- All Implemented Interfaces:
ReplicationPeerStorage
@Private
public class ZKReplicationPeerStorage
extends ZKReplicationStorageBase
implements ReplicationPeerStorage
ZK based replication peer storage.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final byte[]static final byte[]static final Stringstatic final byte[]static final Stringstatic final Stringstatic final Stringstatic final Stringprivate final StringThe name of the znode that contains the replication status of a remote slave (i.e.private final StringThe name of the znode that contains a list of all remote slave (i.e.static final StringFields inherited from class org.apache.hadoop.hbase.replication.ZKReplicationStorageBase
conf, REPLICATION_ZNODE, REPLICATION_ZNODE_DEFAULT, replicationZNode, zookeeper -
Constructor Summary
ConstructorsConstructorDescriptionZKReplicationPeerStorage(ZKWatcher zookeeper, org.apache.hadoop.conf.Configuration conf) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPeer(String peerId, ReplicationPeerConfig peerConfig, boolean enabled, SyncReplicationState syncReplicationState) Add a replication peer.getNewSyncReplicationStateNode(String peerId) getPeerConfig(String peerId) Get the peer config of a replication peer.getPeerNewSyncReplicationState(String peerId) Get the new sync replication state.getPeerNode(String peerId) getPeerStateNode(String peerId) getPeerSyncReplicationState(String peerId) Get the sync replication state.private SyncReplicationStategetSyncReplicationState(String peerId, String path) getSyncReplicationStateNode(String peerId) booleanisPeerEnabled(String peerId) Test whether a replication peer is enabled.Return the peer ids of all replication peers.voidremovePeer(String peerId) Remove a replication peer.voidsetPeerNewSyncReplicationState(String peerId, SyncReplicationState state) Set the new sync replication state that we are going to transit to.voidsetPeerState(String peerId, boolean enabled) Set the state of peer,truetoENABLED, otherwise toDISABLED.voidOverwrite the sync replication state with the new sync replication state which is set with theReplicationPeerStorage.setPeerNewSyncReplicationState(String, SyncReplicationState)method above, and clear the new sync replication state.voidupdatePeerConfig(String peerId, ReplicationPeerConfig peerConfig) Update the config a replication peer.Methods inherited from class org.apache.hadoop.hbase.replication.ZKReplicationStorageBase
toByteArray
-
Field Details
-
PEERS_ZNODE
- See Also:
-
PEERS_ZNODE_DEFAULT
- See Also:
-
PEERS_STATE_ZNODE
- See Also:
-
PEERS_STATE_ZNODE_DEFAULT
- See Also:
-
ENABLED_ZNODE_BYTES
-
DISABLED_ZNODE_BYTES
-
SYNC_REPLICATION_STATE_ZNODE
- See Also:
-
NEW_SYNC_REPLICATION_STATE_ZNODE
- See Also:
-
NONE_STATE_ZNODE_BYTES
-
peerStateNodeName
The name of the znode that contains the replication status of a remote slave (i.e. peer) cluster. -
peersZNode
The name of the znode that contains a list of all remote slave (i.e. peer) clusters.
-
-
Constructor Details
-
ZKReplicationPeerStorage
-
-
Method Details
-
getPeerStateNode
-
getPeerNode
-
getSyncReplicationStateNode
-
getNewSyncReplicationStateNode
-
addPeer
public void addPeer(String peerId, ReplicationPeerConfig peerConfig, boolean enabled, SyncReplicationState syncReplicationState) throws ReplicationException Description copied from interface:ReplicationPeerStorageAdd a replication peer.- Specified by:
addPeerin interfaceReplicationPeerStorage- Throws:
ReplicationException- if there are errors accessing the storage service.
-
removePeer
Description copied from interface:ReplicationPeerStorageRemove a replication peer.- Specified by:
removePeerin interfaceReplicationPeerStorage- Throws:
ReplicationException- if there are errors accessing the storage service.
-
setPeerState
Description copied from interface:ReplicationPeerStorageSet the state of peer,truetoENABLED, otherwise toDISABLED.- Specified by:
setPeerStatein interfaceReplicationPeerStorage- Throws:
ReplicationException- if there are errors accessing the storage service.
-
updatePeerConfig
public void updatePeerConfig(String peerId, ReplicationPeerConfig peerConfig) throws ReplicationException Description copied from interface:ReplicationPeerStorageUpdate the config a replication peer.- Specified by:
updatePeerConfigin interfaceReplicationPeerStorage- Throws:
ReplicationException- if there are errors accessing the storage service.
-
listPeerIds
Description copied from interface:ReplicationPeerStorageReturn the peer ids of all replication peers.- Specified by:
listPeerIdsin interfaceReplicationPeerStorage- Throws:
ReplicationException- if there are errors accessing the storage service.
-
isPeerEnabled
Description copied from interface:ReplicationPeerStorageTest whether a replication peer is enabled.- Specified by:
isPeerEnabledin interfaceReplicationPeerStorage- Throws:
ReplicationException- if there are errors accessing the storage service.
-
getPeerConfig
Description copied from interface:ReplicationPeerStorageGet the peer config of a replication peer.- Specified by:
getPeerConfigin interfaceReplicationPeerStorage- Throws:
ReplicationException- if there are errors accessing the storage service.
-
setPeerNewSyncReplicationState
public void setPeerNewSyncReplicationState(String peerId, SyncReplicationState state) throws ReplicationException Description copied from interface:ReplicationPeerStorageSet the new sync replication state that we are going to transit to.- Specified by:
setPeerNewSyncReplicationStatein interfaceReplicationPeerStorage- Throws:
ReplicationException- if there are errors accessing the storage service.
-
transitPeerSyncReplicationState
Description copied from interface:ReplicationPeerStorageOverwrite the sync replication state with the new sync replication state which is set with theReplicationPeerStorage.setPeerNewSyncReplicationState(String, SyncReplicationState)method above, and clear the new sync replication state.- Specified by:
transitPeerSyncReplicationStatein interfaceReplicationPeerStorage- Throws:
ReplicationException- if there are errors accessing the storage service.
-
getSyncReplicationState
private SyncReplicationState getSyncReplicationState(String peerId, String path) throws ReplicationException - Throws:
ReplicationException
-
getPeerNewSyncReplicationState
public SyncReplicationState getPeerNewSyncReplicationState(String peerId) throws ReplicationException Description copied from interface:ReplicationPeerStorageGet the new sync replication state. Will returnSyncReplicationState.NONEif we are not in a transition.- Specified by:
getPeerNewSyncReplicationStatein interfaceReplicationPeerStorage- Throws:
ReplicationException- if there are errors accessing the storage service.
-
getPeerSyncReplicationState
Description copied from interface:ReplicationPeerStorageGet the sync replication state.- Specified by:
getPeerSyncReplicationStatein interfaceReplicationPeerStorage- Throws:
ReplicationException- if there are errors accessing the storage service.
-