broker.id 在卡夫卡中的重要性?

Importance of broker.id in kafka?

我们在 kafka 属性文件中有 broker.id 属性。

broker.id 的重要性是什么?如果我们在不同 vm 上的所有 kafka 实例 运行 上将相同的整数分配给 broker.id 会怎样。

来自 Apache Kafka 文档:

The broker.id property is the unique and permanent name of each node in the cluster.

Broker id 必须是唯一的,因为该值用于核心 Kafka 算法 (leader/followers)。

另一方面,每个 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.