Apache Kafka Streaming (50 Qs)•Part 3: Advanced Internals, Scale & Production Architecture (Senior / Lead)
Zero-Downtime Migration from ZooKeeper to KRaft in Production.
senior LevelSystem DesignApache Kafka
In Simple Words: Migrating an existing enterprise Kafka cluster from ZooKeeper to KRaft without interrupting live producers or consumers:
- Deploy KRaft Controller Quorum: Spin up dedicated KRaft controller nodes running Kafka 3.6+.
- Enable Dual-Mode on Brokers: Update broker configurations with
zookeeper.metadata.migration.enable=true. Brokers connect to both ZooKeeper and the KRaft controllers. - Metadata Migration: The KRaft active controller reads cluster metadata from ZooKeeper and writes it into the
@metadataKRaft partition. - Switch Metadata Source: Migrate brokers to read metadata exclusively from KRaft controllers.
- Decommission ZooKeeper: Once all brokers are KRaft-native, remove the migration config and safely shut down the ZooKeeper cluster.