Manual Recovery
Manually execute PITR in a sandbox using pgbackrest primitives.
You can run PITR through pgsql-pitr.yml, but in advanced scenarios you may want to execute recovery manually with pgBackRest primitives for tighter control.
This guide summarizes the manual workflow. For an end-to-end sandbox demo with detailed command output, see Recovery Example.
Prerequisites
- A cluster with pgBackRest backup and WAL archiving enabled
- A clear recovery target (
time,lsn,xid, restore point, or latest) - Shell access as admin and
postgresuser
Use a sandbox for rehearsal before production execution.
Check Backup
Switch to postgres and verify available backup sets:
sudo su - postgres
pb info
pb is the Pigsty alias for pgbackrest with automatic stanza detection.
Run PITR
Choose a recovery target and generate recovery operations:
pg-pitr -t "2025-07-13 03:03:00+00"
Typical sequence:
- Stop Patroni and PostgreSQL.
- Run
pgbackrest restorewith the selected target. - Start PostgreSQL and replay WAL.
- Verify data state, then promote if correct.
- Re-enable archive mode and restart services.
- Rebuild replicas if needed and resume cluster automation.
Post-Recovery Checklist
- Verify business data at the target point.
- Confirm cluster role and service endpoints.
- Reinitialize replicas if timeline diverges.
- Take a fresh full backup after recovery.
Related
- Script reference: Instance Recovery (
pg-fork+pg-pitr) - PITR concepts: PITR Overview
- Automated workflow: Pig
pitrCommand
Feedback
Was this page helpful?
Thanks for the feedback! Please let us know how we can improve.
Sorry to hear that. Please let us know how we can improve.