Class ReplicationPeers
java.lang.Object
org.apache.hadoop.hbase.replication.ReplicationPeers
- All Implemented Interfaces:
ConfigurationObserver
This provides an class for maintaining a set of peer clusters. These peers are remote slave
clusters that data is replicated to.
We implement ConfigurationObserver mainly for recreating the
ReplicationPeerStorage, so we can change the ReplicationPeerStorage without
restarting the region server.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate org.apache.hadoop.conf.Configurationprivate final org.apache.hadoop.fs.FileSystemprivate static final org.slf4j.Loggerprivate final ConcurrentMap<String,ReplicationPeerImpl> private ReplicationPeerStorageprivate final ZKWatcher -
Constructor Summary
ConstructorsConstructorDescriptionReplicationPeers(org.apache.hadoop.fs.FileSystem fs, ZKWatcher zookeeper, org.apache.hadoop.conf.Configuration conf) -
Method Summary
Modifier and TypeMethodDescriptionbooleanMethod called after a peer has been connected.private ReplicationPeerImplcreatePeer(String peerId) Helper method to connect to a peerReturns the set of peerIds of the clusters that have been connected and have an underlying ReplicationPeer.org.apache.hadoop.conf.ConfigurationgetConf()Returns the ReplicationPeerImpl for the specified cached peer.voidinit()voidonConfigurationChange(org.apache.hadoop.conf.Configuration conf) This method would be called by theConfigurationManagerobject when theConfigurationobject is reloaded from disk.refreshPeerConfig(String peerId) refreshPeerState(String peerId) voidremovePeer(String peerId)
-
Field Details
-
LOG
-
conf
-
peerCache
-
fs
-
zookeeper
-
peerStorage
-
-
Constructor Details
-
ReplicationPeers
ReplicationPeers(org.apache.hadoop.fs.FileSystem fs, ZKWatcher zookeeper, org.apache.hadoop.conf.Configuration conf)
-
-
Method Details
-
getConf
-
init
- Throws:
ReplicationException
-
getPeerStorage
-
addPeer
Method called after a peer has been connected. It will create a ReplicationPeer to track the newly connected cluster.- Parameters:
peerId- a short that identifies the cluster- Returns:
- whether a ReplicationPeer was successfully created
- Throws:
ReplicationException
-
removePeer
-
getPeer
Returns the ReplicationPeerImpl for the specified cached peer. This ReplicationPeer will continue to track changes to the Peer's state and config. This method returns null if no peer has been cached with the given peerId.- Parameters:
peerId- id for the peer- Returns:
- ReplicationPeer object
-
getAllPeerIds
Returns the set of peerIds of the clusters that have been connected and have an underlying ReplicationPeer.- Returns:
- a Set of Strings for peerIds
-
getPeerCache
-
refreshPeerState
- Throws:
ReplicationException
-
refreshPeerConfig
- Throws:
ReplicationException
-
createPeer
Helper method to connect to a peer- Parameters:
peerId- peer's identifier- Returns:
- object representing the peer
- Throws:
ReplicationException
-
onConfigurationChange
Description copied from interface:ConfigurationObserverThis method would be called by theConfigurationManagerobject when theConfigurationobject is reloaded from disk.- Specified by:
onConfigurationChangein interfaceConfigurationObserver
-