Local Backup

Local backup is created on the same server that is hosting the Scrutinizer database.

  1. Add the following line to the /var/db/big/pgsql/data/pg_hba.conf file to allow local replication connections:
# Allow replication connections from localhost, by a user with the
# replication privilege.
local   replication     postgres                                peer
  1. Run the command below to reload the database configuration:
psql -c "SELECT pg_reload_conf()"
  1. Use the pg_basebackup utility to back up the PostgreSQL database:
sudo su postgres -c "cd ~; pg_basebackup -D backup -Ft -z -P"

Hint

When taking a database backup, “waiting for checkpoint” is to be expected. However, you can force a checkpoint by running the following command:

psql -c "CHECKPOINT"
  1. Your backup should consist of three tarballs in the /var/lib/pgsql/backup directory. All three are critical in restoration.
ls -l /var/lib/pgsql/backup
-rw-r--r-- 1 postgres postgres     2025 Sep 24 18:20 16385.tar.gz
-rw-r--r-- 1 postgres postgres 40170653 Sep 24 18:20 base.tar.gz
-rw------- 1 postgres postgres  1453827 Sep 24 18:20 pg_wal.tar.gz