Toggle navigation
Ivan's Wiki
Wiki Home
(current)
Submit
Index
Raft
And other friends
Consensus Algorithm that is easier to understand than Paxos
Leader Election:
Every node can become a leader
Every node has an election timeout (randomised value within a set interval)
Once the election timeout occurs, the node becomes a candidate
Candidates send vote requests to all known nodes
Once the candidate receives the majority of votes, it becomes the Leader
The Leader sends heartbeat ("Append Log") messages to followers
If the replica has not received a heartbeat from the leader in its election timeout, it becomes a candidate, etc...
Change Propagation:
Client sends a change to the leader
The change is appended to the leaders log
The change is sent to the followers in the next heartbeat
An entry is "committed" once the majority of followers acknowledge it
Once the entry is committed, the response is sent to the client
Resilience:
In case of network partitions, raft separates into sub-clusters with their own leaders
A sub-cluster with the smaller number of nodes will be unable to commit transactions
When the network partition is healed:
The leader with the lower follower count (
smaller
) will step down
The
smaller
and all its followers will rollback their logs to match the
bigger
one
This guarantees preservation of log consistency in the face of network failures
Sources:
Good guys cite sources
Raft homepage:
https://raft.github.io/
Rust bay Area Meetup talks on Raft:
https://onlinexperiences.com/scripts/Server.nxp
Raft paper:
https://raft.github.io/raft.pdf