当前位置:网站首页>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的任期内,没有投过票,那么就把选票投给该候选人,然后增加自己的任期编号。
- 新领导产生,候选人在选举超时时间内赢得了大多数的选票,那么它就会成为本届任期内新的领导者。
- 正常状态,领导者将周期性地发送心跳消息到其他服务。

边栏推荐
- Common network state detection and analysis tools
- Programmable logic device software testing
- Conversion function and explicit
- MySQL data processing value addition, deletion and modification
- QT learning 20 standard dialog box in QT (middle)
- 可编程逻辑器件软件测试
- 交联环糊精金属有机骨架负载甲氨蝶呤缓释微粒|金属-有机多孔材料UiO-66负载黄酮苷类药物|齐岳
- Why are grass-roots colleges and universities with "soil and poverty" called "Northeast small Tsinghua"?
- Go language web development series 30: gin: grouping by version for routing
- Function calling convention
猜你喜欢

Go language web development series 25: Gin framework: using MD5 to verify the signature for the interface station

Go language unit test 5: go language uses go sqlmock and Gorm to do database query mock

Multi person collaborative data annotation based on Baidu brain easydata from scratch

QT learning 20 standard dialog box in QT (middle)

jvm-对象生命周期

Summary of common error reporting problems and positioning methods of thrift
![[bw16 application] instructions for firmware burning of Anxin Ke bw16 module and development board update](/img/b8/31609303fd817c48b6fff7c43f31e5.png)
[bw16 application] instructions for firmware burning of Anxin Ke bw16 module and development board update

Metal organic framework (MOFs) antitumor drug carrier | pcn-223 loaded with metronidazole | uio-66 loaded with ciprofloxacin hydrochloride(

Cross linked cyclodextrin metal organic framework loaded methotrexate slow-release particles | metal organic porous material uio-66 loaded with flavonoid glycosides | Qiyue

Configure stylelint
随机推荐
金属有机骨架MIL-88负载阿霉素DOX|叶酸修饰UiO-66-NH2负载阿霉素[email protected]纳米粒子
28: Chapter 3: develop Passport Service: 11: define attributes in the configuration file, and then obtain them in the code;
叶酸修饰的金属-有机骨架(ZIF-8)载黄芩苷|金属有机骨架复合磁性材料([email protected])|制备路线
[technology development-24]: characteristics of existing IOT communication technology
Function calling convention
JVM系列——概述,程序计数器day1-1
可编程逻辑器件软件测试
QT learning 25 layout manager (4)
Go language web development series 26: Gin framework: demonstrates the execution sequence of code when there are multiple middleware
Implementation of Muduo asynchronous logging
Similarities and differences of sessionstorage, localstorage and cookies
Webpage connection database ~ simple implementation of addition, deletion, modification and query complete code
Invalid Z-index problem
Global event bus
Installation impression notes
Print. JS -- web page file printing
JS first summary
[combinatorics] permutation and combination (examples of combinatorial number of multiple sets | three counting models | selection problem | combinatorial problem of multiple sets | nonnegative intege
Generate directories from web content
3D视觉——2.人体姿态估计(Pose Estimation)入门——OpenPose含安装、编译、使用(单帧、实时视频)