Backup & Disaster Recovery

WAL Archiving for PostgreSQL

Write-Ahead Log (WAL) archiving is the backbone of PostgreSQL data protection. Every transaction is captured in WAL segments and shipped to durable storage within seconds. We configure WAL archiving for continuous protection, point-in-time recovery, and streaming replication.

Need this done for your project?

We implement, you ship. Async, documented, done in days.

Start a Brief

Archive Mode Configuration

We enable archive_mode = on and configure archive_command to ship WAL segments to S3 via pgBackRest or WAL-G. Each 16MB WAL segment is compressed (lz4 or zstd), encrypted, and uploaded within seconds of being filled. For high-write workloads, we tune archive_timeout to force archival of partially-filled segments every 60 seconds, ensuring sub-minute RPO even during low-write periods.

pgBackRest Configuration

pgBackRest is our preferred WAL archiver for production PostgreSQL. We configure: S3 repository with encryption and parallel upload, asynchronous WAL archiving with a local spool directory for reliability, multiple repository support for offsite copies, and archive-push verification. pgBackRest validates WAL segment checksums on archival and detects gaps in the WAL stream. The configuration file is version-controlled and deployed via Ansible or Helm.

Streaming Replication Integration

WAL archiving complements streaming replication. Replicas stream WAL in real-time for sub-second lag, while archived WAL provides durable backup for PITR. We configure restore_command on replicas to fetch archived WAL when streaming falls behind. This handles network partitions gracefully — the replica catches up from the archive instead of requiring a full base backup. Replication slots prevent WAL recycling before archival completes.

Archive Verification and Monitoring

We monitor WAL archiving continuously: archive lag (time since last successful archive), WAL segment gap detection, archive storage growth rate, and archive-push error rate. pgBackRest's check command validates archive integrity on schedule. Prometheus exporters track archive metrics. Alerts fire if: archive lag exceeds 5 minutes, gaps are detected in the WAL sequence, or archive storage is unreachable. Broken WAL archiving means broken PITR — it gets treated as a production incident.

Why Anubiz Engineering

100% async — no calls, no meetings
Delivered in days, not weeks
Full documentation included
Production-grade from day one
Security-first approach
Post-delivery support included

Ready to get started?

Skip the research. Tell us what you need, and we'll scope it, implement it, and hand it back — fully documented and production-ready.