CertGrid CertGrid
Hands-on Lab·PostgreSQL

PostgreSQL Streaming Standby Creation

One pg_basebackup -R builds the standby, writes its connection settings and drops a standby.signal file. Start it and it streams - and refuses writes, which is the opposite of what a fresh MySQL replica does.

Replication Guide 27 of 47 Advanced

standby.signal replaced recovery.conf in PostgreSQL 12. Documentation mentioning recovery.conf is describing a file that no longer exists.

db-a01 is the primary. db-b01 is wiped and rebuilt as its standby.
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

This guide includes

Use this when a streaming standby has to exist. This matters because one pg_basebackup -R copies the cluster, writes its connection settings and marks it as a standby - and the standby then refuses writes, which is the proof it worked.

Before you start

  1. Empty the standby and copy the primary onto it

  2. See what -R wrote

  3. Start it and confirm what it is

  4. Prove replication, then try to write

Official sources