Integration / Apache Kafka Interview questions
How do you migrate a Kafka cluster from ZooKeeper mode to KRaft mode?
Since Apache Kafka 4.0 removed ZooKeeper mode entirely, any cluster still running on it must migrate to KRaft before upgrading to 4.0 or later — there is no direct ZooKeeper-to-4.0 upgrade path. The supported migration runs on a 3.x release that still supports both modes, moving the cluster over while it stays online.
- Upgrade to a 3.x release that supports migration (Kafka recommends being on a recent 3.x, e.g. 3.9.x, before starting) if not already there.
- Deploy a new KRaft controller quorum alongside the existing ZooKeeper ensemble, configured in migration mode rather than replacing anything yet.
- Enable migration on the brokers (
zookeeper.metadata.migration.enable=true), which starts syncing existing cluster metadata from ZooKeeper into the new KRaft controllers. - Verify the migration has completed and the KRaft controllers hold a full, correct copy of cluster metadata before proceeding further.
- Roll the brokers one at a time to run in KRaft mode instead of ZooKeeper mode, removing their ZooKeeper dependency broker by broker.
- Decommission the ZooKeeper ensemble once every broker has been confirmed running purely on KRaft.
- Only then upgrade to Kafka 4.0+, which requires the cluster to already be fully on KRaft.
The whole process is designed to run without cluster downtime, but it's a multi-step, order-sensitive migration rather than a simple version bump, which is why Kafka's own documentation strongly recommends testing the full sequence against a non-production cluster first.
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
