PostgreSQL Enterprise (50 Qs)•Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)
High-Availability (HA) Architecture with Patroni and etcd.
senior LevelSystem Design
In Simple Words: Enterprise PostgreSQL HA uses Patroni:
- etcd / Consul: Distributed consensus store maintaining cluster state and leader lock.
- Patroni Daemon: Runs alongside each Postgres node, monitoring health and orchestrating automated failover.
- If Primary crashes, Patroni automatically selects the replica with the highest LSN (least data loss), promotes it to Primary within 10 seconds, and reconfigures remaining nodes to follow the new leader.