|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.bigdata.zookeeper.ZooHelper
public class ZooHelper
Utility class for issuing the four letter commands to a zookeeper service.
| Field Summary | |
|---|---|
protected static org.apache.log4j.Logger |
log
|
| Constructor Summary | |
|---|---|
ZooHelper()
|
|
| Method Summary | |
|---|---|
static void |
destroyZNodes(org.apache.zookeeper.ZooKeeper zookeeper,
String zpath,
int depth)
Destroys all znodes under the specified zpath and then the znode at the specified zpath. |
static String |
dump(InetAddress addr,
int clientPort)
Sends a "dump" command and return the result. |
static boolean |
isRunning(InetAddress addr,
int clientPort)
Return true if zookeeper is running on the specified host
at the client port. |
static void |
kill(int clientPort)
Kills a local zookeeper instance responding at the specified client port. |
static void |
main(String[] args)
Send four letter commands to zookeeper. |
static void |
ruok(InetAddress addr,
int clientPort)
Inquires whether a zookeeper instance is running in a non-error state and returns iff the service reports "imok". |
static String |
stat(InetAddress addr,
int clientPort)
Sends a "stat" command and return the result. |
| 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.log4j.Logger log
| Constructor Detail |
|---|
public ZooHelper()
| Method Detail |
|---|
public static void ruok(InetAddress addr,
int clientPort)
throws IOException
addr - The address of the zookeeper instance.clientPort - The client port.
IOException - if there is any problem communicating with the service,
including a timeout (the service is not responsive).
public static void kill(int clientPort)
throws UnknownHostException,
IOException
clientPort - The client port.
IOException - if there is any problem communicating with the service,
including a timeout (the service is not responsive).
UnknownHostException
public static String stat(InetAddress addr,
int clientPort)
throws UnknownHostException,
IOException
addr - The address of the zookeeper instance.clientPort - The client port for zookeeper.
UnknownHostException - if the hostname can not be resolved.
IOException - if there is any problem communicating with the service,
including a timeout (the service is not responsive).
public static String dump(InetAddress addr,
int clientPort)
throws UnknownHostException,
IOException
addr - The address of the zookeeper instance.clientPort - The client port for zookeeper.
UnknownHostException - if the hostname can not be resolved.
IOException - if there is any problem communicating with the service,
including a timeout (the service is not responsive).
public static boolean isRunning(InetAddress addr,
int clientPort)
true if zookeeper is running on the specified host
at the client port.
true if zookeeper responds to an [ruok] request on
that host and client port.
public static void destroyZNodes(org.apache.zookeeper.ZooKeeper zookeeper,
String zpath,
int depth)
throws org.apache.zookeeper.KeeperException,
InterruptedException
zookeeper - zpath - The path to the root of the hierarchy to be destroyed.depth - The depth (initially zero).
org.apache.zookeeper.KeeperException
InterruptedException
public static void main(String[] args)
throws IOException
args - host:clientPort command
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||