postgresql-high-availability-and-failover
PostgreSQL High Availability and Failover
Purpose
PostgreSQL has no built-in automatic failover — a standalone streaming
replica will happily keep serving stale reads forever if the primary
dies, with nothing promoting it unless something external decides to and
does so safely. This skill covers designing that "something external":
most commonly Patroni (a consensus-store-backed HA agent that
manages pg_ctl, recovery.conf/standby.signal, and a fencing
mechanism), the split-brain risks any automatic-failover design must
close off, and how to test failover realistically without it becoming an
actual incident. It builds on the replication mechanics covered in
postgresql-operations-and-performance-tuning;
this skill is specifically about the failover decision-making and
safety layer on top of that replication.