For the complete documentation index, see llms.txt. This page is also available as Markdown.

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:

Metrics to monitor

Metric
What it tells you

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

  1. Check replication lag is within acceptable bounds for your RPO.

  2. Verify replicated topics exist on the target with expected partition counts.

  3. 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:

  1. Stop consumers on the target cluster.

  2. Redirect consumers back to the source cluster (offsets on the source are unchanged — K2K does not commit there).

  3. Investigate using Troubleshooting.

When to use k2k-tool

Use k2k-tool during failover preparation or investigation:

  • describe — inspect committed offsets before cutover

  • set — manually adjust offsets if a group was not offset-mapped

  • reset — reset to earliest (use with caution)

Decommission source cluster

After a permanent failover:

  1. Stop all K2K processes.

  2. Confirm all applications run on the target cluster.

  3. Decommission the source Kafka cluster per your infrastructure procedures.

Last updated

Was this helpful?