dataiotech Labs
dbaguidedbaguideDBAdataxtoolsdataopsphere
Home/Glossary/Replication Election & Split-Brain
Replication Election & Split-BrainReplication & Durability

Replica Set Election & Quorum Split-Brain Protection

Raft-inspired consensus election mechanism where replica set members elect a new primary node while enforcing strict quorum rules to prevent dual-primary split-brain.

Internal Architecture Breakdown

MongoDB replica sets elect primary nodes via modified Raft consensus. When heartbeats miss the electionTimeoutMillis threshold (default 10s), secondaries trigger elections.

A candidate requires majority quorum (N/2 + 1) and the highest optime to win. During network partitions, an isolated primary unable to see a majority automatically steps down to secondary, eliminating concurrent divergent writes.

Production Inspection Queries

MongoDB
rs.status().members.map(m => ({ name: m.name, stateStr: m.stateStr, uptime: m.uptime, electionTime: m.electionTime }));