All academies

Replication Simulator

A 3-member replica set. Send writes and watch them replicate to secondaries. Then kill the primary and watch the election: the secondary with the freshest oplog wins.

Client
mongo-0primaryoplog: 0 ops
mongo-1secondaryoplog: 0 ops
mongo-2secondaryoplog: 0 ops
Event log

› Replica set rs0 initialized: mongo-0 (PRIMARY), mongo-1, mongo-2 (SECONDARY)

What you're seeing

All writes go to the primary, which records them in its oplog. Secondaries tail that oplog asynchronously — the lag slider controls how far behind they run. When the primary dies, the remaining members detect missing heartbeats and hold an election; a majority must agree, and the member with the freshest oplog wins. This is why production replica sets have an odd number of voting members.