How to do it...

For this procedure, we will continue to use two servers. The backup server will still be named pg-backup, and our primary PostgreSQL server is pg-primary. As usual, the PostgreSQL data directory will be located at /db/pgdata.

Follow these steps to send WAL files from pg-primary to pg-backup:

  1. On the pg-backup server, create a directory writable by the postgres user with the following commands as a root-capable user:
        sudo mkdir /db/pg_archived
        sudo chown postgres:postgres /db/pg_archived
  1. Create a file named omnipitr.conf in the /etc directory on pg-primary with the following contents:
        --data-dir /db/pgdata 
        --dst-remote postgres@pg-backup:/db/pg_archived 
        --log /var/log/postgresql/omnipitr.log 
  1. Modify the postgresql.conf ...

Get PostgreSQL High Availability Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.