Apache Kafka Tutorial 0/111 lessons ~6 min read Lesson 6
Brokers
What is Brokers?
Course progress0%
Focus
9 guided sections
Practice signal
Examples included
Career prep
Foundation builder
Introduction
What is Brokers? Brokers are Kafka servers that store partitions, serve reads/writes, replicate data, and coordinate clients.
Understanding the topic
What happens — Brokers:
- Brokers host topic partitions on disk.
- One broker is leader per partition.
- Followers replicate for fault tolerance.
- Controller broker manages cluster metadata.
| Term | Description |
|---|---|
| Broker | Kafka server node in the cluster. |
| Log directory | Disk path where partition segments live. |
| Controller | Elected broker for metadata (KRaft). |
| Rack | Failure domain for replica placement. |
Visual explanation
Pipeline view:
text
Producer↓Topic partition log↓Consumer group A↓Consumer group BReplay is possible because records are retained
Step-by-step explanation
- Start broker — Load logs and join cluster.
- Lead partitions — Serve produce/fetch for assigned leaders.
- Replicate — Followers fetch from leaders.
- Fail over — New leader elected on failure.
Informative example
Example:
bash
kafka-topics --bootstrap-server localhost:9092 --create --topic brokers --partitions 6 --replication-factor 3kafka-console-producer --bootstrap-server localhost:9092 --topic brokerskafka-console-consumer --bootstrap-server localhost:9092 --topic brokers --from-beginningkafka-consumer-groups --bootstrap-server localhost:9092 --describe --group brokers-service
Execution workflow
1Brokers workflow
1 / 4Start broker
Load logs and join cluster.
Best practices
- Design events around business facts: OrderCreated, PaymentAuthorized, InventoryReserved.
- Pick keys based on ordering and load distribution.
- Document owner, retention, schema, partitions, and consumers for every topic.
- Assume duplicate delivery and build idempotent consumers early.
Common mistakes
- Expecting global ordering across a topic.
- Creating one partition because local demos work.
- Skipping schema governance until multiple teams deploy independently.
Summary
Brokers — Start every design with event ownership, topic naming, key choice, schema contract, retention, replay plan, and monitoring.
Ready to mark this lesson complete?Track your journey across the entire course.