Kafka metadata explained (topics, partitions, brokers, offsets)
Codemia Knowledge Hub ·
Kafka metadata is the information that describes the cluster rather than the message contents: topics, partitions, brokers, offsets and consumer groups. Clients and brokers rely on it to find each other and route data. The quickest way to see a topic's metadata is kafka-topics.sh --describe.
This shows which partitions exist for my-topic, the leader of each partition, the replica sets, and the ISR (in-sync replica) sets.
What Kafka metadata contains
- Topics: categories or feed names that records are published to. Topic metadata includes the name, partition count, replication factor, and configuration such as retention policies.
- Partitions: each topic is split into partitions so the log can scale horizontally across brokers. Partition metadata includes the current leader, the brokers that host replicas, and the partition size.
- Brokers: the Kafka servers that store data and serve clients. Broker metadata includes IDs, host names, port numbers, and the topics and partitions each broker holds.
- Offsets: every record in a partition has a sequential ID called an offset. Offset metadata includes the current log end offset and consumers' committed offsets.
- Consumer groups: consumers can join a group to share the processing of a topic. Group metadata includes the offsets each group tracks per topic-partition.
| Component | Description | Importance |
| Topics | Names, settings, partitions, replicas | Organizing data into streams |
| Partitions | Splits topics for scalability | Parallel processing & fault tolerance |
| Brokers | Servers storing data | Data distribution & load balancing |
| Offsets | Position markers within partitions | Accurate data retrieval |
| Consumer Groups | Management of consuming clients | Efficient data processing |
Where Kafka stores metadata
Consumer group offsets live in the internal __consumer_offsets topic. For other metadata, such as topic configuration and partition leadership, brokers have used ZooKeeper to store and retrieve it. Since Kafka 2.8.0 there has been a move away from ZooKeeper toward a self-managed metadata quorum called KRaft (Kafka Raft metadata mode).
How clients use metadata
- Producers fetch topic metadata (partitions and their leaders) before sending, so each message goes straight to the right broker and partition leader.
- Consumers use metadata to know where to fetch from, to store and retrieve offsets, and to handle rebalances in the group.
- Kafka Streams and Kafka Connect use metadata heavily to manage scaling, fault tolerance, and processing state.
Related reading
- Metadata requests in Kafka producer
- Micronaut Kafka Health check fails with Cluster authorization failed
- Microservices Why Use RabbitMQ?
- Mirrormaker2.0 vs confluent replicator
- missed heartbeats from client, timeout 30s - RabbitMQ
- Mocking Kafka APIs for Unit Testing
- ModuleNotFoundError No module named 'kafka.vendor.six.moves' in Dockerized Django Application
- Monitoring UI for Apache kafka - kafka manager vs kafka monitor
Course lessons on this
System design interview problems on this topic
- Design a Distributed Messaging System: solution and walkthrough
- Design a Log Collection and Analysis System: solution and walkthrough
- Design an Ad Click Aggregation System: solution and walkthrough
- Design a Webhook Notification Service: solution and walkthrough

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseSystem Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.