⚠ Switch to EXCALIDRAW VIEW in the MORE OPTIONS menu of this document. ⚠ You can decompress Drawing data with the command palette: ‘Decompress current Excalidraw file’. For more info check in plugin settings under ‘Saving’
Excalidraw Data
Text Elements
MongoDB replica set
1 · normal operation
2 · primary crashes
3 · network partition
client
writes
mongo1 PRIMARY
mongo2 SECONDARY
mongo3 SECONDARY
oplog
oplog
writes only on the primary, secondaries copy asynchronously
client
writes
mongo1 PRIMARY
mongo2 PRIMARY
mongo3 SECONDARY
oplog
remaining 2 of 3 = majority → election (~10 s), new primary
client
writes
mongo1 PRIMARY
mongo2 SECONDARY
mongo3 SECONDARY
oplog
✂
mongo3 is cut off: still readable, but its data gets stale
Majority rule: writes with w:“majority” and elections need ⌊n/2⌋+1 nodes → consistency first (CP)