$npx -y skills add ancoleman/ai-design-components --skill planning-disaster-recoveryDesign and implement disaster recovery strategies with RTO/RPO planning, database backups, Kubernetes DR, cross-region replication, and chaos engineering testing. Use when implementing backup systems, configuring point-in-time recovery, setting up multi-region failover, or valida
| 1 | # Disaster Recovery |
| 2 | |
| 3 | ## Purpose |
| 4 | |
| 5 | Provide comprehensive guidance for designing disaster recovery (DR) strategies, implementing backup systems, and validating recovery procedures across databases, Kubernetes clusters, and cloud infrastructure. Enable teams to define RTO/RPO objectives, select appropriate backup tools, configure automated failover, and test DR capabilities through chaos engineering. |
| 6 | |
| 7 | ## When to Use This Skill |
| 8 | |
| 9 | Invoke this skill when: |
| 10 | - Defining recovery time objectives (RTO) and recovery point objectives (RPO) |
| 11 | - Implementing database backups with point-in-time recovery (PITR) |
| 12 | - Setting up Kubernetes cluster backup and restore workflows |
| 13 | - Configuring cross-region replication for high availability |
| 14 | - Testing disaster recovery procedures through chaos experiments |
| 15 | - Meeting compliance requirements (GDPR, SOC 2, HIPAA) |
| 16 | - Automating backup monitoring and alerting |
| 17 | - Designing multi-cloud disaster recovery architectures |
| 18 | |
| 19 | ## Core Concepts |
| 20 | |
| 21 | ### RTO and RPO Fundamentals |
| 22 | |
| 23 | **Recovery Time Objective (RTO):** Maximum acceptable downtime after a disaster before business impact becomes unacceptable. |
| 24 | |
| 25 | **Recovery Point Objective (RPO):** Maximum acceptable data loss measured in time. Defines how far back in time recovery must reach. |
| 26 | |
| 27 | **Criticality Tiers:** |
| 28 | - **Tier 0 (Mission-Critical):** RTO < 1 hour, RPO < 5 minutes |
| 29 | - **Tier 1 (Production):** RTO 1-4 hours, RPO 15-60 minutes |
| 30 | - **Tier 2 (Important):** RTO 4-24 hours, RPO 1-6 hours |
| 31 | - **Tier 3 (Standard):** RTO > 24 hours, RPO > 6 hours |
| 32 | |
| 33 | ### 3-2-1 Backup Rule |
| 34 | |
| 35 | Maintain **3 copies** of data on **2 different media** types with **1 copy offsite**. |
| 36 | |
| 37 | Example implementation: |
| 38 | - Primary: Production database |
| 39 | - Secondary: Local backup storage |
| 40 | - Tertiary: Cloud backup (S3/GCS/Azure) |
| 41 | |
| 42 | ### Backup Types |
| 43 | |
| 44 | **Full Backup:** Complete copy of all data. Slowest to create, fastest to restore. |
| 45 | |
| 46 | **Incremental Backup:** Only changes since last backup. Fastest to create, requires full + all incrementals to restore. |
| 47 | |
| 48 | **Differential Backup:** Changes since last full backup. Balance between storage and restore speed. |
| 49 | |
| 50 | **Continuous Backup:** Real-time or near-real-time backup via WAL/binlog archiving. Lowest RPO. |
| 51 | |
| 52 | ## Quick Decision Framework |
| 53 | |
| 54 | ### Step 1: Map RTO/RPO to Strategy |
| 55 | |
| 56 | ``` |
| 57 | RTO < 1 hour, RPO < 5 min |
| 58 | → Active-Active replication, continuous archiving, automated failover |
| 59 | → Tools: Aurora Global DB, GCS Multi-Region, pgBackRest PITR |
| 60 | → Cost: Highest |
| 61 | |
| 62 | RTO 1-4 hours, RPO 15-60 min |
| 63 | → Warm standby, incremental backups, automated failover |
| 64 | → Tools: pgBackRest, WAL-G, RDS Multi-AZ |
| 65 | → Cost: High |
| 66 | |
| 67 | RTO 4-24 hours, RPO 1-6 hours |
| 68 | → Daily full + incremental, cross-region backup |
| 69 | → Tools: pgBackRest, Velero, Restic |
| 70 | → Cost: Medium |
| 71 | |
| 72 | RTO > 24 hours, RPO > 6 hours |
| 73 | → Weekly full + daily incremental, single region |
| 74 | → Tools: pg_dump, mysqldump, S3 versioning |
| 75 | → Cost: Low |
| 76 | ``` |
| 77 | |
| 78 | ### Step 2: Select Backup Tools by Use Case |
| 79 | |
| 80 | | Use Case | Primary Tool | Alternative | Key Feature | |
| 81 | |----------|-------------|-------------|-------------| |
| 82 | | PostgreSQL production | pgBackRest | WAL-G | PITR, compression, multi-repo | |
| 83 | | MySQL production | Percona XtraBackup | WAL-G | Hot backups, incremental | |
| 84 | | MongoDB | Atlas Backup | mongodump | Continuous backup, PITR | |
| 85 | | Kubernetes cluster | Velero | ArgoCD + Git | PV snapshots, scheduling | |
| 86 | | File/object backup | Restic | Duplicity | Encryption, deduplication | |
| 87 | | Cross-region replication | Aurora Global DB | RDS Read Replica | Active-Active capable | |
| 88 | |
| 89 | ## Database Backup Patterns |
| 90 | |
| 91 | ### PostgreSQL with pgBackRest |
| 92 | |
| 93 | **Use Case:** Production PostgreSQL with < 5 minute RPO |
| 94 | |
| 95 | **Quick Start:** See `examples/postgresql/pgbackrest-config/` |
| 96 | |
| 97 | Configure continuous WAL archiving with full/differential/incremental backups to S3/GCS/Azure. Schedule weekly full, daily differential backups. Enable PITR with `pgbackrest --stanza=main --delta restore`. |
| 98 | |
| 99 | **Detailed Guide:** `references/database-backups.md#postgresql` |
| 100 | |
| 101 | ### MySQL with Percona XtraBackup |
| 102 | |
| 103 | **Use Case:** MySQL production requiring hot backups |
| 104 | |
| 105 | **Quick Start:** See `examples/mysql/xtrabackup/` |
| 106 | |
| 107 | Perform full (`xtrabackup --backup --parallel=4`) and incremental backups with binary log archiving for PITR. Restore requires decompress, prepare, apply incrementals, and copy-back steps. |
| 108 | |
| 109 | **Detailed Guide:** `references/database-backups.md#mysql` |
| 110 | |
| 111 | ### MongoDB Backup |
| 112 | |
| 113 | **Quick Start:** Use `mongodump --gzip --numParallelCollections=4` for logical backups or MongoDB Atlas for continuous backup with PITR. |
| 114 | |
| 115 | **Detailed Guide:** `references/database-backups.md#mongodb` |
| 116 | |
| 117 | ## Kubernetes Disaster Recovery |
| 118 | |
| 119 | ### Velero for Cluster Backups |
| 120 | |
| 121 | **Quick Start:** `velero install --provider aws --bucket my-backups` |
| 122 | |
| 123 | Configure sc |