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
- OSUbuntu 26.04 LTS (resolute)
- PostgreSQL18.6-0ubuntu0.26.04.1
- Hostsdb-a01 / db-b01 / db-c01, 2 core / 4 GB each
- TimeAbout 20 min
- Reviewed27 August 2026
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.
| Server Name | IP Address | OS | Roles | CPU | RAM | HDD |
|---|---|---|---|---|---|---|
| db-a01 | 192.168.0.81 | Ubuntu 26.04 LTS | Primary / Source / Replica Set Member 1 | 2 Core | 4 GB | 50 GB |
| db-b01 | 192.168.0.82 | Ubuntu 26.04 LTS | Standby / Replica / Replica Set Member 2 | 2 Core | 4 GB | 50 GB |
| db-c01 | 192.168.0.83 | Ubuntu 26.04 LTS | Replica Set Member 3 / Cascading and Delayed Replica | 2 Core | 4 GB | 50 GB |
Before you start
- A working primary and the
replicatorrole from the replication prerequisites guide. - Three hosts, and enough disk on the middle one for a full base backup.
-
Look at what you actually have
-
Rebuild the diverged host as a standby
-
Point the third host at the second
-
The middle host has never had to accept a connection before
-
Prove the chain
-
Each hop only knows its neighbour
-
Measure the chain honestly