Support Questions

Find answers, ask questions, and share your expertise

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

Super Collaborator

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

Contributor

@Harald Berghoff

Thank you for the reply.

How to check this in zookeeper.

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.

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.

Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.