Original link: http://blog.csdn.net/woshioosm/article/details/45560177
1, Unzip zookeeper, create folder in directory data and log
2, under Conf folder change zoo_sample.cfg renamed to Zoo.cfg add
# Store the location of the database snapshot in memory, and if you do not set the parameter, the update transaction log will be stored in the default location.
Datadir=d:\\zookeeper-3.4.6\\data
# where error logs are stored
Datalogdir=d:\\zookeeper-3.4.6\\log
(This is a stand-alone mode) cluster mode is required to join
server.1=127.0.0.1:2888:3888
server.2=127.0.0.1:2,889:3,889
Also create a new myID file under the Data folder with a value of 1, 2
3, open the CMD console CD to the Bin folder, you can start the server by Zkserver.cmd
4, then open a CMD console, CD to the Bin folder, perform zkcli-server 127.0.0.1:2181 connection successful, enter the command after the
Build Node Create/zk Hello
Get node Get/zk
Set node Set/zk Hello2
Establishing child nodes Set/zk/subzk Hello3
Output Node Directory Ls/zk
Delete node Delete/zk and so on
5,zookeeper's four-word command
ZooKeeper Four Word command |
Function description |
Conf |
Output details about the service configuration. |
Cons |
Lists the full connection/session details for all clients connected to the server. Includes the number of packets received/sent, session ID, operation delay, last action execution, and so on. |
Dump |
Lists the unprocessed sessions and temporary nodes. |
Envi |
Output detailed information about the service environment (as distinct from the Conf command). |
Reqs |
List unprocessed requests |
Ruok |
Test whether the service is in the correct state. If this is the case, then the service returns "Imok", otherwise does not do any corresponding. |
Stat |
Output a list of clients for performance and connectivity. |
Wchs |
Lists the details of the server watch. |
Wchc |
The details of the server watch are listed through the session, and its output is a list of watch-related sessions. |
Wchp |
Details of server watch are listed by path. It outputs a path associated with the session. |
Need to use Telnet or netcat here, take netcat as an example.
Download netcat for Windows
After decompression, add the directory where Nc.exe is located in the Windows environment variable path.
The cmd client can then be executed to perform echo CONF|NC 127.0.0.1 2181 (note that the port out is a space not a colon).
Zookeeper configuration and underlying commands under Windows