# pgBackRest — Reliable PostgreSQL Backup and Restore > A robust open-source backup and restore solution for PostgreSQL with parallel compression, encryption, full/incremental/differential backups, and cloud storage support. ## Install Save in your project root: # pgBackRest — Reliable PostgreSQL Backup and Restore ## Quick Use ```bash # Install on Debian/Ubuntu sudo apt install pgbackrest # Create a full backup pgbackrest --stanza=main --type=full backup # Restore from the latest backup pgbackrest --stanza=main restore ``` ## Introduction pgBackRest is a backup and restore tool designed specifically for PostgreSQL. It handles the complexity of WAL archiving, parallel backup compression, and multi-repository storage so database administrators can implement reliable disaster recovery without writing custom scripts. ## What pgBackRest Does - Creates full, incremental, and differential backups of PostgreSQL clusters - Archives WAL segments for point-in-time recovery (PITR) - Compresses backups in parallel using multiple CPU cores - Encrypts backups at rest with AES-256-CBC - Stores backups on local disk, S3, Azure Blob, or Google Cloud Storage ## Architecture Overview pgBackRest runs as a standalone process alongside PostgreSQL. It communicates with the database via the PostgreSQL protocol for backup coordination and uses file-level copy for data transfer. WAL archiving integrates through the `archive_command` configuration. The tool maintains a manifest of all backed-up files to enable efficient incremental backups that only transfer changed pages. ## Self-Hosting & Configuration - Install via package manager (`apt`, `yum`) or compile from source - Create a stanza configuration in `/etc/pgbackrest/pgbackrest.conf` - Set `archive_command` in `postgresql.conf` to route WAL to pgBackRest - Configure retention policies for full and differential backup counts - Add S3 or GCS credentials for off-site backup storage ## Key Features - Delta restore that only replaces files that differ from the backup - Backup verification with checksum validation against the PostgreSQL catalog - Asynchronous WAL push and pull for high-throughput archiving - Multiple backup repositories for redundancy across storage providers - Standby server backup support to offload backup I/O from the primary ## Comparison with Similar Tools - **pg_dump** — logical backup only, no incremental or PITR support - **Barman** — similar feature set but Python-based with different architecture - **WAL-G** — Go-based tool focused on cloud storage, less mature retention management - **pg_basebackup** — built-in but lacks compression, encryption, and incremental support - **Borg + pg_dump** — generic backup with PostgreSQL wrapper, not database-aware ## FAQ **Q: Does pgBackRest support PostgreSQL streaming replication?** A: Yes. It can back up from a standby replica to avoid impacting primary performance. **Q: How fast is incremental backup?** A: Incremental backups only transfer changed blocks, making them significantly faster than full backups for large databases. **Q: Can I restore to a specific point in time?** A: Yes. Specify a target timestamp, transaction ID, or LSN for point-in-time recovery using archived WAL segments. **Q: What PostgreSQL versions are supported?** A: pgBackRest supports PostgreSQL 9.0 through the latest release, with full feature support from version 9.4 onward. ## Sources - https://github.com/pgbackrest/pgbackrest - https://pgbackrest.org --- Source: https://tokrepo.com/en/workflows/asset-f712e179 Author: AI Open Source