How to do it...

For this procedure, we will need three servers. The archive server should be named pg-arc, our primary PostgreSQL server is pg-primary, and the new standby will be pg-clone. As usual, the PostgreSQL data directory will be located at /db/pgdata. For simplicity, the system user on all machines will be postgres. Be sure to have the password for this user!

  1. As a root-capable user on pg-primary and pg-clone, run these commands to install walctl:
        git clone https://github.com/peak6/walctl
        cd walctl
        sudo make install
  1. As a root-capable user on pg-arc, create the WAL storage directory:
        sudo mkdir -m 0600 /db/wal_archive
        sudo chown postgres:postgres /db/wal_archive
  1. On pg-primary, create and export an SSH key to the pg-arc and ...

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.