How the cluster lifecycle works: Bootstrap to Cluster mode
masterThe cluster moves through three distinct phases:
1. Bootstrap (initialization)
- Starts with one designated primary (
RaftConfig.BootstrapPrimary = true). - The primary is forced into the Leader role immediately without an election.
- Other nodes pull a full checkpoint via
SyncInitialStateAsyncand then follow the WAL stream. - No elections are allowed during this phase to prevent split-brain before data is replicated.
2. Promotion to Cluster mode
- The leader monitors followers using
ReportLastSyncSequenceNumber. - When a sufficient number of followers (defined by
BootstrapPromotionQuorum) are within theBootstrapInSyncLagThresholdof the leader'slatestSeq, the leader promotes itself toClustermode. - This mode change is broadcast via heartbeats (
HeartbeatPayload.LeaderMode). - Once a node enters
Clustermode, it cannot return toBootstrapmode.
3. Steady-state Cluster mode
- Full Raft protocol is enforced.
- Leader: Sends heartbeats every
HeartbeatIntervalMs(default 250-300ms). - Follower: Resets its election timer on every heartbeat. If the randomized timer (default
[1500, 3000]ms) expires, the follower becomes a Candidate.