PostgreSQL replication and failover

Streaming replication, synchronous commit, read replicas and the external tools that automate failover, for teams designing PostgreSQL clusters that keep running when a server fails.

PostgreSQL failover with repmgr

Using repmgr to clone standbys, monitor replication and automate failover with repmgrd: witness servers, fencing scripts, switchover procedures and supported PostgreSQL versions.

Setting up PostgreSQL streaming replication

Creating hot standby replicas with streaming replication: replication roles and pg_hba.conf entries, pg_basebackup, replication slots, standby.signal, and checking replication health.

PostgreSQL synchronous replication and quorum commit

Choosing between asynchronous, priority-based and quorum synchronous replication: synchronous_standby_names syntax, synchronous_commit levels, write latency, and what happens when a synchronous standby fails.

Load balancing reads across PostgreSQL replicas

Sending read traffic to standbys: libpq target_session_attrs and load_balance_hosts, HAProxy health checks through Patroni, replica lag and read-your-writes concerns, and query conflicts on hot standby.

Replication slots and runaway WAL retention

Stopping abandoned or lagging replication slots from filling the disk: max_slot_wal_keep_size, monitoring slot lag, logical slots used by CDC tools, and safely dropping slots.

Delayed standby replicas to recover from human error

Keeping a standby hours behind with recovery_min_apply_delay so a dropped table or bad update can be recovered: choosing the delay, WAL retention on the primary, and how it compares with point-in-time recovery.

Preventing split-brain in PostgreSQL clusters

How clusters end up with two primaries and how to stop it: DCS leader locks, Patroni watchdog devices, fencing in repmgr, network partitions and the tests that prove protection works.

PostgreSQL failover testing and switchover runbooks

Proving a PostgreSQL cluster fails over as designed: planned switchovers, killing processes, network and disk faults, measuring client reconnection time, and writing runbooks operators can follow under pressure.

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.