Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
Other Resources:
Run ZooKeeper Client Commands
How to run ZooKeeper Client Commands?
✍: FYIcenter.com
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
2022-02-19, 1023🔥, 0💬
Popular Posts:
How to show the XML parsing flow with sax\DocumentTracer.java provided in the Apache Xerces package?...
How to download and install ojdbc5.jar for Oracle 11g R1? ojdbc5.jar for Oracle 11g R1 is a Java 5 J...
JDK 17 java.base.jmod is the JMOD file for JDK 17 Base module. JDK 17 Base module compiled class fil...
How to download and install Apache XMLBeans Source Package? The source package contains Java source ...
ANTLR is a powerful parser generator for multiple programming languages including Java. ANTLR contai...