If I have cluster hosting 1 topic which has three partitions. So ZooKeeper(ZK) cluster hosting 3 broker instances.
Per mine understanding ,
- Producer will interact with ZooKeeper to publish the message on broker.
- ZK will decide internally which partition it needs to publish the message based on load on each broker instance. Broker will also interact with ZK to maintain offset per consumer instance
- Similarly Consumer will interact with ZooKeeper to consume the message from broker. ZK will get the message out from right broker based on load.
But I got confused after reading below bold text from section Workflow of Queue Messaging / Consumer Group
at kafka tutorial. Is mine understanding above wrong ? Based on below looks like producer/consumer does not interact directly with zookeeper. Is it otherway around
where ZK interact with producer/consumer. If yes who(Zookeeper or broker) which broker instance message needs to be published or consumed ?
ZooKeeper service is mainly used to notify producer and consumer about the presence of any new broker in the Kafka system or failure of the broker in the Kafka system. As per the notification received by the Zookeeper regarding presence or failure of the broker then producer and consumer takes decision and starts coordinating their task with some other broker. Basically Apache Zookeeper s a distributed configuration and synchronization service