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

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

This guide includes

Use this before creating a standby. This matters because four things have to be true first - and three of them already are, so the real work is a role, a rule and a slot.

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