Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • What topics exist?
  • How many partitions does each topic have?
  • Which broker is currently the leader for each partition?
  • What is the host and port for each of these brokers?

This is the only request that can be addressed to any broker in the cluster.

...

The metdata returned is at the partition level, but grouped together by topic for convenience and to avoid redundancy. For each partition the metadata contains the information for the leader as well as for all the replicas and the list of replicas that are currently in-sync.

Topic Metadata Request
Code Block
MetadataRequestTopicMetadataRequest => [TopicName]
  TopicName => string

...

Code Block
MetadataResponse => [Broker][TopicMetadata]
  Number of brokers
  BrokerBrokers => NodeId Host Port  (any number of brokers may be returned)
  	NodeId => int32
  	Host => string
  	Port => int32
  TopicMetadata => TopicErrorCode TopicName [PartitionMetadata]
  	TopicErrorCode => int16
  PartitionMetadata => PartitionErrorCode PartitionId Leader Replicas Isr
  	PartitionErrorCode => int16
  	PartitionId => int32
  	Leader => int32
  	Replicas => [int32]
  	Isr => [int32]

Field

Description

Leader

The node id for the kafka broker currently acting as leader for this partition. If no leader exists because we are in the middle of a leader election this id will be -1.

Replicas

The set of alive nodes that currently acts as slaves for the leader for this partition.

Isr

The set subset of the replicas that are "caught up" to the leader

Broker

The node id, hostname, and port information for a kafka broker

...