SlideShare a Scribd company logo
RAFT Paxos
Concept
Replicated Log for
Replicated State Machine
Consensus Algorithm
Leader Election
Key (First elected leader,
then normal operation)
Optional (A form of
operation)
Log maintenance
Leader’s Log is replicated to
all Followers
Node may log
consensus operation,
but it may have holes
TLA+ Spec
Close to developer’s
implementation & usage
More abstract
State Space Large Small
a
b
c
d
e
f
a b c e f g
h i
g
unique
S1: 1
S2: 1
S3: 1
S1: 2
S2: 1
S3: 1
S1: 2
S2: 1
S3: 1
RequestVoteRequest
S1: 2
S2: 2
S3: 2
RequestVoteRespose
S1: 2
S2: 2
S3: 2
1
2
a
2
2
b
3
2
c
S1: 2
S2: 2
S3: 2
1
2
a
2
2
b
3
2
c
4
2
d
5
2
e
6
2
f
1
2
a
2
2
b
1
2
a
Committed
Index
S1: 2
S2: 2
S3: 2
1
2
a
2
2
b
3
2
c
4
2
d
5
2
e
6
2
f
1
2
a
2
2
b
3
2
c
1
2
a
2
2
b
3
2
c
4
2
d
Committed
Index
one server per term
persisted
AppendEntries
AppendEntries
1
2
a
2
2
b
1
2
a
2
2
b
1
2
a
2
2
a
1
2
a
2
2
b
1
2
a
2
2
b
Committed
Index
Leader S1: 2
Follower S2: 2
Follower S3: 2
Follower S4: 2
Follower S5: 2
1
2
a
2
2
b
1
2
a
2
2
b
1
2
a
2
2
a
1
2
a
2
2
b
1
2
a
2
2
b
Committed
Index
Crash S1: 2
Crash S2: 2
Follower S3: 3
Leader S4: 3
Follower S5: 3
3
3
c
4
3
d
3
3
c
4
3
d
1
2
a
2
2
b
1
2
a
2
2
b
1
2
a
2
2
a
1
2
a
2
2
b
1
2
a
2
2
b
Committed
Index
Follower S1: 4
Crash S2: 2
Crash S3: 3
Follower S4: 4
Leader S5: 4
3
3
c
4
3
d
3
3
c
4
3
d
5
4
e
6
4
f
7
4
g
1
2
a
2
2
b
1
2
a
2
2
b
1
2
a
2
2
a
1
2
a
2
2
b
1
2
a
2
2
b
Committed
Index
Follower S1: 5
Follower S2: 5
Leader S3: 5
Crash S4: 4
Crash S5: 4
3
3
c
4
3
d
3
3
c
4
3
d
5
4
e
6
4
f
7
4
g
3
5
h
3
5
h
3
5
h
4
5
i
1
2
a
2
2
b
1
2
a
2
2
b
1
2
a
2
2
a
1
2
a
2
2
b
1
2
a
2
2
b
Committed
Index
Leader S1: 6
Follower S2: 6
Crash S3: 5
Crash S4: 4
Follower S5: 6
3
3
c
4
3
d
3
3
c
4
3
d
5
4
e
6
4
f
7
4
g
3
5
h
3
5
h
3
5
h
4
5
i
4
6
j
5
6
k
6
6
l
4
6
j
1
2
a
2
2
b
1
2
a
2
2
b
1
2
a
2
2
a
1
2
a
2
2
b
1
2
a
2
2
b
Committed
Index
Crash S1: 6
Follower S2: 6
Follower S3: 5
Follower S4: 4
Follower S5: 6
3
3
c
4
3
d
3
3
c
4
3
d
5
4
e
6
4
f
7
4
g
3
5
h
3
5
h
3
5
h
4
5
i
4
6
j
5
6
k
6
6
l
4
6
j
1
2
a
2
2
b
1
2
a
2
2
b
1
2
a
2
2
a
1
2
a
2
2
b
1
2
a
2
2
b
Committed
Index
Crash S1: 6
Crash S2: 6
Follower S3: 5
Follower S4: 4
Follower S5: 6
3
3
c
4
3
d
3
3
c
4
3
d
5
4
e
6
4
f
7
4
g
3
5
h
3
5
h
3
5
h
4
5
i
4
6
j
5
6
k
6
6
l
4
6
j
1
2
a
2
2
b
1
2
a
2
2
b
1
2
a
2
2
a
1
2
a
2
2
b
1
2
a
2
2
b
Committed
Index
Crash S1: 6
Crash S2: 6
Leader S3: 8
Follower S4: 8
Follower S5: 8
3
3
c
4
3
d
3
3
c
4
3
d
5
4
e
6
4
f
7
4
g
3
5
h
3
5
h
3
5
h
4
5
i
4
6
j
5
6
k
6
6
l
4
6
j
1
2
a
2
2
b
1
2
a
2
2
b
1
2
a
2
2
a
1
2
a
2
2
b
1
2
a
2
2
b
Committed
Index
Crash S1: 6
Leader S2: 7
Follower S3: 7
Follower S4: 7
Follower S5: 7
3
3
c
4
3
d
3
3
c
4
3
d
5
4
e
6
4
f
7
4
g
3
5
h
3
5
h
3
5
h
4
5
i
4
6
j
5
6
k
6
6
l
4
6
j
5
7
m
5
7
m
1
2
a
2
2
b
3
5
h
4
6
j
5
7
m
4
6
1
2
a
2
2
b
Follower S5: 7
3
3
c
4
3
d
5
4
e
6
4
f
7
4
g
Leader S2: 7
5
7
m
1
2
a
2
2
b
3
5
h
4
6
j
5
7
m
1
2
a
2
2
b
Follower S5: 7
3
3
c
4
3
d
5
4
e
6
4
f
7
4
g
Leader S2: 7
4
6
j
3
5
5
7
m
1
2
a
2
2
b
3
5
h
4
6
j
5
7
m
1
2
a
2
2
b
Follower S5: 7
3
3
c
4
3
d
5
4
e
6
4
f
7
4
g
Leader S2: 7 4
6
j
3
5
h
2
2
5
7
m
1
2
a
2
2
b
3
5
h
4
6
j
5
7
m
1
2
a
2
2
b
Follower S5: 7
Leader S2: 7 4
6
j
3
5
h
2
2
3
5
h
4
6
j
5
7
m
unique id
S1
S2
S3
S4
S5
S3, S4, S4 can be
elected as new
Leader
S1, S2 can be elected
as old Leader
S1
S2
S3
S4
S5
Configuration
Change to 3+5
Change
configuration to 5
S1
S2
S3
S4
S5
Change
Configuration 3+5
Change
Configuration to 3
Step Down
• Server Variable
currentTerm: (persisted)
state: { Follower, Leader, Candidate}
votedFor: (persisted)
log: (persisted)
commitIndex
• Candidate Variable
votesResponded
votesGranted
• Leader Variable
nextIndex
matchIndex
1
1
x  3
2
1
y  1
3
1
y  9
4
2
x  2
5
3
x  0
6
3
y  7
7
3
x  5
8
3
x  4
Follower
Leader
Candidate
Init
Timeout,
Start election
Timeout,
New election
BecomeLeaderDiscover leader with
Higher term
Discover leader with
Higher term
Restart
RequestVote
ClientRequest
AdvanceCommitIndex
AppendEntriesHandleRequestVoteRequest
HandleRequestVoteResponse
HandleAppendEntriesRequest
HandleAppendEntriesResponse
DropStaleResponse
DuplicateMessage
DropMessage
[Dr. TLA+ Series] Raft - Jin Li
[Dr. TLA+ Series] Raft - Jin Li
[Dr. TLA+ Series] Raft - Jin Li

More Related Content

Viewers also liked

Raft
Raft Raft
Raft
rfyiamcool
 
可靠分布式系统基础 Paxos的直观解释
可靠分布式系统基础 Paxos的直观解释可靠分布式系统基础 Paxos的直观解释
可靠分布式系统基础 Paxos的直观解释
Yanpo Zhang
 
AWS re:Invent 2016: Running Batch Jobs on Amazon ECS (CON310)
AWS re:Invent 2016: Running Batch Jobs on Amazon ECS (CON310)AWS re:Invent 2016: Running Batch Jobs on Amazon ECS (CON310)
AWS re:Invent 2016: Running Batch Jobs on Amazon ECS (CON310)
Amazon Web Services
 
Introduction to Ethereum
Introduction to EthereumIntroduction to Ethereum
Introduction to Ethereum
Terek Judi
 
AWS re:Invent 2016: Operations Automation and Infrastructure Management with ...
AWS re:Invent 2016: Operations Automation and Infrastructure Management with ...AWS re:Invent 2016: Operations Automation and Infrastructure Management with ...
AWS re:Invent 2016: Operations Automation and Infrastructure Management with ...
Amazon Web Services
 
AWS re:Invent 2016: Running Microservices on Amazon ECS (CON309)
AWS re:Invent 2016: Running Microservices on Amazon ECS (CON309)AWS re:Invent 2016: Running Microservices on Amazon ECS (CON309)
AWS re:Invent 2016: Running Microservices on Amazon ECS (CON309)
Amazon Web Services
 
AWS re:Invent 2016: Service Integration Delivery and Automation Using Amazon ...
AWS re:Invent 2016: Service Integration Delivery and Automation Using Amazon ...AWS re:Invent 2016: Service Integration Delivery and Automation Using Amazon ...
AWS re:Invent 2016: Service Integration Delivery and Automation Using Amazon ...
Amazon Web Services
 
Introduction to Apache ZooKeeper
Introduction to Apache ZooKeeperIntroduction to Apache ZooKeeper
Introduction to Apache ZooKeeper
Saurav Haloi
 
AWS re:Invent 2016: Deploying Scalable SAP Hybris Clusters using Docker (CON312)
AWS re:Invent 2016: Deploying Scalable SAP Hybris Clusters using Docker (CON312)AWS re:Invent 2016: Deploying Scalable SAP Hybris Clusters using Docker (CON312)
AWS re:Invent 2016: Deploying Scalable SAP Hybris Clusters using Docker (CON312)
Amazon Web Services
 
cdn的那些事儿
cdn的那些事儿cdn的那些事儿
cdn的那些事儿
rfyiamcool
 

Viewers also liked (10)

Raft
Raft Raft
Raft
 
可靠分布式系统基础 Paxos的直观解释
可靠分布式系统基础 Paxos的直观解释可靠分布式系统基础 Paxos的直观解释
可靠分布式系统基础 Paxos的直观解释
 
AWS re:Invent 2016: Running Batch Jobs on Amazon ECS (CON310)
AWS re:Invent 2016: Running Batch Jobs on Amazon ECS (CON310)AWS re:Invent 2016: Running Batch Jobs on Amazon ECS (CON310)
AWS re:Invent 2016: Running Batch Jobs on Amazon ECS (CON310)
 
Introduction to Ethereum
Introduction to EthereumIntroduction to Ethereum
Introduction to Ethereum
 
AWS re:Invent 2016: Operations Automation and Infrastructure Management with ...
AWS re:Invent 2016: Operations Automation and Infrastructure Management with ...AWS re:Invent 2016: Operations Automation and Infrastructure Management with ...
AWS re:Invent 2016: Operations Automation and Infrastructure Management with ...
 
AWS re:Invent 2016: Running Microservices on Amazon ECS (CON309)
AWS re:Invent 2016: Running Microservices on Amazon ECS (CON309)AWS re:Invent 2016: Running Microservices on Amazon ECS (CON309)
AWS re:Invent 2016: Running Microservices on Amazon ECS (CON309)
 
AWS re:Invent 2016: Service Integration Delivery and Automation Using Amazon ...
AWS re:Invent 2016: Service Integration Delivery and Automation Using Amazon ...AWS re:Invent 2016: Service Integration Delivery and Automation Using Amazon ...
AWS re:Invent 2016: Service Integration Delivery and Automation Using Amazon ...
 
Introduction to Apache ZooKeeper
Introduction to Apache ZooKeeperIntroduction to Apache ZooKeeper
Introduction to Apache ZooKeeper
 
AWS re:Invent 2016: Deploying Scalable SAP Hybris Clusters using Docker (CON312)
AWS re:Invent 2016: Deploying Scalable SAP Hybris Clusters using Docker (CON312)AWS re:Invent 2016: Deploying Scalable SAP Hybris Clusters using Docker (CON312)
AWS re:Invent 2016: Deploying Scalable SAP Hybris Clusters using Docker (CON312)
 
cdn的那些事儿
cdn的那些事儿cdn的那些事儿
cdn的那些事儿
 

Recently uploaded

220711130100 udita Chakraborty Aims and objectives of national policy on inf...
220711130100 udita Chakraborty  Aims and objectives of national policy on inf...220711130100 udita Chakraborty  Aims and objectives of national policy on inf...
220711130100 udita Chakraborty Aims and objectives of national policy on inf...
Kalna College
 
欧洲杯下注-欧洲杯下注押注官网-欧洲杯下注押注网站|【​网址​🎉ac44.net🎉​】
欧洲杯下注-欧洲杯下注押注官网-欧洲杯下注押注网站|【​网址​🎉ac44.net🎉​】欧洲杯下注-欧洲杯下注押注官网-欧洲杯下注押注网站|【​网址​🎉ac44.net🎉​】
欧洲杯下注-欧洲杯下注押注官网-欧洲杯下注押注网站|【​网址​🎉ac44.net🎉​】
andagarcia212
 
CIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdfCIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdf
blueshagoo1
 
Data Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsxData Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsx
Prof. Dr. K. Adisesha
 
How to Manage Reception Report in Odoo 17
How to Manage Reception Report in Odoo 17How to Manage Reception Report in Odoo 17
How to Manage Reception Report in Odoo 17
Celine George
 
Standardized tool for Intelligence test.
Standardized tool for Intelligence test.Standardized tool for Intelligence test.
Standardized tool for Intelligence test.
deepaannamalai16
 
220711130082 Srabanti Bag Internet Resources For Natural Science
220711130082 Srabanti Bag Internet Resources For Natural Science220711130082 Srabanti Bag Internet Resources For Natural Science
220711130082 Srabanti Bag Internet Resources For Natural Science
Kalna College
 
Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...
Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...
Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...
EduSkills OECD
 
Contiguity Of Various Message Forms - Rupam Chandra.pptx
Contiguity Of Various Message Forms - Rupam Chandra.pptxContiguity Of Various Message Forms - Rupam Chandra.pptx
Contiguity Of Various Message Forms - Rupam Chandra.pptx
Kalna College
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 8 - CẢ NĂM - FRIENDS PLUS - NĂM HỌC 2023-2024 (B...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 8 - CẢ NĂM - FRIENDS PLUS - NĂM HỌC 2023-2024 (B...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 8 - CẢ NĂM - FRIENDS PLUS - NĂM HỌC 2023-2024 (B...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 8 - CẢ NĂM - FRIENDS PLUS - NĂM HỌC 2023-2024 (B...
Nguyen Thanh Tu Collection
 
The basics of sentences session 7pptx.pptx
The basics of sentences session 7pptx.pptxThe basics of sentences session 7pptx.pptx
The basics of sentences session 7pptx.pptx
heathfieldcps1
 
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptxCapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
CapitolTechU
 
78 Microsoft-Publisher - Sirin Sultana Bora.pptx
78 Microsoft-Publisher - Sirin Sultana Bora.pptx78 Microsoft-Publisher - Sirin Sultana Bora.pptx
78 Microsoft-Publisher - Sirin Sultana Bora.pptx
Kalna College
 
BPSC-105 important questions for june term end exam
BPSC-105 important questions for june term end examBPSC-105 important questions for june term end exam
BPSC-105 important questions for june term end exam
sonukumargpnirsadhan
 
Bonku-Babus-Friend by Sathyajith Ray (9)
Bonku-Babus-Friend by Sathyajith Ray  (9)Bonku-Babus-Friend by Sathyajith Ray  (9)
Bonku-Babus-Friend by Sathyajith Ray (9)
nitinpv4ai
 
Elevate Your Nonprofit's Online Presence_ A Guide to Effective SEO Strategies...
Elevate Your Nonprofit's Online Presence_ A Guide to Effective SEO Strategies...Elevate Your Nonprofit's Online Presence_ A Guide to Effective SEO Strategies...
Elevate Your Nonprofit's Online Presence_ A Guide to Effective SEO Strategies...
TechSoup
 
Pharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brubPharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brub
danielkiash986
 
Ch-4 Forest Society and colonialism 2.pdf
Ch-4 Forest Society and colonialism 2.pdfCh-4 Forest Society and colonialism 2.pdf
Ch-4 Forest Society and colonialism 2.pdf
lakshayrojroj
 
Skimbleshanks-The-Railway-Cat by T S Eliot
Skimbleshanks-The-Railway-Cat by T S EliotSkimbleshanks-The-Railway-Cat by T S Eliot
Skimbleshanks-The-Railway-Cat by T S Eliot
nitinpv4ai
 
Temple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation resultsTemple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation results
Krassimira Luka
 

Recently uploaded (20)

220711130100 udita Chakraborty Aims and objectives of national policy on inf...
220711130100 udita Chakraborty  Aims and objectives of national policy on inf...220711130100 udita Chakraborty  Aims and objectives of national policy on inf...
220711130100 udita Chakraborty Aims and objectives of national policy on inf...
 
欧洲杯下注-欧洲杯下注押注官网-欧洲杯下注押注网站|【​网址​🎉ac44.net🎉​】
欧洲杯下注-欧洲杯下注押注官网-欧洲杯下注押注网站|【​网址​🎉ac44.net🎉​】欧洲杯下注-欧洲杯下注押注官网-欧洲杯下注押注网站|【​网址​🎉ac44.net🎉​】
欧洲杯下注-欧洲杯下注押注官网-欧洲杯下注押注网站|【​网址​🎉ac44.net🎉​】
 
CIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdfCIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdf
 
Data Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsxData Structure using C by Dr. K Adisesha .ppsx
Data Structure using C by Dr. K Adisesha .ppsx
 
How to Manage Reception Report in Odoo 17
How to Manage Reception Report in Odoo 17How to Manage Reception Report in Odoo 17
How to Manage Reception Report in Odoo 17
 
Standardized tool for Intelligence test.
Standardized tool for Intelligence test.Standardized tool for Intelligence test.
Standardized tool for Intelligence test.
 
220711130082 Srabanti Bag Internet Resources For Natural Science
220711130082 Srabanti Bag Internet Resources For Natural Science220711130082 Srabanti Bag Internet Resources For Natural Science
220711130082 Srabanti Bag Internet Resources For Natural Science
 
Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...
Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...
Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...
 
Contiguity Of Various Message Forms - Rupam Chandra.pptx
Contiguity Of Various Message Forms - Rupam Chandra.pptxContiguity Of Various Message Forms - Rupam Chandra.pptx
Contiguity Of Various Message Forms - Rupam Chandra.pptx
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 8 - CẢ NĂM - FRIENDS PLUS - NĂM HỌC 2023-2024 (B...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 8 - CẢ NĂM - FRIENDS PLUS - NĂM HỌC 2023-2024 (B...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 8 - CẢ NĂM - FRIENDS PLUS - NĂM HỌC 2023-2024 (B...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 8 - CẢ NĂM - FRIENDS PLUS - NĂM HỌC 2023-2024 (B...
 
The basics of sentences session 7pptx.pptx
The basics of sentences session 7pptx.pptxThe basics of sentences session 7pptx.pptx
The basics of sentences session 7pptx.pptx
 
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptxCapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
CapTechTalks Webinar Slides June 2024 Donovan Wright.pptx
 
78 Microsoft-Publisher - Sirin Sultana Bora.pptx
78 Microsoft-Publisher - Sirin Sultana Bora.pptx78 Microsoft-Publisher - Sirin Sultana Bora.pptx
78 Microsoft-Publisher - Sirin Sultana Bora.pptx
 
BPSC-105 important questions for june term end exam
BPSC-105 important questions for june term end examBPSC-105 important questions for june term end exam
BPSC-105 important questions for june term end exam
 
Bonku-Babus-Friend by Sathyajith Ray (9)
Bonku-Babus-Friend by Sathyajith Ray  (9)Bonku-Babus-Friend by Sathyajith Ray  (9)
Bonku-Babus-Friend by Sathyajith Ray (9)
 
Elevate Your Nonprofit's Online Presence_ A Guide to Effective SEO Strategies...
Elevate Your Nonprofit's Online Presence_ A Guide to Effective SEO Strategies...Elevate Your Nonprofit's Online Presence_ A Guide to Effective SEO Strategies...
Elevate Your Nonprofit's Online Presence_ A Guide to Effective SEO Strategies...
 
Pharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brubPharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brub
 
Ch-4 Forest Society and colonialism 2.pdf
Ch-4 Forest Society and colonialism 2.pdfCh-4 Forest Society and colonialism 2.pdf
Ch-4 Forest Society and colonialism 2.pdf
 
Skimbleshanks-The-Railway-Cat by T S Eliot
Skimbleshanks-The-Railway-Cat by T S EliotSkimbleshanks-The-Railway-Cat by T S Eliot
Skimbleshanks-The-Railway-Cat by T S Eliot
 
Temple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation resultsTemple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation results
 

[Dr. TLA+ Series] Raft - Jin Li