当前位置:网站首页>Raft 协议
Raft 协议
2022-07-03 13:33:00 【抓手】
对于强⼀致性共识算法,目前最多使用的就是 Raft 协议。
Raft协议成熟的实现案例
- 蚂蚁金服的JRaft;
- Zookeeper 的 ZAB;
- Consul 的 Raft;
- 百度的 braft;
- Apache 的 Ratis;
Raft角色
- 跟随者(Follower):普通群众,默默接收和来自领导者的消息,当领导者心跳信息超时的时候,就主动站出来,推荐自己当候选人。
- 候选人(Candidate):候选人将向其他节点请求投票 RPC 消息,通知其他节点来投票,如果赢得了大多数投票选票,就晋升当领导者。
- 领导者(Leader):处理写请求、管理日志复制和不断地发送心跳信息(维持领导地位)。
随机超时时间特性
Raft 算法中具有随机超时时间特点,每个节点等待领导者节点心跳信息的超时时间间隔是随机的。为了防止多个节点同时发起投票,每个节点分配的选举超时时间也是随机的。
选举过程
- 初始状态,所有节点都是跟随者。
- 当集群中没有领导者时,等待超时时间最小的节点会因为没有等到领导者心跳信息,发生超时。
- 超时自荐,此时该节点就会增加自己的任期编号,并推举自己为候选人,先给自己投一票,然后向其他节点发送请求投票RPC消息,请它们选举自己为领导者。
- 选举投票,其他节点接受到候选人的RPC消息时,并且在编号为1的任期内,没有投过票,那么就把选票投给该候选人,然后增加自己的任期编号。
- 新领导产生,候选人在选举超时时间内赢得了大多数的选票,那么它就会成为本届任期内新的领导者。
- 正常状态,领导者将周期性地发送心跳消息到其他服务。

边栏推荐
- Similarities and differences of sessionstorage, localstorage and cookies
- [technology development-24]: characteristics of existing IOT communication technology
- Common plug-ins for vite project development
- 3D视觉——2.人体姿态估计(Pose Estimation)入门——OpenPose含安装、编译、使用(单帧、实时视频)
- Multi person collaborative data annotation based on Baidu brain easydata from scratch
- Toast UI editor (editor allows you to edit your markup document using text or WYSIWYG, with syntax highlighting, scrolling synchronization, real-time preview and chart functions.)
- Redis: operation command of string type data
- Go language web development series 28: solve cross domain access of CORS with gin contrib / CORS
- Uniapp tips - set background music
- Redis:字符串类型数据的操作命令
猜你喜欢

Qt学习22 布局管理器(一)

小项目(servelt+jsp+mysql+EL+JSTL)完成一个登录功能的Servlet,具有增删改查的操作。实现登录身份验证,防止非法登录,防止多点登录,记住用户名密码功能。

28: Chapter 3: develop Passport Service: 11: define attributes in the configuration file, and then obtain them in the code;

Nucleic acid modified metal organic framework drug carrier | pcn-223 metal organic framework encapsulated ad adamantane | zif-8 encapsulated adriamycin (DOX)

Global event bus

28:第三章:开发通行证服务:11:在配置文件中定义属性,然后在代码中去获取;

Scroll detection of the navigation bar enables the navigation bar to slide and fix with no content

Halcon combined with C # to detect surface defects -- Halcon routine autobahn

QT learning 17 dialog box and its types

Golang - command line tool Cobra
随机推荐
Uniapp tips - scrolling components
Nucleic acid modified metal organic framework drug carrier | pcn-223 metal organic framework encapsulated ad adamantane | zif-8 encapsulated adriamycin (DOX)
JS continues to explore...
Qt学习21 Qt 中的标准对话框(下)
Qt学习18 登录对话框实例分析
Redis:字符串類型數據的操作命令
Summary of common error reporting problems and positioning methods of thrift
How to use lxml to judge whether the website announcement is updated
QT learning 21 standard dialog box in QT (Part 2)
JS Part 2
Global event bus
Doxorubicin loaded on metal organic framework MIL-88 DOX | folic acid modified uio-66-nh2 doxorubicin loaded [email
There is nothing new under the sun. Can the meta universe go higher?
Formation of mil-100 (FE) coated small molecule aspirin [email protected] (FE) | glycyrrhetinic acid modified metal organ
Selenium browser (1)
Record 405 questions about bank callback post request
PHP maze game
1px problem of mobile terminal
Uniapp skills - scrolling components -1
JS input number and standard digit number are compared. The problem of adding 0 to 0