kafka config_error ai_generated true

org.apache.kafka.common.errors.BrokerIdConflictException: 代理 ID 1 已被另一个地址为 192.168.1.10:9092 的代理注册

org.apache.kafka.common.errors.BrokerIdConflictException: Broker ID 1 is already registered by another broker with address 192.168.1.10:9092

ID: kafka/broker-id-conflict

其他格式: JSON · Markdown 中文 · English
95%修复率
90%置信度
1证据数
2023-11-05首次发现

版本兼容性

版本状态引入弃用备注
kafka_2.13-3.4.0 active
kafka_2.13-3.5.1 active
kafka_2.13-3.6.0 active

根因分析

同一 Kafka 集群中的两个代理具有相同的 `broker.id` 值,导致 ZooKeeper 或 KRaft 元数据中的冲突。

English

Two Kafka brokers in the same cluster have the same `broker.id` value, causing a conflict in ZooKeeper or KRaft metadata.

generic

官方文档

https://kafka.apache.org/documentation/#brokerconfigs_broker.id

解决方案

  1. Change the `broker.id` in one broker's `server.properties` to a unique value (e.g., from 1 to 2) and restart that broker. Verify no other broker uses ID 2.
  2. If using KRaft, check `meta.properties` in the log directory and ensure `broker.id` is unique across all nodes; regenerate the cluster ID if necessary.
  3. Use a script to list all registered brokers: `zookeeper-shell.sh localhost:2181 get /brokers/ids/1` and compare the `endpoints` field to identify the conflicting broker, then update its ID.

无效尝试

常见但无效的做法:

  1. 98% 失败

    The conflict persists because the same IDs are still assigned; ZooKeeper still sees both with the same ID.

  2. 90% 失败

    This removes the conflicting registration but the broker re-registers with the same ID on restart, causing the error again.

  3. 85% 失败

    This only affects automatic ID assignment, not manual conflicts; it does not resolve existing duplicate IDs.