|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.hadoop.hbase.replication.ReplicationZookeeperWrapper
public class ReplicationZookeeperWrapper
This class serves as a helper for all things related to zookeeper in replication.
The layout looks something like this under zookeeper.znode.parent for the master cluster:
replication/
master {contains a full cluster address}
state {contains true or false}
clusterId {contains a byte}
peers/
1/ {contains a full cluster address}
2/
...
rs/ {lists all RS that replicate}
startcode1/ {lists all peer clusters}
1/ {lists hlogs to process}
10.10.1.76%3A53488.123456789 {contains nothing or a position}
10.10.1.76%3A53488.123456790
...
2/
...
startcode2/
...
| Nested Class Summary | |
|---|---|
class |
ReplicationZookeeperWrapper.ReplicationStatusWatcher
Watcher for the status of the replication |
| Constructor Summary | |
|---|---|
ReplicationZookeeperWrapper(ZooKeeperWrapper zookeeperWrapper,
org.apache.hadoop.conf.Configuration conf,
AtomicBoolean replicating,
String rsName)
Constructor used by region servers, connects to the peer cluster right away. |
|
| Method Summary | |
|---|---|
void |
addLogToList(String filename,
String clusterId)
Add a new log to the list of hlogs in zookeeper |
SortedMap<String,SortedSet<String>> |
copyQueuesFromRS(String znode)
This methods copies all the hlogs queues from another region server and returns them all sorted per peer cluster (appended with the dead server's znode) |
void |
deleteOwnRSZNode()
Delete this cluster's queues |
void |
deleteRsQueues(String znode)
Recursive deletion of all znodes in specified rs' znode |
void |
deleteSource(String peerZnode)
Delete a complete queue of hlogs |
String |
getClusterId()
Get the identification of the cluster |
long |
getHLogRepPosition(String peerId,
String hlog)
Get the position of the specified hlog in the specified peer znode |
List<String> |
getListHLogsForPeerForRS(String rs,
String id,
org.apache.zookeeper.Watcher watch)
Get the list of hlogs for the specified region server and peer cluster |
List<String> |
getListOfReplicators(org.apache.zookeeper.Watcher watch)
Get the list of the replicators that have queues, they can be alive, dead or simply from a previous run |
List<String> |
getListPeersForRS(String rs,
org.apache.zookeeper.Watcher watch)
Get the list of peer clusters for the specified server names |
Map<String,ZooKeeperWrapper> |
getPeerClusters()
Get a map of all peer clusters |
List<HServerAddress> |
getPeersAddresses(String peerClusterId)
Returns all region servers from given peer |
List<String> |
getRegisteredRegionServers(org.apache.zookeeper.Watcher watch)
Get a list of all the other region servers in this cluster and set a watch |
boolean |
isReplicationMaster()
Tells if this cluster replicates or not |
boolean |
lockOtherRS(String znode)
Try to set a lock in another server's znode. |
void |
removeLogFromList(String filename,
String clusterId)
Remove a log from the list of hlogs in zookeeper |
void |
writeReplicationStatus(String filename,
String clusterId,
long position)
Set the current position of the specified cluster in the current hlog |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ReplicationZookeeperWrapper(ZooKeeperWrapper zookeeperWrapper,
org.apache.hadoop.conf.Configuration conf,
AtomicBoolean replicating,
String rsName)
throws IOException
zookeeperWrapper - zkw to wrapconf - conf to usereplicating - atomic boolean to start/stop replicationrsName - the name of this region server, null if
using RZH only to use the helping methods
IOException| Method Detail |
|---|
public List<HServerAddress> getPeersAddresses(String peerClusterId)
peerClusterId - (byte) the cluster to interrogate
public void addLogToList(String filename,
String clusterId)
filename - name of the hlog's znodeclusterId - name of the cluster's znode
public void removeLogFromList(String filename,
String clusterId)
filename - name of the hlog's znodeclusterId - name of the cluster's znode
public void writeReplicationStatus(String filename,
String clusterId,
long position)
filename - filename name of the hlog's znodeclusterId - clusterId name of the cluster's znodeposition - the position in the file
IOExceptionpublic List<String> getRegisteredRegionServers(org.apache.zookeeper.Watcher watch)
watch - the watch to set
public List<String> getListOfReplicators(org.apache.zookeeper.Watcher watch)
watch - the watche to set
public List<String> getListPeersForRS(String rs,
org.apache.zookeeper.Watcher watch)
rs - server names of the rswatch - the watch to set
public List<String> getListHLogsForPeerForRS(String rs,
String id,
org.apache.zookeeper.Watcher watch)
rs - server names of the rsid - peer clusterwatch - the watch to set
public boolean lockOtherRS(String znode)
znode - the server names of the other server
public SortedMap<String,SortedSet<String>> copyQueuesFromRS(String znode)
znode - server names to copy
public void deleteSource(String peerZnode)
peerZnode - znode of the peer cluster queue of hlogs to deletepublic void deleteRsQueues(String znode)
znode - public void deleteOwnRSZNode()
public long getHLogRepPosition(String peerId,
String hlog)
peerId - znode of the peer clusterhlog - name of the hlog
public boolean isReplicationMaster()
public String getClusterId()
public Map<String,ZooKeeperWrapper> getPeerClusters()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||