org.apache.hadoop.hbase.replication
Interface ReplicationPeers

All Known Implementing Classes:
ReplicationPeersZKImpl

@InterfaceAudience.Private
public interface ReplicationPeers

This provides an interface for maintaining a set of peer clusters. These peers are remote slave clusters that data is replicated to. A peer cluster can be in three different states: 1. Not-Registered - There is no notion of the peer cluster. 2. Registered - The peer has an id and is being tracked but there is no connection. 3. Connected - There is an active connection to the remote peer. In the registered or connected state, a peer cluster can either be enabled or disabled.


Method Summary
 void addPeer(String peerId, ReplicationPeerConfig peerConfig, String tableCFs)
          Add a new remote slave cluster for replication.
 void disablePeer(String peerId)
          Stop the replication to the specified remote slave cluster.
 void enablePeer(String peerId)
          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 the peer ids of all remote slave clusters (whether they are enabled/disabled or connected/disconnected).
 ReplicationPeer getPeer(String peerId)
          Returns the ReplicationPeer
 Pair<ReplicationPeerConfig,org.apache.hadoop.conf.Configuration> getPeerConf(String peerId)
          Returns the configuration needed to talk to the remote slave cluster.
 Set<String> getPeerIds()
          Returns the set of peerIds defined
 String getPeerTableCFsConfig(String peerId)
          Get the table and column-family list string of the peer from ZK.
 ReplicationPeerConfig getReplicationPeerConfig(String peerId)
          Returns the configured ReplicationPeerConfig for this peerId
 boolean getStatusOfPeer(String peerId)
          Get the replication status for the specified connected remote slave cluster.
 boolean getStatusOfPeerFromBackingStore(String peerId)
          Get the replication status for the specified remote slave cluster, which doesn't have to be connected.
 Map<String,List<String>> getTableCFs(String peerId)
          Get the table and column-family-list map of the peer.
 void init()
          Initialize the ReplicationPeers interface.
 boolean peerAdded(String peerId)
           
 void peerRemoved(String peerId)
           
 void removePeer(String peerId)
          Removes a remote slave cluster and stops the replication to it.
 void setPeerTableCFsConfig(String peerId, String tableCFs)
          Set the table and column-family list string of the peer to ZK.
 

Method Detail

init

void init()
          throws ReplicationException
Initialize the ReplicationPeers interface.

Throws:
ReplicationException

addPeer

void addPeer(String peerId,
             ReplicationPeerConfig peerConfig,
             String tableCFs)
             throws ReplicationException
Add a new remote slave cluster for replication.

Parameters:
peerId - a short that identifies the cluster
peerConfig - configuration for the replication slave cluster
tableCFs - the table and column-family list which will be replicated for this peer or null for all table and column families
Throws:
ReplicationException

removePeer

void removePeer(String peerId)
                throws ReplicationException
Removes a remote slave cluster and stops the replication to it.

Parameters:
peerId - a short that identifies the cluster
Throws:
ReplicationException

peerAdded

boolean peerAdded(String peerId)
                  throws ReplicationException
Throws:
ReplicationException

peerRemoved

void peerRemoved(String peerId)

enablePeer

void enablePeer(String peerId)
                throws ReplicationException
Restart the replication to the specified remote slave cluster.

Parameters:
peerId - a short that identifies the cluster
Throws:
ReplicationException

disablePeer

void disablePeer(String peerId)
                 throws ReplicationException
Stop the replication to the specified remote slave cluster.

Parameters:
peerId - a short that identifies the cluster
Throws:
ReplicationException

getPeerTableCFsConfig

String getPeerTableCFsConfig(String peerId)
                             throws ReplicationException
Get the table and column-family list string of the peer from ZK.

Parameters:
peerId - a short that identifies the cluster
Throws:
ReplicationException

setPeerTableCFsConfig

void setPeerTableCFsConfig(String peerId,
                           String tableCFs)
                           throws ReplicationException
Set the table and column-family list string of the peer to ZK.

Parameters:
peerId - a short that identifies the cluster
tableCFs - the table and column-family list which will be replicated for this peer
Throws:
ReplicationException

getTableCFs

Map<String,List<String>> getTableCFs(String peerId)
Get the table and column-family-list map of the peer.

Parameters:
peerId - a short that identifies the cluster
Returns:
the table and column-family list which will be replicated for this peer

getPeer

ReplicationPeer getPeer(String peerId)
Returns the ReplicationPeer

Parameters:
peerId - id for the peer
Returns:
ReplicationPeer object

getPeerIds

Set<String> getPeerIds()
Returns the set of peerIds defined

Returns:
a Set of Strings for peerIds

getStatusOfPeer

boolean getStatusOfPeer(String peerId)
Get the replication status for the specified connected remote slave cluster. The value might be read from cache, so it is recommended to use getStatusOfPeerFromBackingStore(String) if reading the state after enabling or disabling it.

Parameters:
peerId - a short that identifies the cluster
Returns:
true if replication is enabled, false otherwise.

getStatusOfPeerFromBackingStore

boolean getStatusOfPeerFromBackingStore(String peerId)
                                        throws ReplicationException
Get the replication status for the specified remote slave cluster, which doesn't have to be connected. The state is read directly from the backing store.

Parameters:
peerId - a short that identifies the cluster
Returns:
true if replication is enabled, false otherwise.
Throws:
IOException - Throws if there's an error contacting the store
ReplicationException

getAllPeerConfigs

Map<String,ReplicationPeerConfig> getAllPeerConfigs()
List the cluster replication configs of all remote slave clusters (whether they are enabled/disabled or connected/disconnected).

Returns:
A map of peer ids to peer cluster keys

getAllPeerIds

List<String> getAllPeerIds()
List the peer ids of all remote slave clusters (whether they are enabled/disabled or connected/disconnected).

Returns:
A list of peer ids

getReplicationPeerConfig

ReplicationPeerConfig getReplicationPeerConfig(String peerId)
                                               throws ReplicationException
Returns the configured ReplicationPeerConfig for this peerId

Parameters:
peerId - a short name that identifies the cluster
Returns:
ReplicationPeerConfig for the peer
Throws:
ReplicationException

getPeerConf

Pair<ReplicationPeerConfig,org.apache.hadoop.conf.Configuration> getPeerConf(String peerId)
                                                                             throws ReplicationException
Returns the configuration needed to talk to the remote slave cluster.

Parameters:
peerId - a short that identifies the cluster
Returns:
the configuration for the peer cluster, null if it was unable to get the configuration
Throws:
ReplicationException


Copyright © 2007-2015 The Apache Software Foundation. All Rights Reserved.