Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The principle of watcher in Zookeeper

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "the principle of watcher in Zookeeper". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "the principle of watcher in Zookeeper".

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

There are three roles in the cluster: leader,follower,observer. Leader is a machine determined by election, which provides read and write function for the client. Follower and observer can improve the read performance of the cluster without affecting the write performance. The number of Zookeeper cluster nodes is odd. There are three types of nodes: temporary node, persistent node and sequential node. 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 changes in the data of directory nodes and changes in subdirectories. Once these states change, the server will notify all watcher set on this directory node, so that each client will quickly know that the state of the directory node it is concerned about has changed and respond accordingly.

Its application scenarios include: unified naming service, cluster management, master election, distributed barrier and so on.

Open source clients are: zkclient, curator.

Https://my.oschina.net/u/3847203/blog/2878240

Thank you for your reading, the above is the content of "the principle of watcher in Zookeeper", after the study of this article, I believe you have a deeper understanding of the principle of watcher in Zookeeper, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report