网络断开后筏跟随者如何重新加入? [英] how raft follower rejoin after network disconnected?

查看:116
本文介绍了网络断开后筏跟随者如何重新加入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在木筏上遇到问题.

在论文寻找一种可以理解的共识算法(扩展版本)"中说:

In paper "In Search of an Understandable Consensus Algorithm(Extended Version)" it says:

要开始选举,追随者会增加其当前 学期和过渡到候选状态. (在第5.2节中)

To begin an election, a follower increments its current term and transitions to candidate state. (in section 5.2)

它还说:

在AppendEntries RPC和RequestVot RPC中,收件人应为如果args.term< currentTerm,则为false

reciever should be "Reply false if args.term < currentTerm" in AppendEntries RPC and RequestVot RPC

所以,让我们考虑一下这个场景,筏系统中有5台机器,现在机器0是领导者,机器1至4是跟随者,现在是术语1.突然,机器1断开网络连接,然后机器1是超时,并开始选举领导者,它发送RequestVot RPC,确保它将失败(网络已断开连接).然后它将开始新的领导人选举……等等.机器1的术语多次增加.也许增加到10.当机器1'Term增加到10时,它连接了网络.并且领导者(机器0)将心跳发送到机器1,机器1将拒绝该心跳(机器0'term小于机器1),现在,机器1将无法重新加入系统.

so, let's think this scene, there are 5 machine in raft system, and now machine 0 is leader, machine 1 to 4 is follower, now is term 1. Suddenly, machine 1 is disconnected network, and then machine 1 is timeout, and it begin leader election, it send RequestVot RPC, sure it will be failed(network is disconnected). and then it will begin new leader election.......and so on. machine 1's term is increasement many times. Maybe increase to 10. when machine 1'Term is increased to 10, it connected network. and leader(machine 0) send heartbeat to machine 1, and machine 1 will REJECT the heartbeat(machine 0'term is less than machine 1), and now, machine 1 will not able to rejoin the system.

推荐答案

这里要记住的重要一点是,当节点收到一个更大的术语时,它总是会更新其本地术语.因此,由于机器1将拒绝领导者的请求,所以领导者最终将了解较高的项(10)并下台,然后将选择一个新节点来表示项> 10.

The important thing to remember here is when a node receives a greater term it always updates its local term. So, since machine 1 will reject the leader's request, the leader will ultimately learn about the higher term (10) and step down, then a new node will be elected for term >10.

显然,这是低效的,但它就是为什么大多数现实世界中实现使用所谓的预投票"协议,检查以确保一个节点的可以的它转变之前赢得大选的候选人角色,增加期限.

Obviously this is inefficient, but it's why most real world implementations use the so called "pre-vote" protocol, checking to ensure a node can win an election before it transitions to the candidate role and increments the term.

这篇关于网络断开后筏跟随者如何重新加入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆