当前位置:网站首页>Raft agreement
Raft agreement
2022-07-03 14:13:00 【Grab】
For strong ⼀ Consensus algorithm , At present, the most used is Raft agreement .
Raft Implementation cases of mature protocols
- Ant gold JRaft;
- Zookeeper Of ZAB;
- Consul Of Raft;
- Baidu braft;
- Apache Of Ratis;
Raft role
- follower (Follower): Ordinary people , Silently receiving and receiving messages from leaders , When the leader's heartbeat message times out , I'll take the initiative to stand up , Recommend yourself as a candidate .
- The candidate (Candidate): Candidates will ask other nodes to vote RPC news , Inform other nodes to vote , If you win a majority of the votes , Just be promoted to be a leader .
- The leader (Leader): Handle write requests 、 Manage log replication and constantly send heartbeat information ( Maintain leadership ).
Random timeout characteristics
Raft The algorithm has the characteristics of random timeout , The timeout interval of each node waiting for the heartbeat information of the leader node is random . To prevent multiple nodes from voting at the same time , The election timeout allocated by each node is also random .
The election process
- The initial state , All nodes are followers .
- When there is no leader in the cluster , The node with the smallest waiting timeout will not wait for the leader's heartbeat , Timeout occurred .
- Overtime self recommendation , At this point, the node will add its own tenure number , And recommend yourself as a candidate , Vote for yourself first , Then send a request to vote to other nodes RPC news , Ask them to elect themselves leaders .
- The election vote , Other nodes receive the candidate's RPC When the news , And numbered 1 Term of office , Have you ever voted for , Then vote for the candidate , Then add your term number .
- New leaders emerge , The candidate won a majority of the votes during the election timeout , Then it will be the new leader of this term .
- The normal state , Leaders will periodically send heartbeat messages to other services .
边栏推荐
- Uniapp tips - scrolling components
- Uio-66-cooh loaded bendamostine | hydroxyapatite (HA) coated MIL-53 (FE) nanoparticles | baicalin loaded manganese based metal organic skeleton material
- 剑指 Offer 28. 对称的二叉树
- js 2023. String pair equal to the target string after connection
- 可编程逻辑器件软件测试
- 玖逸云黑免费无加密版本源码
- JS Part III
- Formation of mil-100 (FE) coated small molecule aspirin [email protected] (FE) | glycyrrhetinic acid modified metal organ
- 金属有机骨架(MOFs)抗肿瘤药载体|PCN-223装载甲硝唑|UiO-66包载盐酸环丙沙星([email protected])
- QT learning 22 layout manager (I)
猜你喜欢
泰凌冲刺科创板:拟募资13亿 国家大基金与小米长江是股东
QT learning 23 layout manager (II)
Failure of vector insertion element iterator in STL
Leetcode(4)——尋找兩個正序數組的中比特數
Example analysis of QT learning 18 login dialog box
Current situation, analysis and prediction of information and innovation industry
金属有机骨架MOFs装载非甾体类抗炎药物|ZIF-8包裹普鲁士蓝负载槲皮素(制备方法)
Rasp implementation of PHP
Generate directories from web content
Installation impression notes
随机推荐
Understanding of closures
1px problem of mobile terminal
Exercise 10-2 recursive factorial sum
Exercise 6-2 using functions to sum special A-string sequences
6-9 statistics of single digits (15 points)
Rasp implementation of PHP
金属有机骨架MIL-88负载阿霉素DOX|叶酸修饰UiO-66-NH2负载阿霉素[email protected]纳米粒子
C language,%d% Difference between 2D%2d%02d
Exercise 10-3 recursive implementation of exponential functions
Onmenusharetimeline custom shared content is invalid, and the title and icon are not displayed
Eight sorts
中国PETG市场预测及战略研究报告(2022版)
28: Chapter 3: develop Passport Service: 11: define attributes in the configuration file, and then obtain them in the code;
JVM object lifecycle
Exercise 8-7 string sorting
js 2023. String pair equal to the target string after connection
Simulated access
Redis:字符串類型數據的操作命令
Current situation, analysis and prediction of information and innovation industry
Interface for querying IP home