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

边栏推荐
- Qt学习24 布局管理器(三)
- Folic acid modified metal organic framework (zif-8) baicalin loaded metal organic framework composite magnetic material (AU- [email
- Metal organic framework material zif-8 containing curcumin( [email protected] Nanoparticles) | nano metal organic framework carry
- Formation of mil-100 (FE) coated small molecule aspirin [email protected] (FE) | glycyrrhetinic acid modified metal organ
- Print. JS -- web page file printing
- Go 1.16.4: purpose of go mod tidy
- FPGA测试方法以Mentor工具为例
- 金属有机骨架(MOFs)抗肿瘤药载体|PCN-223装载甲硝唑|UiO-66包载盐酸环丙沙星([email protected])
- Redis:字符串类型数据的操作命令
- JVM系列——概述,程序计数器day1-1
猜你喜欢

Cross linked cyclodextrin metal organic framework loaded methotrexate slow-release particles | metal organic porous material uio-66 loaded with flavonoid glycosides | Qiyue
![[understanding by chance-37]: the structure of human sensory system determines that human beings are self-centered](/img/06/b71b505c7072d540955fda6da1dc1b.jpg)
[understanding by chance-37]: the structure of human sensory system determines that human beings are self-centered

Qt学习17 对话框及其类型

Logback log sorting

How to use lxml to judge whether the website announcement is updated

FPGA测试方法以Mentor工具为例

Richview trvstyle liststyle list style (bullet number)

Redis: commandes d'action pour les données de type chaîne

Solve MySQL 1045 access denied for user 'root' @ 'localhost' (using password: yes)
![Mysql:insert date:SQL 错误 [1292] [22001]: Data truncation: Incorrect date value:](/img/2f/33504391a661ecb63d42d75acf3a37.png)
Mysql:insert date:SQL 错误 [1292] [22001]: Data truncation: Incorrect date value:
随机推荐
Thrift threadmanager and three monitors
JVM垃圾回收机
Programmable logic device software testing
Go: send the get request and parse the return JSON (go1.16.4)
JVM object lifecycle
Dynamic programming 01 knapsack and complete knapsack
JS input number and standard digit number are compared. The problem of adding 0 to 0
Summary of common error reporting problems and positioning methods of thrift
JS download files through URL links
Leetcode-1175. Prime Arrangements
How to delete an attribute or method of an object
Conversion function and explicit
[combinatorics] permutation and combination (examples of combinatorial number of multiple sets | three counting models | selection problem | combinatorial problem of multiple sets | nonnegative intege
GoLand 2021.2 configure go (go1.17.6)
Global event bus
Function calling convention
[combinatorics] permutation and combination (two counting principles, examples of set permutation | examples of set permutation and circle permutation)
28:第三章:开发通行证服务:11:在配置文件中定义属性,然后在代码中去获取;
金属有机骨架MIL-88负载阿霉素DOX|叶酸修饰UiO-66-NH2负载阿霉素[email protected]纳米粒子
Scroll detection of the navigation bar enables the navigation bar to slide and fix with no content