PostgreSQL high availability

Rehearse promotion and client reconnection for an already provisioned PostgreSQL physical standby. Streaming replication itself is not a failover manager.

Last updated

On this page (5)

PostgreSQL ยท High availability

Before you start

  • Operator-owned switchover and rejoin runbook, a healthy standby and a controlled maintenance or staging window.
  • An agreed write endpoint, fencing mechanism and recovery objectives.

Procedure

  1. Quiesce writes for a planned drill, commit a test marker and confirm it replayed. Record lag and isolate the old primary from writes before promotion.
  2. Promote the standby with the approved procedure, such as pg_ctl promote or pg_promote(), then move the application write endpoint and reconnect clients.
  3. Rebuild or rewind the former primary under the approved procedure and rejoin it as a standby; never bring it back independently as a writable primary.

Verify the result

  • The application endpoint reaches exactly one writable primary; the marker and a new test transaction are visible there.
  • Record time until the application can write again, any lost commits, and whether standby replication is restored. Do not equate this controlled drill with unplanned asynchronous data-loss bounds.

Official documentation

Have Pilae operate PostgreSQL

We agree what to monitor, how to recover and who responds when something breaks. Bring your existing deployment or start with a new one.