Create the pgBackRest stanza and verify archiving (stanza-create/check)
PostgreSQLBackup & PITRCommand
# Create the stanza in the repository (once):
sudo -u postgres pgbackrest --stanza=<stanza> --log-level-console=info stanza-create
# Verify configuration and archiving end to end (switches WAL and waits for the segment to reach the repo):
sudo -u postgres pgbackrest --stanza=<stanza> --log-level-console=info checkWhat it does
stanza-create creates the cluster's metadata (system identifier, version) in the repository; check tests the PostgreSQL connection, archive_command and WAL arrival in the repository with an actual WAL switch.
When to use it
At initial setup, after changing archive_command or the repository, and as a monitoring/cron health check.
Caution
Run the commands as postgres (or the repository owner); running them as root breaks file ownership. After a major version upgrade, stanza-upgrade is required, not stanza-create. If check fails, PITR may be impossible even if backups complete.
Related
- Configure WAL archiving for pgBackRest (archive-push/archive-get)
- Take full, differential and incremental backups with pgBackRest
- Show the pgBackRest backup catalog and WAL archive range (info)
- Restore the latest backup with pgBackRest
- Restore to a point in time with pgBackRest (PITR, --type=time)
- Quickly rebuild a standby with pgBackRest delta restore