3-zookeeper application scenarios

1 Overview

  The core system of zk is a file system registered by the business + a monitoring mechanism to monitor and notify file system changes.

  Suppose in a distributed system, there are 5 servers running business processes. When the process starts, it will go to zk to register the temporary node and register the listener. Then, when the process hangs and the number of child nodes changes (that is, the file system changes), the monitoring notification is triggered.

 

2 Node Awareness

  In a distributed system, say there are 10 processes under processA. The front-end node needs to establish a route to transmit messages to the opposite end, but it is not known whether 10 are still online at this time, or has been increased to 15, or has been reduced to 5. The front-end node can sense the status of the peer by registering the watcher of zk, so as to throw the message to the running peer.

  Since this perception is broadcast under the parent node, a large number of perceptions will increase traffic, and it is necessary to perform reasonable directory grouping according to services.

 

3 Docking alarm

  Ephemeral nodes represent a registered process. The disappearance of the node basically means that the process hangs. The listener can connect to the python script to trigger alarm information.

Guess you like

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