Choose Cloud Spanner Backup strategy
Goal
To propose and then implement a backup strategy for spanner for use as topology service storage
Action items:
-
Get security sign off on overall strategy -
Perform a restore from backup -
Calculate storage growth -
Configure backup strategy in code -
Create ADR for final decision -
Add links in topology-service-deployer once ADR is complete to terraform code to document the decisions -
Validate performance implications of backup strategy
Current proposal
- Configure production as multi region as per ADR
- Enable point in time recovery for 36 hours
-
Enable daily full backups for a monthEnable incremental backups for 3 months to reduce storage costs. Incremental backups create full backups after every 13 incremental backups in the chain.
Summary Comparison of backup types
Feature | Full Backups | Incremental Backups | PITR | Export |
---|---|---|---|---|
Storage Efficiency | Low | High | Low | Medium |
Recovery Speed | Fast | Medium | Fast | Slow |
Setup Complexity | Low | Low | Low | High |
Data Consistency |
|
|
|
|
Retention Period | Up to 1 year | Up to 1 year | Up to 7 days | Unlimited |
Cross-region Support |
|
|
|
|
Google Cloud Spanner Backup Types Comparison
Full Backups
Pros | Cons |
---|---|
Simple to understand and implement | Large storage requirements |
Complete data snapshot at point in time | Longer backup times for large databases |
Fast restoration process | Can only be scheduled for once every 12 hours |
Can be created on-demand or scheduled | Limited to 1-year retention maximum |
Highly available and encrypted |
Documentation: Create backups | Backups overview
backups can be copied to another region and databases can not be deleted while a backup exists
Incremental Backups
Pros | Cons |
---|---|
Storage efficient (only changed data) | Longer recovery times if many incrementals |
Faster than full backups | Only available via backup schedules |
Lower resource usage during backup | |
Reduces storage costs | |
Can backup every 4+ hours |
Documentation: Backups overview | Backup schedules
PITR (Point-in-Time Recovery)
Pros | Cons |
---|---|
Precise recovery to any point in time | Limited to 7-day retention maximum |
Minimal data loss (microsecond granularity) | Higher storage costs for extended retention |
Continuous data protection | Performance impact with high retention periods |
No separate backup jobs required | To restore a full database a full backup must be performed first |
Surgical recovery of specific data using stale reads |
Documentation: PITR overview | Recover data using PITR
Export (CSV/Avro)
https://cloud.google.com/spanner/docs/import-export-overview#compare-import-export-backup-restore
Key References:
Edited by David Leach