Pcornel
Databases · Replication & High Availability

Failover and Split Brain

Cheat sheet · https://pcornel.dk/topic.php?topic=6188

Back to the Topic

Answer

Failover promotes a replica when the primary fails; split brain happens when two nodes both accept writes. Quorum, fencing and a single source of truth prevent it.

Remember

Use a consensus-based manager (Patroni with etcd, Always On with quorum, Orchestrator/MHA, Galera quorum). Fence the old primary. Point clients via VIP, DNS or proxy that follows the leader.

First checks

  • patronictl list — first check for this topic
  • psql -c "SELECT now(), version();" — PostgreSQL reachable and version
  • mysql -e "SELECT NOW(), VERSION();" — MariaDB/MySQL reachable and version
  • sqlcmd -S <server> -Q "SELECT @@VERSION" — SQL Server reachable and version

Verify in this order

primary fails → quorum agrees → replica promoted → old primary fenced → clients redirected

Where it usually breaks

Two nodes promoted after a network split cause diverging data.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=6188

Confirmation

Confirm action

Continue?