A single Kafka server that stores data and serves client requests
Identified by unique broker.id
Cluster
Group of brokers working together for scalability and fault tolerance
Shares one cluster ID
Controller
One broker elected to manage partition leadership and metadata
Single active controller per cluster
Bootstrap Server
Initial broker(s) clients connect to for cluster discovery
host:9092
Example: Connecting to brokers
Properties props = new Properties();// Comma-separated list for failover; client discovers full clusterprops.put("bootstrap.servers", "broker1:9092,broker2:9092,broker3:9092");
2. Understanding Topics and Partitions
Concept
Description
Property
Topic
Named logical stream of records (category/feed name)
Multi-subscriber
Partition
Ordered, immutable append-only log; unit of parallelism
num.partitions
Partition Key
Determines which partition a record lands in via hashing
Same key → same partition
Ordering
Guaranteed only within a single partition, not across topic
Consumers request data rather than brokers pushing
Controls consumption rate
Example: Minimal produce and consume
producer.send(new ProducerRecord<>("orders", "key1", "payload"));ConsumerRecords<String, String> records = consumer.poll(Duration.ofMillis(100));for (ConsumerRecord<String, String> r : records) System.out.printf("%s @ %d%n", r.value(), r.offset());
4. Understanding Consumer Groups
Concept
Description
Rule
Consumer Group
Set of consumers sharing a group.id to split work
Scales horizontally
Partition Ownership
Each partition is consumed by exactly one member of a group
1 partition → 1 consumer
Parallelism Limit
Max active consumers = partition count
Extra consumers idle
Broadcast
Different groups each receive all messages independently
Pub/sub semantics
Example: Assigning a consumer group
props.put("group.id", "order-processors");// Three instances with same group.id share 6 partitions (2 each)KafkaConsumer<String, String> consumer = new KafkaConsumer<>(props);consumer.subscribe(List.of("orders"));
5. Understanding Replication
Term
Description
Detail
Replication Factor
Number of copies of each partition across brokers
RF=3 tolerates 2 failures
Leader
Replica handling all reads and writes for a partition
Record serialized, partitioned, batched, sent to leader
2. Replicate
Followers fetch and append to stay in ISR
3. Ack
Leader acknowledges per acks setting
4. Consume
Consumer polls leader, commits offset after processing
Example: End-to-end flow with ack
props.put("acks", "all"); // wait for all ISR before ackRecordMetadata md = producer.send(record).get();System.out.printf("partition=%d offset=%d%n", md.partition(), md.offset());
9. Understanding ZooKeeper Role
Responsibility
Description
Status
Controller Election
Picks the active controller broker
LEGACY
Metadata Store
Holds topic, partition, ACL, and config state
Replaced by KRaft
Membership
Tracks live brokers via ephemeral znodes
Removed in 4.0
Warning: ZooKeeper mode is removed in Kafka 4.0+. Use KRaft for all new deployments.