我们在kafka属性文件中有broker.id属性。
broker.id 的重要性是什么?如果我们在不同虚拟机上运行的所有 kafka 实例上为broker.id 分配相同的整数会怎样。
最佳答案
来自 Apache Kafka 文档:
The broker.id property is the unique and permanent name of each node in the cluster.
代理 ID 必须是唯一的,因为该值用于核心 Kafka 算法(领导者/追随者)。
另一方面,每个 Kafka 代理都通过 Zookeeper 使用该broker.id 值来注册自己。这是该值必须唯一的另一个原因:否则您会得到类似的内容
java.lang.RuntimeException: A broker is already registered on the path /brokers/ids/0. This probably indicates that you either have configured a brokerid that is already in use, or else you have shutdown this broker and restarted it faster than the zookeeper timeout so it appears to be re-registering.
关于apache-kafka - Kafka中broker.id的重要性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52812066/