Common commands of zookeeper

 

Reference 1: Installation and Deployment of ZooKeeper 

Reference 2: Zookeeper introduction and installation and deployment

 

Suppose 3 nodes form a zookeeper cluster

1. Connect to the zk cluster:

bin/zkCli.sh -server localhost:2181,localhost:2182,localhost:2183

 

2. Check who is the leader in the zk cluster and the current zk status:

bin/zkServer.sh status

output: 

    Mode: leader

    OR

    Mode: follower

or command:

echo srvr | nc localhost 2181

  

3, zk server command help information:

bin/zkServer.sh help

 output:

    Usage: bin/zkServer.sh {start|start-foreground|stop|restart|status|upgrade|print-cmd}

 

In a 5-node cluster, the application system only configures 3 nodes as the server list. wrote
For example, the general zk configuration for everyone is 1, 2, and 3, a total of 3 machines. I added 4 and 5 machines to form a 5-node cluster. Now that machine 1 is down, it has no effect on the application system. Both machines 1 and 2 are down, and it's fine, because three of the five nodes in the cluster are alive. If machines 1, 2, and 3 all hang, then the 5-node zk is done, and the application hangs.
Conclusion: As long as the zk cluster survives normally, the connection between the zk client and any one or more zk servers can work normally.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326189272&siteId=291194637