How to do it...

For this procedure, we will need two servers. The backup server will be named pg-backup, and our primary PostgreSQL server will be named pg-primary. Make sure to have the password for the barman system user and the postgres database user. As usual, our database is located at /db/pgdata.

Follow these steps:

  1. For Red Hat-based servers, use the following command:
  • Install the Barman toolkit as a root-capable user:
sudo yum install barman
  • Debian-based systems should use this command instead:
sudo apt-get install barman
  1. On the pg-backup server as the barman user, execute the following commands for direct SSH access to pg-primary as the postgres user:
ssh-keygen -t rsa -N '' ssh-copy-id postgres@pg-primary
  1. Execute this SQL ...

Get PostgreSQL 12 High Availability Cookbook 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.