- following – when node see leader
- candidate – when node doesn’t see leader
Raft formila (n / 2) – 1
- A Raft cluster of 3 nodes can tolerate a single node failure while a cluster of 5 can tolerate 2 node failures.
- If any of the followers didn’t notice leader they try to become a leader
- Candidate should request votes from other participants to become a leader
- Leader update info when all nodes are in sync, after that leader acknowledge app which sent write request.
- if 2 nodes become a leader, election start again
- leader should send heartbeat interval, follower have heartbeat timeout, if timeout elapsed follower become candidate
- during network partitions 2 leader can be exist, after healing second leader rollback all commits. The second leader with less nodes in partition