CertGrid CertGrid
Hands-on Lab·PostgreSQL

PostgreSQL Cascading Replication

A standby that feeds another standby. Rebuilding the diverged host was the easy part - the chain then refused to form, because a middle host has never had to accept a replication connection before.

Replication Guide 31 of 47 Advanced

Written against the versions above. Cascading has needed no special setting since PostgreSQL 9.2. A standby is an upstream automatically as long as `hot_standby` is on, which is the default.

The 3 hosts these commands ran on: db-a01, db-b01, db-c01.
Server NameIP AddressOSRolesCPURAMHDD
db-a01192.168.0.81Ubuntu 26.04 LTSPrimary / Source / Replica Set Member 12 Core4 GB50 GB
db-b01192.168.0.82Ubuntu 26.04 LTSStandby / Replica / Replica Set Member 22 Core4 GB50 GB
db-c01192.168.0.83Ubuntu 26.04 LTSReplica Set Member 3 / Cascading and Delayed Replica2 Core4 GB50 GB

Before you start

  1. Look at what you actually have

  2. Rebuild the diverged host as a standby

  3. Point the third host at the second

  4. The middle host has never had to accept a connection before

  5. Prove the chain

  6. Each hop only knows its neighbour

  7. Measure the chain honestly

Official sources