The riskiest way to migrate Kafka is the weekend cutover: stop everything on Friday, copy what you can, point every application at the new cluster, and hope it works on Monday. It concentrates every unknown into one window, and if something breaks there is no partial rollback.
We migrate one pipeline at a time instead. The old and new clusters run side by side, data is replicated continuously, and each pipeline's consumers and producers move in a defined order with checks at each step. This article explains the mechanics.
Replicate data, schemas and the rest
Data. The replication tool depends on the platforms. When the target is Confluent Platform or Confluent Cloud, Cluster Linking is usually the first choice: it creates mirror topics on the target that are byte-for-byte copies of the source, with the same partitions and the same offsets, read-only until you promote them. Where cluster linking isn't available, Confluent Replicator or Apache Kafka's MirrorMaker 2 copy data through Kafka Connect; they don't preserve offsets, so consumer positions are translated rather than copied, and that changes the switchover plan.
Consumer offsets. Consumers must resume where they left off. With cluster linking, consumer group offsets can be synced to the target continuously; with MirrorMaker 2, offsets are translated through checkpoints. Either way, we check the synced positions for every group before it moves.
Schemas. Every schema subject and version the applications use must exist on the target registry, with the same IDs if consumers rely on them. We replicate schemas (for example with Schema Linking or exporters), or migrate them with their IDs preserved.
Security and configuration. ACLs or role bindings, service accounts and topic configurations are mapped from the assessment's security mapping and created on the target as code, so they can be reviewed before anything moves.
Move one pipeline at a time
- Move the consumers. Each consumer group is stopped on the source and started against the target's mirror topic at its synced offset. It now reads the same data from the new cluster while the producers keep writing to the old one.
- Stop the producers for that topic, and wait until the mirror has caught up: replication lag at zero, last offsets equal on both sides (with MirrorMaker 2 or Replicator, compare message counts and translated offsets instead, since offsets differ).
- Promote the mirror so it becomes a normal, writable topic on the target and stops replicating.
- Start the producers against the target. The pipeline is now entirely on the new cluster.
- Watch, then retire. Keep the source topic for an agreed period in case of rollback, then delete it and its replication.
Moving consumers before producers means the risky step (changing where data is written) happens last, when everything that reads the data is already known to work on the target. The producer pause in steps 2 to 4 is usually short, and producers that can buffer briefly see no errors at all.
Validate at every step
| Check | When |
|---|---|
| Message counts and last offsets match per partition | Before consumers move; before promotion |
| Consumer group lag on the target is stable and falling | After consumers move |
| No deserialization errors (schemas present, IDs right) | After consumers move |
| Producer error rates and latency at baseline | After producers start |
| End-to-end SLA of the pipeline met | Throughout, and for the watch period |
We also validate the cluster, the stream pipelines and the connectors as a whole before the first wave, using our automated validation checks, and benchmark the target with production-like load.
Forty pipelines in six waves
Tallis is moving from a self-managed Apache Kafka cluster in its data centre to Confluent Cloud. The assessment grouped its forty pipelines into six waves, starting with internal analytics feeds and ending with shipment tracking, which customers see. Each wave followed the same order: mirror topics and synced offsets, consumers, a short producer pause, promotion, producers, and a one-week watch period. Two pipelines in the second wave turned out to have an unknown consumer group; because consumers move first, it was found because it was still active on the source after every known consumer had moved, before any producer had moved.
All names and details are fictional.
Choosing the order of waves
The order matters as much as the mechanics. We usually group pipelines into waves with these rules:
- Lowest impact first. Internal feeds where a short delay is acceptable go early, so the process is proven before anything customer-facing moves.
- Keep connected pipelines together. If one application reads topic A and writes topic B, the consumers of B and the producers of A have to be considered in the same plan.
- Respect business calendars. No waves during month-end close, peak trading or a change freeze.
- Leave the hardest for when the team is practised, not for the last week before a contract ends.
Cases that need extra care
- Stream processing applications. A Kafka Streams, ksqlDB or Flink application is a consumer of its inputs and a producer of its outputs, often with internal state. It moves as one unit, and its state either moves with it (for example by mirroring the changelog topics) or is rebuilt on the target, which takes time to plan for.
- Transactional producers and exactly-once pipelines. Test how the chosen replication tool handles transactional data, and run
read_committedconsumers against the mirror before the wave. - Compacted topics. Consumers that rebuild state by reading a compacted topic from the beginning need the full topic on the target, not only recent data.
- Hard-coded offsets or timestamps. Applications that store their own offsets outside Kafka need the same translation as consumer groups, done by the application team.
Connectors and applications
Connectors move like applications: sink connectors with the consumers, source connectors with the producers, often replaced by managed connectors on the target. Application changes (bootstrap servers, credentials, sometimes a client library upgrade) are made and tested before the wave, so on the day each move is a configuration switch, not a code change.
The plan for all of this comes from the migration assessment; the monitoring that tells you each step worked is in the monitoring guide.
Questions we are often asked
How long is the producer pause?
It is the time for the mirror to catch up and be promoted, plus the time to restart the producers with the new configuration. It depends on replication lag at the moment producers stop and on how quickly your deployments restart, so we measure it in rehearsal on non-production environments rather than promise a number.
Do topic names change?
They don't have to. Mirror topics can keep the source name; a prefix is an option when both clusters must be told apart during the migration. Keeping names avoids changes in every application.
What if a wave goes wrong?
Before producers move, consumers are pointed back at the source. That is why each wave stops and checks after consumers move, and why rollback after promotion is planned before the wave starts rather than improvised.