Reprinted from: http://www.cnblogs.com/sunddenly/p/4031881.html
2.1.1 Zookeeper Command Tool
After you start the Zookeeper service, enter the following command to connect to the Zookeeper service:
Zkcli.sh-server localhost:2181
After the connection is successful, the system outputs the relevant environment and configuration information of the Zookeeper, and on the screen output "Welcome to zookeeper! "and other information. After you enter help, the screen will output the available zookeeper commands, as shown in
1.2 Simple steps to use the Zookeeper command (CRUD)
(1) Use the LS command to see what is contained in the current zookeeper: LS/
[Zk:localhost:2181 (CONNECTED) 1] LS/[zookeeper][zk:localhost:2181 (CONNECTED) 2]
(2) Create a new Znode node "ZK", as well as its related characters, to execute the command: CREATE/ZK myData
[Zk:localhost:2181 (CONNECTED) 2] Create/zk Mydatacreated/zk
(3) Use the LS command again to see what is now contained in zookeeper: LS/
[Zk:localhost:2181 (CONNECTED) 3] LS/[ZK, zookeeper]
At this point, the ZK node has been created.
(4) Use the GET command to confirm that the Znode created in the second step contains the string we created, executing the command: GET/ZK
[Zk:localhost:2181 (CONNECTED) 4] get/zk= 0x500000006= Fri Oct 03:54:20 PDT= 0x5000000 FriOct 03:54:20 PDT = 0x500000006= 0= 0= 0= 0x0= 6= 0
(5) Next, the set command for the strings associated with the ZK settings, execute the command: SET/ZK jiang1234
[Zk:localhost:2181 (CONNECTED) 5] set/zk Jiang2014czxid = 0x500000006= Fri Oct 03:54:20 PDT= 0x 500000007=Fri Oct 03:55:50 PDT = 0x500000006= 0= 1= 0= 0x0< c8>= 9= 0
(6) Use the GET command again to view, last modified content, execute command: GET/ZK
[Zk:localhost:2181 (CONNECTED) 6] get/zk= 0x500000006= Fri Oct 03:54:20 PDT= 0x5000000 FriOct 03:55:50 PDT = 0x500000006= 0= 1= 0= 0x0= 9= 0
(7) Below we will just create the znode delete, execute command: DELETE/ZK
Delete /zk
(8) Finally again using the LS command to view the contents of the zookeeper, execute the command: LS/
[Zk:localhost:2181 (CONNECTED) 8] LS/[zookeeper]
After verification, the ZK node has been deleted.
Zookeeper Shell operation (reprint)