In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Etcd is an advanced key-value storage system. The main purpose of this article is to learn from etcd. If you have any misunderstandings, please clap your bricks.
It is mainly divided into three forms of election. Let's first talk about the three states of etcd nodes, which are leader,candidate and follower.
The first kind: initial election
A, B, C and D are coming in now, so who will be the leader? A (transformed into candidatae) talked to BCD separately and said, "I'll do it. Is that okay with you?" B\ C didn't have any ideas of his own, so he agreed. Although D disagreed, everyone said so, so he had to agree. A begins to exercise the right to regularly synchronize logs from BCD and send heartbeats (heartbeat)
Second, leader exception
An is the leader, BCD is follower, and everyone is working. Suddenly A had a stomachache and went to the toilet (malfunction). There was something wrong with BCD, but there was no way to report it. BCD discussed, let's elect a new leader! So B (transformed into candidate) took the initiative to ask C and D alone, "do you have a problem with me being the leader?" . CD has no opinion, so B became the leader, so A just came back at this time, found this scene, what to do? They compete with each other and decide who will be the leader according to the number of steps in the log, because A has been absent for so long and there is no news, so they fail. So A cleans up his messages and becomes follower.
Third, follower exception
Ditto, but the one with stomachache is C, not A. ABD works properly, and when C comes back, it becomes follower directly.
Fourth, the initial follower changes at the same time (becomes candidate)
A went to talk to C and B went to talk to D. C promised with Amam D promised to follow B, at this time A to ask D was directly refused, B asked C was also rejected. An asks B that they are both candidate, who is afraid of who? You reject me, and I reject you. What about four people? After a time difference (150ms~300ms), An initiates a conversation with Cpene D again. At this time, CMagne D agrees to A (B hasn't responded yet). At this time, A has become leader,B and found that it already has leader and becomes follower again.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.