Video in progress
What are a Kafka broker and a cluster, and how are they related?
A broker is a single Kafka server process; it stores partitions on disk and answers requests. A cluster is several brokers working together; partitions and their copies are distributed across them.
📖 Answer
On prod there are usually at least 3 brokers. Each broker has a broker.id number (node.id in KRaft).
A client (producer or consumer) gets one or two broker addresses in bootstrap.servers when it connects:
spring:
kafka:
bootstrap-servers: kafka-1:9092,kafka-2:9092
This list doesn't have to be complete. The client asks the first broker it connects to for metadata: which broker is the leader for which partition of which topic. After that it talks directly to the broker it needs.
That's why giving just one address is risky: if that broker is down, the application won't start at all. Two or three addresses are enough.
Sign up to mark studied questions and save your progress.