|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.hbase.zookeeper.ZooKeeperWrapper
public class ZooKeeperWrapper
Wraps a ZooKeeper instance and adds HBase specific functionality. This class provides methods to: - read/write/delete the root region location in ZooKeeper. - set/check out of safe mode flag.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.apache.hadoop.hbase.HConstants |
---|
HConstants.Modify |
Field Summary | |
---|---|
String |
clusterStateZNode
|
protected static org.apache.commons.logging.Log |
LOG
|
Constructor Summary | |
---|---|
ZooKeeperWrapper(HBaseConfiguration conf,
org.apache.zookeeper.Watcher watcher)
Create a ZooKeeperWrapper. |
Method Summary | |
---|---|
boolean |
checkOutOfSafeMode()
Check if we're out of safe mode. |
void |
clearRSDirectory()
Method used to make sure the region server directory is empty. |
void |
close()
Close this ZooKeeper session. |
boolean |
deleteRootRegionLocation()
Delete ZNode containing root region location. |
String |
dump()
|
String |
getMasterElectionZNode()
Get the path of the masterElectionZNode |
String |
getQuorumServers()
|
long |
getSessionID()
This is for testing KeeperException.SessionExpiredException. |
byte[] |
getSessionPassword()
This is for testing KeeperException.SessionExpiredException. |
org.apache.zookeeper.ZooKeeper |
getZooKeeper()
|
boolean |
isConnected()
|
HServerAddress |
readMasterAddress(org.apache.zookeeper.Watcher watcher)
Read master address and set a watch on it. |
HServerAddress |
readMasterAddressOrThrow()
Read address of master server. |
HServerAddress |
readRootRegionLocation()
Read location of server storing root region. |
List<HServerAddress> |
scanRSDirectory()
Scans the regions servers directory |
boolean |
setClusterState(boolean up)
Set the cluster state, up or down |
void |
setClusterStateWatch(org.apache.zookeeper.Watcher watcher)
Watch the state of the cluster, up or down |
boolean |
updateRSLocationGetWatch(HServerInfo info,
org.apache.zookeeper.Watcher watcher)
Update the RS address and set a watcher on the znode |
boolean |
watchMasterAddress(org.apache.zookeeper.Watcher watcher)
Set a watcher on the master address ZNode. |
boolean |
writeMasterAddress(HServerAddress address)
Write address of master to ZooKeeper. |
boolean |
writeOutOfSafeMode()
Create ephemeral ZNode signifying that we're out of safe mode. |
boolean |
writeRootRegionLocation(HServerAddress address)
Write root region location to ZooKeeper. |
boolean |
writeRSLocation(HServerInfo info)
Write in ZK this RS startCode and address. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final org.apache.commons.logging.Log LOG
public final String clusterStateZNode
Constructor Detail |
---|
public ZooKeeperWrapper(HBaseConfiguration conf, org.apache.zookeeper.Watcher watcher) throws IOException
conf
- HBaseConfiguration to read settings from.watcher
- ZooKeeper watcher to register.
IOException
- If a connection error occurs.Method Detail |
---|
public String dump()
public org.apache.zookeeper.ZooKeeper getZooKeeper()
public long getSessionID()
public byte[] getSessionPassword()
public String getQuorumServers()
public boolean isConnected()
public HServerAddress readRootRegionLocation()
public HServerAddress readMasterAddressOrThrow() throws IOException
IOException
- if there's a problem reading the ZNode.public HServerAddress readMasterAddress(org.apache.zookeeper.Watcher watcher)
watcher
- Watcher to set on master address ZNode if not null.
public void setClusterStateWatch(org.apache.zookeeper.Watcher watcher)
watcher
- Watcher to set on cluster state nodepublic boolean setClusterState(boolean up)
up
- True to write the node, false to delete it
public boolean watchMasterAddress(org.apache.zookeeper.Watcher watcher)
watcher
- Watcher to set on master address ZNode.
public boolean deleteRootRegionLocation()
public boolean writeRootRegionLocation(HServerAddress address)
address
- HServerAddress to write to ZK.
public boolean writeMasterAddress(HServerAddress address)
address
- HServerAddress of master.
public boolean checkOutOfSafeMode()
public boolean writeOutOfSafeMode()
public boolean writeRSLocation(HServerInfo info)
info
- The RS info
public boolean updateRSLocationGetWatch(HServerInfo info, org.apache.zookeeper.Watcher watcher)
info
- The RS infowatcher
- The watcher to put on the znode
public List<HServerAddress> scanRSDirectory()
public void clearRSDirectory()
public void close()
public String getMasterElectionZNode()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |