当前位置:网站首页>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 .
边栏推荐
- js . Find the first palindrome string in the array
- Polestar美股上市:5.5万台交付如何支持得起超200亿美元估值
- Exercise 9-3 plane vector addition
- 中国锂电池电解液行业市场专项调研报告(2022版)
- Fabric. JS document
- JVM class loading
- 金属有机骨架MIL-88负载阿霉素DOX|叶酸修饰UiO-66-NH2负载阿霉素[email protected]纳米粒子
- Redis:字符串类型数据的操作命令
- JS general form submission 1-onsubmit
- 交联环糊精金属有机骨架负载甲氨蝶呤缓释微粒|金属-有机多孔材料UiO-66负载黄酮苷类药物|齐岳
猜你喜欢
【吉林大学】考研初试复试资料分享
jvm-运行时数据区
核酸修饰的金属有机框架药物载体|PCN-223金属有机骨架包载Ad金刚烷|ZIF-8包裹阿霉素(DOX)
Rasp implementation of PHP
天图投资冲刺港股:资产管理规模249亿 投了小红书与奈雪
好看、好用、强大的手写笔记软件综合评测:Notability、GoodNotes、MarginNote、随手写、Notes Writers、CollaNote、CollaNote、Prodrafts、Noteshelf、FlowUs、OneNote、苹果备忘录
QT learning 20 standard dialog box in QT (middle)
消息订阅与发布
Eight sorts
QT learning 17 dialog box and its types
随机推荐
protobuf与grpc
JS download files through URL links
Scroll detection of the navigation bar enables the navigation bar to slide and fix with no content
RocksDB LRUCache
剑指 Offer 28. 对称的二叉树
Uniapp skills - scrolling components -1
Redis: commandes d'action pour les données de type chaîne
Canvas utility library fabric JS user manual
QT learning 21 standard dialog box in QT (Part 2)
FPGA test method takes mentor tool as an example
全局事件总线
Page generation QR code
Exercise 8-7 string sorting
必贝特医药冲刺科创板:年营收97万亏损1.37亿 拟募资20亿
x86汇编语言-从实模式到保护模式 笔记
JS new challenges
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.)
玖逸云黑免费无加密版本源码
QT learning 24 layout manager (III)
[combinatorics] permutation and combination (examples of combinatorial number of multiple sets | three counting models | selection problem | combinatorial problem of multiple sets | nonnegative intege