In a Kafka cluster, what is the main job of a broker node?
Think about where messages are kept and how clients get them.
A Kafka broker node receives messages from producers, stores them, and serves them to consumers. It manages partitions and handles data storage and retrieval.
Given this Kafka broker configuration snippet, what will be the broker's advertised listener port?
listeners=PLAINTEXT://0.0.0.0:9092 advertised.listeners=PLAINTEXT://broker1.example.com:9094
Advertised listeners tell clients how to connect.
The advertised.listeners setting tells clients the hostname and port to use, so the port is 9094.
Examine the following Kafka broker configuration snippet. Why will the broker fail to start?
broker.id=1 listeners=PLAINTEXT://:9092 advertised.listeners=PLAINTEXT://localhost:9092 log.dirs=/tmp/kafka-logs
Check the listeners setting format carefully.
The listeners setting requires a hostname or IP before the port. ':9092' is invalid and causes startup failure.
Choose the correct syntax to configure two listeners: one PLAINTEXT on port 9092 and one SSL on port 9093.
Multiple listeners are separated by commas.
The correct syntax uses commas to separate listeners. Semicolons, brackets, or spaces are invalid.
Given a Kafka cluster with 3 brokers (IDs 1, 2, 3) and a topic with 6 partitions assigned as follows:
- Partition 0: leader=1, replicas=[1,2]
- Partition 1: leader=2, replicas=[2,3]
- Partition 2: leader=3, replicas=[3,1]
- Partition 3: leader=1, replicas=[1,3]
- Partition 4: leader=2, replicas=[2,1]
- Partition 5: leader=3, replicas=[3,2]
How many partitions does broker 2 host (as leader or replica)?
Count all partitions where broker 2 is either leader or in replicas.
Broker 2 is leader for partitions 1 and 4, replica for 0 and 5. Unique partitions hosted: 0, 1, 4, 5 — total 4.