Database Backup and Recovery
Describe database backup strategies and how you would design a recovery plan for production databases.
Key backup types: 1) Full backups - complete database copy, resource-intensive. 2) Incremental - only changes since last backup. 3) Point-in-time recovery (PITR) - using transaction logs/WAL. Strategy: daily full backups + continuous WAL archiving for PITR. Store backups in separate region/account. Test restores regularly! Recovery plan: define RTO (Recovery Time Objective) and RPO (Recovery Point Objective), document restore procedures, automate where possible, and practice with chaos engineering.
Backups are worthless if you can't restore from them. Every organization has horror stories of corrupted backups or untested restore procedures. RTO defines how quickly you must recover, RPO defines maximum acceptable data loss. These requirements drive your backup strategy - if RPO is 5 minutes, you need continuous replication, not daily backups.
PostgreSQL backup strategies
Kubernetes CronJob for backups
- Never testing restore procedures until an actual disaster
- Storing backups in the same region/account as production
- Not encrypting backups containing sensitive data
- Ignoring backup retention policies and running out of storage
- How do you test that backups are actually restorable?
- What is the difference between RTO and RPO?
- How do you handle backups for databases with terabytes of data?