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¶
pgBackRest is not just a backup tool in HybridOps: it is the reviewable component that proves your PostgreSQL cluster has a recoverable state. Correct stanza configuration and a clean baseline backup are prerequisites for executing a DR failover drill. This HOWTO covers the setup path.
1. pgBackRest Architecture in HybridOps¶
- 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.