kafka KRaft模式报:controller.listener.names cannot be empty if the server has the controller role

啊啊 发表于: 2021-09-28   最后更新时间: 2021-09-28 16:28:50   2,020 游览

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

ERROR Exiting Kafka due to fatal exception (kafka.Kafka$)
java.lang.IllegalArgumentException: requirement failed: controller.listener.names cannot be empty if the server has the controller role

错误详情:

[2021-09-28 07:54:13,046] INFO Registered kafka:type=kafka.Log4jController MBean (kafka.utils.Log4jControllerRegistration$)
[2021-09-28 07:54:13,499] INFO Setting -D jdk.tls.rejectClientInitiatedRenegotiation=true to disable client-initiated TLS renegotiation (org.apache.zookeeper.common.X509Util)
[2021-09-28 07:54:13,573] ERROR Exiting Kafka due to fatal exception (kafka.Kafka$)
java.lang.IllegalArgumentException: requirement failed: controller.listener.names cannot be empty if the server has the controller role
    at scala.Predef$.require(Predef.scala:337)
    at kafka.server.KafkaConfig.validateValues(KafkaConfig.scala:1946)
    at kafka.server.KafkaConfig.<init>(KafkaConfig.scala:1897)
    at kafka.server.KafkaConfig.<init>(KafkaConfig.scala:1394)
    at kafka.Kafka$.buildServer(Kafka.scala:67)
    at kafka.Kafka$.main(Kafka.scala:87)
    at kafka.Kafka.main(Kafka.scala)

我的server.properties配置如下:

process.roles=broker,controller
controller.quorum.voters=1@172.21.0.1:9092,2@172.21.0.1:9093,3@172.21.0.1:9094

请问我该如何解决?

发表于 2021-09-28
添加评论

controller.listener.names cannot be empty if the server has the controller role
如果服务器具有控制器角色,controller.listener.names不能为空。

你这个borker是控制器角色,所以需要给控制角色指定一个网口,用于通讯,比如:

listeners配置的是:

listeners=PLAINTEXT://172.21.0.1:9092

controller.listener.names=PLAINTEXT
你的答案

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