Disaster Recovery Strategies for Hadoop Clusters
What Is a Disaster?
- Data center outage (power, cooling, network)
- Human error that deletes or corrupts data everywhere
- Software bug or bad upgrade
- Ransomware or security incident
- Natural events
HA protects against single component failure inside one site. DR protects against losing the whole site.
DR Patterns
| Pattern | How | RPO | RTO | Cost |
|---|---|---|---|---|
| Backup and restore | Backups in another site or cloud; rebuild cluster when needed | Hours to 1 day | Days | Low |
| Cold standby | Small or empty cluster in DR site, data synced with distcp | Hours | Hours to a day | Medium |
| Warm standby | Smaller running cluster with replicated data and services configured | Minutes to hours | 1 to few hours | Medium-high |
| Active-active (two clusters) | Both run workloads; data produced or replicated both ways | Near zero | Minutes | High |
Replicate Each Layer
| Layer | Tool | Notes |
|---|---|---|
| HDFS | distcp with snapshot diff, or storage-level replication | Schedule every hour or day by priority |
| Hive tables | Hive replication (REPL DUMP / LOAD) or distcp + metastore DB replication | Keep table definitions and data in sync |
| HBase | Replication peers, snapshots | Near real-time possible |
| Kafka | MirrorMaker 2 or cluster linking | Topic config, offsets translation |
| Ranger and metadata | Export/import policies, replicate DBs | Keep security same in both sites |
| KMS keys | Same keys must exist in DR KMS | Without them encrypted data is unreadable |
| Configs and code | Git, Ansible, CI/CD to both | Avoid manual drift |
| Identity | KDC and LDAP replicas in DR site | Login must work when site A is gone |
Hive Replication Example
sql
-- on the source cluster
REPL DUMP sales WITH ('hive.repl.rootdir'='hdfs://prod/repl');
-- on the target cluster
REPL LOAD sales FROM 'hdfs://prod/repl/<dump-dir>';
-- next run is incremental, using the last event id returned by the previous dump
Check your version: Replication features and syntax vary across Hive versions and vendors. Treat this as a pattern and test it with your release.
Switch-Over Design
- Use DNS aliases or load balancers for entry points (Knox, HiveServer2, edge, Kafka bootstrap) so applications do not change
- Use a nameservice name rather than host names in client configs
- Keep DR configs identical except endpoints (managed by Ansible group vars)
- Document the data lag and which jobs must be re-run after failover
Failover Runbook (Outline)
- Declare disaster (decision owner and criteria written in advance)
- Freeze writes at the source if still reachable and take a last sync
- Verify DR data freshness (last replicated snapshot or event id)
- Start or scale up DR services in the right order: ZooKeeper, HDFS, KMS, YARN, Hive, HBase, Kafka, Ranger
- Check security: Kerberos, Ranger policies, KMS keys
- Switch DNS and load balancer entries
- Start critical pipelines in priority order
- Smoke tests, then announce to users
- Plan failback: reverse replication and a maintenance window
Test the Plan
| Test | How often |
|---|---|
| Table-top walk-through | Twice a year |
| Restore sample dataset in DR | Quarterly |
| Full failover exercise | Yearly (or per policy) |
| Measure real RPO and RTO | Every test, then compare with target |
Typical DR failures: Encryption keys not replicated, firewall rules missing in DR site, outdated configs, capacity of the DR cluster too small, runbook known by only one person, DNS TTL too long.
Right-size DR: Replicate everything important, but not scratch and temporary data. Tier datasets so the DR cluster can be smaller than production.
Conclusion
Choose a DR pattern from RPO, RTO and budget, replicate data, metadata, keys, security and configs together, design the switch with DNS and nameservices, and rehearse the runbook.
Quick Summary: RPO/RTO -> pattern; replicate all layers; switch via DNS; test.

