Skip to content

Migrate to a new Kafka cluster without rebuilding it by hand

Topics, settings, ACLs, consumer groups, schemas: it is easy to forget one. Let Kurkik write down what the old cluster has, and apply it to the new one.

Terminal window
kurkik conn add kafka old --bootstrap old-broker:9092 --test
Terminal window
kurkik conn add kafka new --bootstrap new-broker:9092 --test

If you use a schema registry, give each connection its --registry-url.

Terminal window
kurkik kafka export old --acls --groups

You get old-kafka.yaml. Open it and check it is what you expect. It is also a good file to keep in Git.

Terminal window
kurkik kafka sync old-kafka.yaml new --all --dry-run

Nothing changes. Read the plan, including the left alone part: that is what sync will not do, and why. Kafka itself checks the requests.

Terminal window
kurkik kafka sync old-kafka.yaml new --all

On a fresh cluster sync only needs to create. If the new cluster already has some of these topics and you want them changed, add --overwrite.

Terminal window
kurkik kafka diff old new --all

See how to check a migration.

Terminal window
kurkik kafka sync history new
Terminal window
kurkik kafka sync revert <snapshot> new

Good to know:

  • The new cluster needs enough brokers for the replication factors in the document.
  • Consumer groups: Kafka cannot hold an empty group without settings, and no position is copied.

Try it first on the demo sandbox. Real output: full sync example.