Zookeeper Shell operation (reprint)

Source: Internet
Author: User
Tags zookeeper

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)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.