Video in progress

What's the difference between ZooKeeper and KRaft?

Old Kafka clusters kept their metadata (brokers, topics, leaders) in ZooKeeper. In KRaft mode Kafka's own controllers do this job using the Raft protocol, and ZooKeeper isn't needed. ZooKeeper was removed completely in Kafka 4.0.

📖 Answer

It used to take two systems to run a Kafka cluster: a ZooKeeper ensemble and the brokers. You had to configure, monitor and secure both.

In KRaft (preview in Kafka 2.8, production-ready in 3.3) the metadata is stored in a special internal topic and the controller nodes replicate it through Raft.

Practical benefits:

  • one system, so deployment and monitoring are simpler;
  • controller failover is faster;
  • clusters with a very large number of partitions work better.

As a developer you barely notice the difference: clients still connect to the brokers through bootstrap.servers. If you see the --zookeeper localhost:2181 flag in old guides, it's deprecated; today you use --bootstrap-server.