Briefly describe Zookeeper. . . watcher

Zookeeper provides an efficient and reliable distributed coordination service for distributed applications. Its implementation relies on the ZAB protocol and implements an active-standby mode architecture to maintain data consistency in the cluster. Zookeeper enables distributed applications to coordinate through a shared tree-structured namespace. It also stores all data in memory. Any machine in the Zookeeper cluster can respond to the client's read operation, and the full amount of data exists in memory, so Zookeeper is more suitable for application scenarios that focus on read operations.

The cluster includes three roles: leader, follower, and observer. The leader is a machine determined by election, which provides read and write functions for clients. Followers and observers can improve the read performance of the cluster without affecting the write performance. The number of Zookeeper cluster nodes is odd. Its nodes have three types: temporary nodes, persistent nodes, and sequential nodes. Each node has a stat structure. The most important function is the watcher function.

watcher : watcher is a core function in ZK, watcher can monitor data changes of directory nodes and changes in subdirectories. Once these states change, the server will notify all watchers set on this directory node, so that each client All quickly know that the state of the directory node it cares about changes and react accordingly.

Its application scenarios include: unified naming service, cluster management, master election, distributed barriers, etc.

Open source clients include: zkclient, curator.

Guess you like

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