Backup Strategies That Actually Save You
Everyone knows backups are important. Few actually test them. Here’s how to build backup systems that work when you need them. The 3-2-1 Rule The classic foundation: 3 copies of your data 2 different storage types 1 offsite copy Example implementation: P C C C r o o o i p p p m y y y a r 1 2 3 y : : : : L R C P o e l r c m o o a o u d l t d u e c s b t n r a i a e c o p p k n s l u h i p d o c a t a ( t S a ( ( 3 b s d , a a i s m f d e e f i e f s r f e e e r n r v t e e n r d t , a t r d a e i g f c i f e o e n n r t ) e e n r t ) d i s k ) What to Back Up Always Back Up Databases — This is your business Configuration — Harder to recreate than you think Secrets — Encrypted, but backed up User uploads — Can’t regenerate these Maybe Back Up Application code — If not in Git, back it up Logs — For compliance, ship to log aggregator instead Build artifacts — Rebuild from source is often better Don’t Back Up Ephemeral data — Caches, temp files, sessions Derived data — Can regenerate from source Large static assets — Use CDN/object storage with its own durability Database Backups PostgreSQL 1 2 3 4 5 6 7 8 # Logical backup (SQL dump) pg_dump -Fc mydb > backup.dump # Restore pg_restore -d mydb backup.dump # All databases pg_dumpall > all_databases.sql For larger databases, use physical backups: ...