Zookeeper Combat (iii)-zookeeper common commands

Source: Internet
Author: User
Tags zookeeper zookeeper client

The previous article has been introduced. If you deploy multiple zookeeper instances on a single machine in a Windows environment, this article mainly explains the operations commands commonly used by zookeeper clients. Start Windows environment

Double-click the Zkserver.cmd script to start zookeeper, as shown below:

Linux Environment

Use the zkserver.sh script as follows: Start ZK service: SH bin/zkserver.sh start view ZK service status: SH bin/zkserver.sh status Stop ZK service: SH bin/zkserver.sh stop heavy Kai ZK Service: SH bin/zkserver.sh restart zookeeper client command connection Zookeeper

After starting the ZooKeeper service, we can use the following command to connect to the ZooKeeper service:

Zookeeper-3.4.8\bin>zkcli.cmd-server 127.0.0.1:2181

In the Linux environment:

After successful connection, the system will output the relevant environment and configuration information of ZooKeeper, as follows:

Common Commands

We can use the Help command to view assistance:

Some common operations commands for command-line tools are as follows: ls

Use the LS command to view all the files contained in a directory, such as:

[Zk:127.0.0.1:2181 (CONNECTED) 1] LS/
LS2

Use the LS2 command to view all the files contained in a directory, unlike LS, which looks at time, version, and other information

[Zk:127.0.0.1:2181 (CONNECTED) 1] LS2/
Create

Create the Znode and set the initial content, such as

Create a new Znode node "test" and the string associated with it get

Get the data for Znode as follows:

[Zk:127.0.0.1:2181 (CONNECTED) 1] get/test
Set

Modify Znode content, for example:

[Zk:127.0.0.1:2181 (CONNECTED) 1] set/test "Ricky"
Delete

Delete Znode

[Zk:127.0.0.1:2181 (CONNECTED) 1] delete/test
quit

Quit Client Help

Help commands

To this, Zookeeper common command part explained, the next one explains the use of Zookeeper Java API.

Resources:
https://zookeeper.apache.org

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.