Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

How producer and consumer identify the leader in Kafka

How producer and consumer identify the leader in Kafka

Contributor

Hi,

How producer and consumer identify the leader in Kafka.

Thank you.

4 REPLIES 4

Re: How producer and consumer identify the leader in Kafka

Super Collaborator

via zookeeper query or bootstraping. the information is stored in zookeeper per topic.

Re: How producer and consumer identify the leader in Kafka

Contributor

@Harald Berghoff

Thank you for the reply.

How to check this in zookeeper.

Re: How producer and consumer identify the leader in Kafka

Super Collaborator

@Nilesh within the zookeeper the leader is given at this path:

/brokers/topics/<<topicname>>

at this path a value named 'partitions' is available, providing key value pairs of

<<partition id>> : <<broker id (of leader)>>

To identify the connection parameter for the broker id, check at the path

/brokers/ids/<<broker id>

the attributes "host", "port" and "endpoints", where endpoints is a multivalue and can contain more than one endpoint.

Highlighted

Re: How producer and consumer identify the leader in Kafka

New Contributor

Since Kafka version 0.9, Producers and consumers fetch all metadata details from Kafka brokers directly and Kafka brokers are in sync with Zookeeper. Each Kafka brokers have information about leader.