Third, the application scenario of zookeeper cluster
Scenario 1: unified naming service
We give the service or application a name, and then there is a corresponding ip address below, which is easy to understand, similar to DNS parsing
Scenario 2:
That is, we write the configuration file into the / configuration file, and then three client listen on the / configuration node. When the content of the node changes, client will be told, and then client will pull down the new configuration information and make changes.
Scenario 3:
Unified cluster management is to obtain the information of nodes in real time, which is very important in the cluster. Every time client starts, it registers and listens in the zk cluster. When the server changes, it will make corresponding changes.
Scenario 4:
That is, server will write the server status information in the cluster to the zk cluster. When server 2 changes, the data of zk will change, which will inform client, so cilent will no longer connect to the server2 server.
Scenario 5:
The node information and the number of visits of the nginx cluster service are stored in the zk cluster, and zk allocates the latest requests according to the number of nodes accessed.