Skip to content
High Availability & Distributed Consensus

Replica Set Raft Consensus & Failover Lab

Simulate a 3-node MongoDB replica set. Test heartbeat health checks every 2 seconds, partition the PRIMARY node to trigger Raft elections with majority quorum (2 of 3 votes), and compare writeConcern w: 1 vs w: "majority" replication guarantees.

Replica Set Raft Consensus & Heartbeat Election Lab

Simulate 3-node replica set heartbeats, failovers, oplog replication, and write concern guarantees.

Consensus Term
Term 1
Monotonically increasing
Voting Quorum
2 / 3 Majority
Strict floor(N/2) + 1
Heartbeat Interval
2000 ms
10s election timeout
Write Concern
node-1PRIMARY
Host:mongo-node-1:27017
Oplog Sequence:#1045
Voted Term:Term 1
Accepts all driver write and read traffic (ReadPreference: primary).
node-2SECONDARY
Host:mongo-node-2:27017
Oplog Sequence:#1045
Voted Term:Term 1
Tails primary local.oplog.rs in background thread.
node-3SECONDARY
Host:mongo-node-3:27017
Oplog Sequence:#1045
Voted Term:Term 1
Tails primary local.oplog.rs in background thread.
REPL_LOG:Replica set stable on Term 1. Primary node-1 actively serving writes.