Zookeeper operation and Maintenance instruction

Source: Internet
Author: User

Start and stop of the service:

Locate the%zkhome%\bin directory, through the zkserver.sh in this directory
Start zkserver.sh Start
Stop zkserver.sh Stop
Restart zkserver.sh restart
View ZK Service Status zkserver.sh status


ZK Client Command:

The Zookeeper command-line tool is similar to a Linux shell environment, but it is certainly less powerful than the shell, but with it we can simply access the zookeeper, create data, modify data, and so on. Using Zkcli.sh-server 127.0.0.1:2181 to connect to the ZooKeeper service, the system outputs the relevant environment and configuration information for ZooKeeper when the connection is successful. Some simple operations of the command-line tool are as follows:
1. Display the root directory, file: LS/use the LS command to view the content contained in the current ZooKeeper
2. Display the root directory, file: LS2/View the current node data and can see the number of updates and other data
3. Create the file and set the initial content: Create/zk "Test" creates a new Znode node "ZK" and the string associated with it
4. Get the contents of the file: Get/zk confirm if Znode contains the string we created
5. Modify the contents of the file: Set/zk "Zkbak" sets the string associated with ZK
6. Delete file: Delete/zk The znode you just created is deleted
7. Exit the client: Quit
8. Help command:


built-in four-word command (convenient and practical) :

ZooKeeper supports the interaction of some specific four-word command letters. Most of them are query commands that are used to obtain the current state of the ZooKeeper service and related information. The user can submit the corresponding command to the ZooKeeper via Telnet or NC on the client. NC's practice is NC localhost 2181 + carriage return, and then enter one of the following commands, then the server returns the appropriate information
1. Stat to see which node is selected as follower or leader
2. Ruok tests if the server is started, and if reply Imok indicates that it has been started.
3. Dump , lists the unprocessed sessions and temporary nodes.
4. Kill , turn off the server
5. conf , the details of the related service configuration are output.
6. Cons , lists the full connection/session details for all clients connected to the server.
7. Envi , output detailed information about the service environment (as distinct from the Conf command).
8. reqs , lists the unprocessed requests.
9. Wchs to list the details of the server watch.
. WCHC , the details of the server watch are listed by the session, and its output is a list of watch-related sessions.
One by one . WCHP , the details of the server watch are listed by path. It outputs a path associated with the session.
mntr . ,Output some ZK run time information, through the analysis of these return results, can achieve the effect of monitoring.
13.Srst, reset the server's statistics (functional command, use with caution
14.Crst, resets the statistics for all connections (functional command, use with caution


ZooKeeper commands:the Four Letter Words

Http://zookeeper.apache.org/doc/r3.4.6/zookeeperAdmin.html#sc_zkCommands


Zookeeper operation and Maintenance instruction

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.