What is Raft?
-
Raft is a consensus algorithm that is designed to be easy to understand.
It's equivalent to Paxos in fault-tolerance and performance
How it works
Leader election and log replication
-
Leader is elected. others become followers
Once a leader is chosen, it accepts and logs client commands.
Followers replicate log entries, guaranteeing consistency.
Example
-
Consider five servers (A, B, C, D, E):
All start as followers. C’s timeout elapses, it requests votes.
C is elected leader by a majority.
Client sends command to C (leader). C appends command to its log and sends it to A, B, D, E.
Upon successful replication, command is committed.