zookeeper Cli common commands
Service Management
- Start ZK Services: zkServer.sh start
- View ZK status: zkServer.sh status
- ZK stop service: zkServer.sh stop
- ZK restart the service: zkServer.sh restart
Terminal Operations
Use zkCli ZooKeeper can simply access to, data creation, data modification operations such as connecting the command line as follows:
zkCli.sh -server 127.0.0.1:2181
Command-line tool common operations:
-
Display the root directory file
ls / //查看当前节点数据 ls2 / //查看当前节点数据并能看到更新次数等数据
-
Create a file, and set the initial content:
create /config "test" //创建一个新的节点并设置关联值 create /config “” //创建一个新的空节点
-
Get file content
get /brokers //获取节点内容
-
Modify the contents of the file
set /zk "zkbak" //对 zk 所关联的字符串进行设置
-
Delete Files
delete /brokers //删除节点 rmr /brokers //删除节点及子节点
Four-character command
ZooKeeper supports certain four-character command letter and its interactions, to get the current status of the service and related information. The client can submit the appropriate commands to the ZooKeeper via telnet or nc. Command line is as follows:
echo conf | nc 132.37.3.26 26181
ZooKeeper four words commonly used commands:
-
conf
Detailed configuration of output-related services
-
cons
It lists the full details of connection / session all connections to the server of the client. The number of packets including the "receiving / transmission", session id, the operation delay, and so forth last operation performed
-
dump
Session and provisional list node untreated.
-
envi
Prints detailed information about the service environment (different from the conf command).
-
reqs
Untreated request list
-
Bib
Testing services are in the correct state. If so, then the service returns "imok", otherwise it makes no corresponding
-
stat
Output a list of performance and client connection.
-
wchs
For more information on watch lists of servers
-
wchc
For more information on watch lists by the server session, its output is a list of sessions related to the watch
-
wchp
For more information on watch lists by the server path. It outputs a path associated with the session
Reproduced in: https: //www.cnblogs.com/tuanz/p/8709776.html