Part 192: High Availability Topologies: Galera, Patroni & Failover
Achieving 99.999% uptime with automated failover and zero split-brain scenarios.
1. The Split-Brain Dilemma
If the network link between two database nodes fails: - Node 2 might assume Node 1 died and promote itself to Primary. - Clients write to both nodes independently, causing irrecoverable data divergence! - Solution: Always maintain an odd number of nodes (3, 5, 7) using Raft or Paxos consensus.
2. PostgreSQL High Availability with Patroni & etcd
Patroni orchestrates PostgreSQL nodes using etcd distributed consensus:
- Leader Key: Stored in etcd with a TTL heartbeat.
- If the Primary node misses heartbeats, the cluster automatically elects the replica with the lowest replication lag as the new Primary within 10 seconds.
3. MySQL Galera Cluster (Synchronous Multi-Primary)
Galera replicates changes using certification-based replication: - Any node can accept writes. - Transactions are certified across all cluster nodes before commit.
Key Takeaways
- Always deploy HA clusters across 3 distinct Availability Zones with automated health-check routing.
In Part 193, we explore Zero-Downtime Schema Migrations: The Expand & Contract Pattern!

