Important

It is recommended to transfer backup files to an FTP server so they will not be lost in the event of a failure.

Remote Backup

This method assumes a second “destination” host for the backup that has at least enough disk space to contain the backup and that the same version of Scrutinizer and Postgres have already been installed.

  1. On the source host, run this command to create a ROLE for remote replication:
psql -c  "CREATE ROLE remote_rep WITH REPLICATION LOGIN ENCRYPTED PASSWORD 'think_about_it'"
  1. To allow remote connections for the ROLE on the source host, add this line to the pg_hba.conf. Replace the $DESTINATION_IP with the IP of the destination server and reload the configuration.
sudo tee -a /var/db/big/pgsql/data/pg_hba.conf << EOF
host replication remote_rep $DESTINATION_IP/32 md5
EOF
psql -c "SELECT pg_reload_conf()"
  1. On the destination host, populate the $SOURCE_IP with the source server. Use the pg_basebackup utility to back up the PostgreSQL database. You will be prompted for the password used in Step 1.
sudo su postgres -c "cd ~; pg_basebackup -h $SOURCE_IP -U remote_rep -D backup -Ft -z -P"
  1. Your backup should consist of three tarballs in the /var/lib/pgsql/backup directory. All three are critical in restoration.
sudo ls -l /var/lib/pgsql/backup
-rw-r--r--. 1 postgres postgres        501 Sep 24 13:23 16385.tar.gz
-rw-r--r--. 1 postgres postgres 4146859412 Sep 24 13:32 base.tar.gz
-rw-------. 1 postgres postgres   12316287 Sep 24 13:32 pg_wal.tar.gz