Configuration·PostgreSQL
PostgreSQL WAL Archiving and Recovery Readiness
A base backup restores last night. WAL archiving is what covers everything since - and pg_stat_archiver is the one view that tells you whether it is actually working before you need it to be.
Backup and Restore Guide 25 of 47 Advanced
- OSUbuntu 26.04 LTS
- PostgreSQL18.6-0ubuntu0.26.04.1
- wal_levelreplica
- TimeAbout 17 min
wal_level = replica is the default and is sufficient for archiving and streaming replication. logical is only needed for logical decoding.
| Server Name | IP Address | OS | Roles | CPU | RAM | HDD |
|---|---|---|---|---|---|---|
| db-a01 | 192.168.0.81 | Ubuntu 26.04 LTS | Primary / Source / Replica Set Member 1 | 2 Core | 4 GB | 50 GB |
This guide includes
Use this when a base backup only gets you to last night. This matters because WAL archiving is what fills the gap since - and whether the archiver is keeping up is something to monitor rather than assume.
- reading the five settings archiving depends on, where the defaults tell a clear story
- turning archiving on, with a directory owned by postgres and two settings
- generating WAL, and watching the segments arrive
- confirming the archiver is actually keeping up, through
pg_stat_archiver
Before you start
- A base backup - see the previous guide.
- Somewhere to archive WAL to. This guide uses a local directory, which is adequate for a lab and inadequate for anything real.
-
Read the settings archiving depends on
-
Turn archiving on
-
Generate WAL and watch it arrive
-
Confirm the archiver is actually keeping up