SlideShare a Scribd company logo
1 of 43
Download to read offline
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

可靠分布式系统基础 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 EthereumTerek 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 ZooKeeperSaurav 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

Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docxPoojaSen20
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterMateoGardella
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfSanaAli374401
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Shubhangi Sonawane
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 

Recently uploaded (20)

Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 

[Dr. TLA+ Series] Raft - Jin Li