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

Introduction to the basic principles of zookeeper

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

Share

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

This article introduces the relevant knowledge of "introduction to the basic principles of zookeeper". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Basic principles

There are many server, which can be divided into master and subordinate, but there is one leader and the other is follower.

Each server has a piece of data in memory. When it is started, a leader will be elected according to the paxos protocol.

Leader handles data update operations, using the zab protocol

A sign of a successful update operation, most of the server is in memory, and the data is modified successfully (one has 5, 3 have been written successfully)

Zookeeper role

How do you know that most of the writing is successful? when the leader initiates the vote, the leader receives three votes, that is, most of the writing is successful.

Learners (learner) are divided into followers (follower) and observers (ObServer).

High availability, for example, if two nodes are down, you can still provide services. In order to support more clients, you need to add server.

The increase in server will lead to an increase in voting delay, because voting requires more than half of the votes to be successful.

Assuming that one of the Server is slow and the network is slow, zookeeper weighs scalability against throughput and introduces an observer

Benefits (1) do not participate in the voting process, only synchronize leader status, receive client connections, and forward requests to leaders, so that follower has less connection with leaders, so it will not affect, because of high concurrency, the load is too high and hang up, so observer can share some of the pressure. (2) when adding more observer, you can improve the scalability of gao's entire zookeeper without affecting throughput.

The leader election algorithm adopts the paxos protocol.

The core idea of paxos is that when most server writes successfully, the task data is written successfully.

1) if there are three server, two successful writes are required to indicate that the task data is written successfully.

2) if there are 4 or 5 server, three successful writes are required to indicate that the task data is written successfully.

The number of server is generally odd, such as 3pm, 5pm, 7and so on.

1) if there are 3 server, a maximum of 1 server is allowed to fail. (two of them are successful, indicating success)

2) if there are 4 server, a maximum of 1 server is also allowed to fail (three are successful, indicating success)

Client sends a request to server. If server1 is not leader,server1, it forwards the request to leader,leader and broadcasts the request to each server. When each server is written successfully, notify leader. When most server notifications are successful, it indicates that the write is successful.

This is the end of the introduction to the basic principles of zookeeper. Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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