Install pgbackrest and configure
Install pgbackrest and configure
Install pgbackrest
yum install pgbackrest
2. Next, verify pgBackRest was installed correctly by running the following command
either as the default user, or as the postgres user:
pgbackrest
listen_addresses = '*'
archive_mode = on
archive_command = 'pgbackrest --stanza=main archive-push %p'
[global]
repo1-path=/pg-db-backup/bkp
repo1-retention-full=2
repo1-retention-diff=2
log-level-console=info
#log-level-file=debug
start-fast=y
process-max=2
archive-timeout=300
[main]
pg1-path=/data/pgdata/data
[global]
repo1-path=/pg-db-backup/bkp
repo1-host=192.168.251.143
repo1-host-user=postgres
[main]
pg1-path=/data/pgdata/data
4. configure passworless ssh for postgres user between spare server and primary
5. stop the postgres database and delete postgres datafiles it the exist
expire backups
====================
sudo -u postgres pgbackrest --stanza=main --repo1-retention-full=1 expire