Assemble a Kafka disaster recovery plan
Four parts: a failure scenario table, scheduled backups to object storage, a restore runbook, and targets with a test cadence. Everything below is copy-ready.
What a Kafka disaster recovery plan covers
A Kafka disaster recovery plan answers one question per failure: how does the cluster get back to serving traffic, and what data survives? Replication alone cannot answer it. Replication copies corruption, propagates deletions, and offers no way back to "before the incident."
A backup-based plan does. It needs four parts: a scenario table naming each failure and its recovery action, a backup schedule that sets your data-loss window, a runbook the on-call engineer can run at 3 AM, and targets that get tested on a calendar — not during the outage.
Part 1 — Name the failures before they happen
| Failure scenario | Recovery action |
|---|---|
| Regional outage | Restore the latest backup to a standby cluster — the warm standby pattern |
| Bad data published | Point-in-time restore to the millisecond before corruption |
| Topic deleted by mistake | Restore that one topic from the last backup containing it |
| Ransomware / cluster compromise | Provision an isolated cluster, restore from a clean validated backup |
Each row maps to the same three commands — validate, validate-restore,
three-phase-restore — with different configs. That is the point of the plan:
no improvisation during the incident.
Part 2 — Schedule the backups that fund the plan
- dr-backup.yaml
- Operator schedule
- dr-runbook.sh
mode: backup
backup_id: "production-${TIMESTAMP}"
source:
bootstrap_servers:
- kafka-prod-1:9092
- kafka-prod-2:9092
- kafka-prod-3:9092
topics:
include:
- "*"
exclude:
- "__consumer_offsets"
- "_schemas"
storage:
backend: s3
bucket: kafka-dr-backups
region: us-east-1 # DR region, not the production region
prefix: production/hourly
backup:
compression: zstd
compression_level: 3
checkpoint_interval_secs: 30
# Both required for consumer group recovery after restore
include_offset_headers: true
source_cluster_id: "prod-us-west-2"
apiVersion: kafka.oso.sh/v1alpha1
kind: KafkaBackup
metadata:
name: dr-hourly-backup
spec:
schedule: "0 * * * *" # Hourly
kafkaCluster:
bootstrapServers:
- kafka-prod-1:9092
topics:
- "*"
storage:
storageType: s3
s3:
bucket: kafka-dr-backups
region: us-east-1
prefix: production/hourly
compression: zstd
includeOffsetHeaders: true
sourceClusterId: "prod-us-west-2"
#!/bin/bash
# Kafka DR runbook: pass the backup ID approved for recovery
BACKUP_ID="${1:?Usage: dr-runbook.sh <backup-id>}"
# 1. Prove the backup is intact before touching the cluster
kafka-backup validate \
--path s3://kafka-dr-backups/production/hourly \
--backup-id "$BACKUP_ID" \
--deep
# 2. Prove the restore config is valid
kafka-backup validate-restore --config dr-restore.yaml
# 3. Restore data, then reposition consumer groups
kafka-backup three-phase-restore --config dr-restore.yaml
Part 3 — Set targets the schedule can meet
Backup frequency sets your recovery point objective. Data volume sets your recovery time objective. Put both numbers in the plan and defend them.
| Backup frequency | RPO (max data loss) |
|---|---|
| Continuous | ~1 minute |
| Every 15 minutes | 15 minutes |
| Hourly | 1 hour |
| Daily | 24 hours |
| Data volume | RTO estimate |
|---|---|
| Under 10 GB | 15–30 minutes |
| 10–100 GB | 30–60 minutes |
| 100 GB – 1 TB | 1–2 hours |
| Over 1 TB | 2–4 hours |
Setting targets per workload — not one number for the whole cluster — is covered in the RTO/RPO planning guide on the blog.
Part 4 — Put the tests on a calendar
A plan nobody has executed is a document, not a capability. Schedule the proof:
| Test | Frequency |
|---|---|
| Backup integrity validation | Daily |
| Restore to a test cluster | Weekly |
| Full DR drill with failover | Quarterly |
The DR testing playbook turns this table into a full drill program, with pass/fail evidence for each level.
Frequently asked questions
What should a Kafka disaster recovery plan include?
Four parts: a failure scenario table mapping each incident type to a recovery action, a backup schedule that sets the RPO, a validated restore runbook, and RTO/RPO targets with a recurring test cadence. Each scenario should resolve to specific commands and configs, not prose.
Is Kafka replication enough for disaster recovery?
No. Replication provides availability, not recovery. It copies corrupted records to the standby, propagates topic deletions, and cannot restore the cluster to a state before an incident. A DR plan needs isolated, point-in-time restorable backups alongside any replication.
How often should I back up Kafka for disaster recovery?
Backup frequency equals your maximum data loss. Hourly backups mean up to one hour of loss; every 15 minutes means 15. Choose per workload based on data criticality, storage cost, and compliance requirements, and record the choice in the plan.
Do consumer groups recover their positions after a DR restore?
Yes, when backups are taken with include_offset_headers: true and a source_cluster_id. The three-phase restore maps each committed source offset to the equivalent offset in the restored log and repositions the groups you list.
How do I test a Kafka disaster recovery plan without risking production?
Restore into an isolated test cluster. Validate the backup with kafka-backup validate --deep, run the restore against the test cluster, and compare record counts and consumer positions. Weekly restore tests plus a quarterly full drill keep the plan honest.
Ready to protect your Kafka data?
Take your first backup in minutes with the open source CLI, or talk to us about Enterprise features like encryption, RBAC, and audit logging.