CertGrid CertGrid
Configuration·PostgreSQL

PostgreSQL Replication Prerequisites

Four things before a standby exists: the right `wal_level` (already the default), a role with REPLICATION, a pg_hba rule for the special `replication` database, and a slot so the primary keeps the WAL the standby will need.

Replication Guide 26 of 47 Intermediate

Written against the versions above. `wal_level = replica` and `max_wal_senders = 10` are defaults, so a stock PostgreSQL is already able to feed a standby - unlike older versions where this section was mostly about turning things on.

Every command on this page ran on db-a01.
Server NameIP AddressOSRolesCPURAMHDD
db-a01192.168.0.81Ubuntu 26.04 LTSPrimary / Source / Replica Set Member 12 Core4 GB50 GB

Before you start

  1. Check what is already true

  2. Create a role that can replicate and nothing else

  3. Add a pg_hba rule for the replication pseudo-database

  4. Create a slot so the primary keeps what the standby needs

Official sources