Quick reference
Four blocks, twenty commands, one timed restore.
Backup
restic snapshots --latest 3
restic check --read-data-subset=5%
pg_basebackup -D /bk -Ft -z -P
velero backup get
aws s3 ls s3://backups/prod/ --recursiveRestore
restic restore latest --target /srv
pg_restore -d app --clean --if-exists
pg_verifybackup /bk/base
velero restore create --from-backup daily
mysql app_restore < app.sqlFailover
pg_ctl promote -D /data/pg
kubectl delete pod -l app=api
kubectl drain node-1 --ignore-daemonsets
systemctl restart postgresql@16-main
tc qdisc add dev eth0 root netem loss 20%Verify
curl -sS -o /dev/null -w '%{http_code}' $URL
psql -c 'select pg_is_in_recovery()'
kubectl get pods -n prod -o wide
pg_amcheck -d app --heapallindexed
kubectl top pods -n prodIn one line: A plan is proven by a command, not a slide. Run one of these against a copy before you trust the plan.
Time a restore:
time restic restore latest --target /srvExplained
Start with backup. List the snapshots, verify a subset of the data, check the base backup and confirm the offsite copy exists. A backup you cannot list is a backup you cannot restore.
Then restore. Bring the latest snapshot back into a clean target, restore the database dump, verify the base backup and create a restore from the backup object. Restoring to the same production host is not a test.
Then failover and faults. Promote the standby, delete a pod to watch the scheduler reschedule, drain a node, restart the database unit and inject packet loss. These are the drills that show whether the runbook matches the cluster.
Then verify. Check the health endpoint and the status code, confirm the database is still in recovery, watch the pods and their resource use, and run an index check on the restored data. A restore that nobody queried is a file copy.
The honest caveat: every one of these commands is safe only in the right environment. A promoted primary or a drained node in production is an incident, not a drill. Read the runbook, use a copy, and keep an abort switch.
Your turn: Which command would prove the most about your plan tomorrow?
Related on this site
More notes: Backup & recovery
- P1080Five questions after a failed failover
- P1079Crisis communication for engineers
- P1078Running a tabletop without it becoming theatre
- P1077Four recovery numbers worth writing down
- P1076Graceful degradation by design
- P1075A failover drill from T+0 to the all-clear
- P1074Five signs your DR plan is fiction
- P1073Proving a backup restores
Open in the notes app: search, filters, copy This note on GitHub