kafka KRaft报Missing configuration `node.id` which is required when `process.roles` is defined (i.e. when running in KRaft mode).

啊啊 发表于: 2021-09-29   最后更新时间: 2021-09-29 20:02:01   1,369 游览

我使用kafka 3.0.0的KRaft模式,安装kafka集群,报:

Exception in thread "main" org.apache.kafka.common.config.ConfigException: Missing configuration node.id which is required when process.roles is defined (i.e. when running in KRaft mode).

错误详情:

Exception in thread "main" org.apache.kafka.common.config.ConfigException: Missing configuration `node.id` which is required when `process.roles` is defined (i.e. when running in KRaft mode).
        at kafka.server.KafkaConfig.validateValues(KafkaConfig.scala:1914)
        at kafka.server.KafkaConfig.<init>(KafkaConfig.scala:1897)
        at kafka.server.KafkaConfig.<init>(KafkaConfig.scala:1393)
        at kafka.tools.StorageTool$.$anonfun$main$2(StorageTool.scala:62)
        at scala.Option.flatMap(Option.scala:283)
        at kafka.tools.StorageTool$.main(StorageTool.scala:62)
        at kafka.tools.StorageTool.main(StorageTool.scala

我的命令是:

kafka-storage.sh format --config /tmp/kraft-test.properties --cluster-id aaaaaaaaaaaaaaaaaaaaaa

我的 /tmp/kraft-test.properties 配置如下:

listeners=PLAINTEXT://192.168.217.24:9092,PLAINTEXT1://192.168.217.24:9091
advertised.listeners=PLAINTEXT1://192.168.217.24:9091
listener.security.protocol.map=PLAINTEXT1:PLAINTEXT,PLAINTEXT:PLAINTEXT
process.roles=broker,controller
controller.quorum.voters=0@192.168.217.24:9092
controller.listener.names=PLAINTEXT
inter.broker.listener.name=PLAINTEXT1

请问我该如何解决?

发表于 2021-09-29

你少配置了node.id

当process.role为非空时,与该进程所扮演的角色相关的节点ID。这是在KRaft模式下运行时的必要配置。

摘自:Kafka Broker配置

你的答案

查看kafka相关的其他问题或提一个您自己的问题