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
Modifier and TypeFieldDescriptionprivate org.apache.hadoop.conf.Configuration
private final org.apache.hadoop.fs.FileSystem
private static final org.slf4j.Logger
private final ConcurrentMap<String,
ReplicationPeerImpl> private ReplicationPeerStorage
private final ZKWatcher
-
Constructor Summary
ConstructorDescriptionReplicationPeers
(org.apache.hadoop.fs.FileSystem fs, ZKWatcher zookeeper, org.apache.hadoop.conf.Configuration conf) -
Method Summary
Modifier and TypeMethodDescriptionboolean
Method called after a peer has been connected.private ReplicationPeerImpl
createPeer
(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.Configuration
getConf()
Returns the ReplicationPeerImpl for the specified cached peer.void
init()
void
onConfigurationChange
(org.apache.hadoop.conf.Configuration conf) This method would be called by theConfigurationManager
object when theConfiguration
object is reloaded from disk.refreshPeerConfig
(String peerId) refreshPeerState
(String peerId) void
removePeer
(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:ConfigurationObserver
This method would be called by theConfigurationManager
object when theConfiguration
object is reloaded from disk.- Specified by:
onConfigurationChange
in interfaceConfigurationObserver
-