Run ZooKeeper Client Commands
How to run ZooKeeper Client Commands?
If you have a ZooKeeper Server running, you can follow these steps to run some ZooKeeper client commands:
1. On the client computer, download and install Apache ZooKeeper binary package.
2. Run the client script to connect to the ZooKeeper server. You see the client command prompt.
fyicenter$ bin/zkCli.sh -server 127.0.0.1:2181 /usr/bin/java Connecting to 127.0.0.1:2181 ... Client environment:zookeeper.version=3.7.0-... ... Client environment:host.name=192.168.1.191 ... Client environment:java.version=15 ... Client environment:java.vendor=Oracle Corporation ... Client environment:java.home=/usr/bin/java ... Client environment:java.class.path=... ... Client environment:java.library.path=... ... Client environment:java.io.tmpdir=... ... Client environment:java.compiler=<NA> ... ... INFO [main:ZooKeeper@637] - Initiating client connection, ... ... INFO [main:X509Util@77] - Setting -D ... ... INFO [main:ClientCnxnSocket@239] - jute.maxbuffer value is 1048575 Bytes ... INFO [main:ClientCnxn@1726] - zookeeper.request.timeout value is 0. Welcome to ZooKeeper! ... INFO [main-SendThread...] - Opening socket connection to server ... INFO [main-SendThread...] - SASL config status: Will not attempt to authenticate using SASL (unknown error) JLine support is enabled ... INFO [main-SendThread...] - Socket connection established, ... ... INFO [main-SendThread...] - Session establishment complete on server ... WATCHER:: WatchedEvent state:SyncConnected type:None path:null [zk: 127.0.0.1:2181(CONNECTED) 0]
3. Try the "help" command.
[zk: 127.0.0.1:2181(CONNECTED) 1] help ZooKeeper -server host:port -client-configuration properties-file cmd args addWatch [-m mode] path # optional mode, default is PERSISTENT_RECURSIVE addauth scheme auth close config [-c] [-w] [-s] connect host:port create [-s] [-e] [-c] [-t ttl] path [data] [acl] delete [-v version] path deleteall path [-b batch size] delquota [-n|-b|-N|-B] path get [-s] [-w] path getAcl [-s] path getAllChildrenNumber path getEphemerals path history listquota path ls [-s] [-w] [-R] path printwatches on|off quit reconfig [-s] [-v version] [[-file path] | [-members serverID=...] redo cmdno removewatches path [-c|-d|-a] [-l] set [-s] [-v version] path data setAcl [-s] [-v version] [-R] path acl setquota -n|-b|-N|-B val path stat [-w] path sync path version whoami
4. Try the "ls" command. There is one 1 node with 2 child nodes.
[zk: 127.0.0.1:2181(CONNECTED) 4] ls / [zookeeper] [zk: 127.0.0.1:2181(CONNECTED) 5] ls /zookeeper [config, quota] [zk: 127.0.0.1:2181(CONNECTED) 6] ls /zookeeper/config  [zk: 127.0.0.1:2181(CONNECTED) 7] ls /zookeeper/quota 
5. Quit the connection.
[zk: 127.0.0.1:2181(CONNECTED) 21] quit WATCHER:: WatchedEvent state:Closed type:None path:null INFO [main:ZooKeeper@1232] - Session: 0x10005dd8df40000 closed INFO [main-EventThread:ClientCnxn...] - EventThread shut down for session: ... ERROR [main:ServiceUtils@42] - Exiting JVM with code 0
â‡‘â‡‘ FAQ for Apache ZooKeeper
2022-02-19, 442👍, 0💬
What Is mail.jar of JavaMail 1.4.2? I got the JAR file from javamail-1.4.2.zip. mail.jar in javamail...
Where to find answers to frequently asked questions on Downloading and Using JDK (Java Development K...
What is the dom\GetElementsByTagName .javaprovided in the Apache Xerces package? I have Apache Xerce...
JasperReports, the world's most popular open source business intelligence and reporting engine and J...
Jaxen, Release 1.1.1, is an open source XPath library written in Java. It is adaptable to many diffe...