Disaster recovery
Failover procedure for disaster recovery with K2K.
This runbook covers failover from a source Kafka cluster to a standby target cluster when K2K has been replicating data continuously. For the business context, see Use cases.
Prerequisites
Before a failover event:
Pipeline with both source and sink replication stages — see Topic selection and data routing
K2K replicator running and replicating selected topics to the standby cluster
Offset mapping enabled with both
k2kandk2k-offset-mappingdeployed if applications must resume without reprocessingSchema migration enabled if applications use Schema Registry
Observability metrics and alerting configured for replication lag
Failover drill completed using the Validation checklist
Metrics to monitor
Replication lag
How far behind the standby is relative to production
Offset mapping progress
Whether target consumer groups are being translated
Error rates
Connection, produce, or commit failures
Alert on sustained lag growth or mapping stalls before a failover event occurs.
Failover procedure
1. Confirm standby readiness
Check replication lag is within acceptable bounds for your RPO.
Verify replicated topics exist on the target with expected partition counts.
If using offset mapping, confirm target consumer group offsets are current:
2. Stop writes to the source cluster
Stop producers on the source Kafka cluster (or block traffic at the network layer). Allow K2K to drain remaining records.
3. Wait for lag to reach zero
Monitor until replication lag is zero and the offset mapper has translated the latest committed offsets.
4. Switch consumers to the target cluster
Update application configuration to point bootstrap servers at the target Kafka cluster. Consumer groups that were offset-mapped should resume from equivalent positions.
5. Validate applications
Confirm applications consume correctly from the target cluster. Check for schema compatibility issues if Schema Registry was replicated.
6. Keep K2K running (optional)
Leave K2K running if you plan to fail back once the source cluster is restored. For a permanent switch, proceed to decommission below.
Rollback
If the target cluster has issues:
Stop consumers on the target cluster.
Redirect consumers back to the source cluster (offsets on the source are unchanged — K2K does not commit there).
Investigate using Troubleshooting.
When to use k2k-tool
Use k2k-tool during failover preparation or investigation:
describe— inspect committed offsets before cutoverset— manually adjust offsets if a group was not offset-mappedreset— reset to earliest (use with caution)
Decommission source cluster
After a permanent failover:
Stop all K2K processes.
Confirm all applications run on the target cluster.
Decommission the source Kafka cluster per your infrastructure procedures.
Last updated
Was this helpful?

