PostgreSQL PgBackRest Tool Installation & Configuration

pgBackRest is an open source backup tool that creates physical backups with some improvements compared to the classic pg_basebackup tool.

We can use pgBackRest to perform an initial database copy for Streaming Replication by using an existing backup, or we can use the delta option to rebuild an old standby server.

pgBackRest features :

  •     Parallel Backup & Restore
  •     Full, Incremental and Differential Backups
  •     Backup Rotation and Archive Expiration
  •     Backup Integrity check
  •     Backup Resume
  •     Delta Restore
  •     Encryption

Installation:

 
yum install pgbackrest

Configuration:


 vi /etc/pgbackrest.conf
  [global]
  repo1-path=/var/lib/pgbackrest
  [pearl]
  pg1-path=/var/lib/pgsql/11/data
 
 vi postgresql.conf
  archive_mode = on
  archive_command = 'pgbackrest --stanza=testing archive-push %p'
  max_wal_senders = 6
  wal_level = logical
  
Define the backup configuration:

 pgbackrest --stanza=pearl --log-level-console=info stanza-create

 
Validate the configuration:

 pgbackrest --stanza=pearl --log-level-console=info check

Backup Command:

 pgbackrest --stanza=pearl --type=full --log-level-stderr=info backup

Restore Command:

 pgbackrest --stanza=pearl --log-level-stderr=info restore

Point In Time Recovery:

pgbackrest --stanza=pearl --delta --type=time "--target=2020-08-20 14:15:00.000000+01" restore

Differential backup:
 pgbackrest --stanza=pearl --type=diff --log-level-stderr=info backup

Incremental backup:

 pgbackrest --stanza=pearl --type=incr --log-level-stderr=info backup

 
Backup Information:

 pgbackrest info


Comments