negimaster
negimaster

Reputation: 97

Do you need multiple zookeeper instances to run a multiple-broker kafka?

I'm new to kafka.

Kafka is supposed to be used as a distributed service. But the tutorials and blog posts i found online never mention if there is one or several zookeeper nodes.

The tutorials just pop one zookeper instance, and then multiple kafka brokers.

Is it how it is supposed to be done?

Upvotes: 4

Views: 5387

Answers (2)

Karthik Balaguru
Karthik Balaguru

Reputation: 7822

Zookeeper is a co-ordination service (in a centralized manner) for distributed systems that is used by clusters for maintenance of distributed system . The distributed synchronization achieved by it via metadata such as configuration information, naming, etc.

In general architectures, Kafka cluster shall be served by 3 ZooKeeper nodes, but if the size of deployment is huge, then it can be ramped up to 5 ZooKeeper nodes but that in turn will add load on the nodes as all nodes try to be in sync as all metadata related activities are handled by ZooKeeper.

Also, it should be noted that as an improvement, the new release of Kafka reduces dependency on ZooKeeper in order to enhance scalability of metadata across, to reduce the complexity in maintaining the meta data with external components and to enhance the recovery from unexpected shutdowns. With new approach, the controller failover is almost instantaneous. This is achieved by Kafka Raft Metadata mode termed as 'KRaft' that will run Kafka without ZooKeeper by merging all the responsibilities handled by ZooKeeper inside a service in the Kafka Cluster itself and operates on event based mechanism that is used in the KRaft protocol.

Upvotes: 5

Robin Moffatt
Robin Moffatt

Reputation: 32050

Tutorials generally keep things nice and simple, so one ZooKeeper (often one Kafka broker too). Useful for getting started; useless for any kind of resilience :)

In practice, you are going to need three ZooKeeper nodes minimum.

If it helps, here is an enterprise reference architecture whitepaper for the deployment of Apache Kafka


Disclaimer: I work for Confluent, who publish the above whitepaper.

Upvotes: 3

Related Questions