|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.hbase.client.replication.ReplicationAdmin
public class ReplicationAdmin
This class provides the administrative interface to HBase cluster
replication. In order to use it, the cluster and the client using
ReplicationAdmin must be configured with hbase.replication
set to true.
Adding a new peer results in creating new outbound connections from every region server to a subset of region servers on the slave cluster. Each new stream of replication will start replicating from the beginning of the current HLog, meaning that edits from that past will be replicated.
Removing a peer is a destructive and irreversible operation that stops all the replication streams for the given cluster and deletes the metadata used to keep track of the replication state.
Enabling and disabling peers is currently not supported.
As cluster replication is still experimental, a kill switch is provided
in order to stop all replication-related operations, see
setReplicating(boolean)
. When setting it back to true, the new
state of all the replication streams will be unknown and may have holes.
Use at your own risk.
To see which commands are available in the shell, type
replication
.
Constructor Summary | |
---|---|
ReplicationAdmin(org.apache.hadoop.conf.Configuration conf)
Constructor that creates a connection to the local ZooKeeper ensemble. |
Method Summary | |
---|---|
void |
addPeer(String id,
String clusterKey)
Add a new peer cluster to replicate to. |
void |
close()
|
void |
disablePeer(String id)
Stop the replication stream to the specified peer. |
void |
enablePeer(String id)
Restart the replication stream to the specified peer. |
int |
getPeersCount()
Get the number of slave clusters the local cluster has. |
boolean |
getReplicating()
Get the current status of the kill switch, if the cluster is replicating or not. |
Map<String,String> |
listPeers()
Map of this cluster's peers for display. |
void |
removePeer(String id)
Removes a peer cluster and stops the replication to it. |
boolean |
setReplicating(boolean newState)
Kill switch for all replication-related features |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ReplicationAdmin(org.apache.hadoop.conf.Configuration conf) throws IOException
conf
- Configuration to use
IOException
- if the connection to ZK cannot be made
RuntimeException
- if replication isn't enabled.Method Detail |
---|
public void addPeer(String id, String clusterKey) throws IOException
id
- a short that identifies the clusterclusterKey
- the concatenation of the slave cluster's
hbase.zookeeper.quorum:hbase.zookeeper.property.clientPort:zookeeper.znode.parent
IllegalStateException
- if there's already one slave since
multi-slave isn't supported yet.
IOException
public void removePeer(String id) throws IOException
id
- a short that identifies the cluster
IOException
public void enablePeer(String id) throws IOException
id
- a short that identifies the cluster
IOException
public void disablePeer(String id) throws IOException
id
- a short that identifies the cluster
IOException
public int getPeersCount()
public Map<String,String> listPeers()
public boolean getReplicating() throws IOException
IOException
public boolean setReplicating(boolean newState) throws IOException
newState
- true to start replication, false to stop it.
completely
IOException
public void close() throws IOException
close
in interface Closeable
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |