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

What is the ZAB protocol in Zookeeper?

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

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

ZAB protocol is a message broadcasting protocol specially designed for Zookeeper to support crash recovery. The ZAB protocol allows only one main process to accept and process client transaction requests, that is, leader. When leader receives the request, it converts the request transaction into transaction proposal. Because leader creates a queue for each follower, the transaction is put into the response queue to ensure the order of the transaction. The proposal is then broadcast sequentially to other nodes in the queue, and when received by follower, it is written to the local log as a transaction and a feedback ack confirmation is sent to leader. Leader waits for responses from other followe, and when it receives more than half of the follower responses, leader sends commit messages to other nodes and submits the proposal.

ZAB has two modes, namely, the recovery mode and message broadcasting. When the system starts or the leader server fails, enter the fault recovery mode. A new round of elections will begin, and the resulting leader will be synchronized with more than half of the follower to make the data consistent.

When the synchronization is over, exit the recovery mode and enter the message broadcast mode. When a server that complies with ZAB protocol starts, if it detects that leader is broadcasting messages, it automatically enters the recovery mode, and when it completes synchronization with leader, it enters message broadcast mode; if the non-leader node in the cluster receives the client request, the non-leader node will first send the request to the leader server.

When the fault resumes, ZAB protocol needs two guarantees: first, ZAB protocol needs to ensure that transactions that have been committed by leader will eventually be committed by all machines; second, it needs to ensure that transactions committed only on leader are discarded. In order to ensure the above two points, the above problems can be solved by choosing the node with the largest ZXID during the election.

The condition for leader re-election is that less than half of the nodes in the cluster remain connected to the current leader when the leader goes down or fails.

Thank you for your reading, the above is the content of "what is the ZAB protocol in Zookeeper". After the study of this article, I believe you have a deeper understanding of what the ZAB protocol in Zookeeper is, 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