HOWTO: Set Up pgBackRest Backup for PostgreSQL¶
Purpose: Configure pgBackRest on a HybridOps PostgreSQL cluster, execute a baseline backup, and validate the backup configuration as part of the DR run record.
Difficulty: Intermediate
Track: Disaster Recovery Automation
Overview¶
In the PostgreSQL HA reference scenario, pgBackRest provides the recovery repository and backup-verification surface. HybridOps gates the DR path on the declared backup state and records the result with the wider operation. This HOWTO establishes the stanza, repository, retention policy, WAL archive, and clean baseline backup required for a failover drill.
1. pgBackRest Architecture in the PostgreSQL HA Scenario¶
- Primary, replica, and repository node roles.
- Repository types: POSIX and S3-compatible object storage.
- Integration with Patroni-managed clusters.
2. Stanza Initialisation¶
- Stanza naming conventions.
pgbackrest --stanza=<name> stanza-create.- Verifying stanza metadata.
3. WAL Archiving Configuration¶
archive_modeandarchive_commandinpostgresql.conf.- Confirming the first WAL segment is archived.
- Monitoring archive lag.
4. Retention Policy¶
repo-retention-fullandrepo-retention-diffconfiguration.- Retention policy aligned with RTO/RPO requirements.
- Log of expired backups.
5. Baseline Full Backup¶
pgbackrest --stanza=<name> backup --type=full.- Monitoring backup progress.
pgbackrest infooutput as structured run records.
6. Run-record capture¶
- Storing pgBackRest info output under
<runtime-root>/logs/dr/pgbackrest/. - Linking to the module run record.
- Backup run-record review in the DR drill checklist.
References¶
- ADR-0501 – PostgreSQL on Dedicated VM with DR Replication
- HOWTO: Provision PostgreSQL HA
- HOWTO: Execute a PostgreSQL Failover
License: MIT-0 for code, CC-BY-4.0 for documentation unless otherwise stated.