Raft Distributed Consensus

Topics

  • What is a State Machine?
  • What is a Log?
  • What is Consensus?
  • What is Raft?

State Machines

and Logs

States and Transitions

A

B

C

Starting State

States: {                                   }

Transitions: {  A, B, C   }

States and Transitions

A

B

C

A

Input,

Command,

Signal

Next State

B

C

C

?

State Machine

Log

States and Transitions

A

B

C

A

Input,

Command,

Signal

Next State

B

C

C

?

"Trap

State"

States and Transitions

Input,

Command,

Signal

Next State

Richer state machine:

x = 0

y = 0

z = 0

x <- 5

x = 5

y = 0

z = 0

z <- 10

x = 5

y = 0

z = 10

Consensus

Consensus

Q: How can you keep state machines on multiple machines in sync?

x = 0

y = 0

z = 0

x <- 1

y <- 2

z <- 3

y <- 5

Machine

Cluster

Consensus

A: Make sure the logs of each machine match

x = 0

y = 0

z = 0

x <- 1

y <- 2

z <- 3

y <- 5

Machine

Cluster

x <- 1

y <- 2

z <- 3

y <- 5

x <- 1

y <- 2

z <- 3

y <- 5

x <- 1

y <- 2

z <- 3

y <- 5

x <- 1

y <- 2

z <- 3

y <- 5

x <- 1

y <- 2

z <- 3

y <- 5

Raft Whitepaper

Raft Distributed Consensus

By Nick Mosher

Raft Distributed Consensus

  • 202