kafka报Each listener must have a different name, listeners

啊啊 发表于: 2021-09-28   最后更新时间: 2021-09-28 19:00:45   3,012 游览

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

ERROR Exiting Kafka due to fatal exception (kafka.Kafka$)
java.lang.IllegalArgumentException: requirement failed: Each listener must have a different name, listeners: PLAINTEXT://192.168.40.179:9091,PLAINTEXT://192.168.40.179:9092

错误详情:

[2021-09-28 10:29:01,513] INFO Registered kafka:type=kafka.Log4jController MBean (kafka.utils.Log4jControllerRegistration$)
[2021-09-28 10:29:01,951] INFO Setting -D jdk.tls.rejectClientInitiatedRenegotiation=true to disable client-initiated TLS renegotiation (org.apache.zookeeper.common.X509Util)
[2021-09-28 10:29:02,020] ERROR Exiting Kafka due to fatal exception (kafka.Kafka$)
java.lang.IllegalArgumentException: requirement failed: Each listener must have a different name, listeners: PLAINTEXT://192.168.40.179:9091,PLAINTEXT://192.168.40.179:9092
    at scala.Predef$.require(Predef.scala:337)
    at kafka.utils.CoreUtils$.validate$1(CoreUtils.scala:261)
    at kafka.utils.CoreUtils$.listenerListToEndPoints(CoreUtils.scala:275)
    at kafka.server.KafkaConfig.listeners(KafkaConfig.scala:1814)
    at kafka.server.KafkaConfig.controllerListeners(KafkaConfig.scala:1820)
    at kafka.server.KafkaConfig.validateValues(KafkaConfig.scala:1945)
    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配置如下:

listeners=PLAINTEXT://192.168.40.179:9091,PLAINTEXT://192.168.40.179:9092

请问我该如何解决?

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

Each listener must have a different name
每个listener必须有一个不同的名字

你需要定义不同的名称,比如:

listeners=PLAINTEXT://192.168.40.179:9091,PLAINTEXT1://192.168.40.179:9092

但是这样配置会提示安全问题,你需要增加安全信任:

listener.security.protocol.map=PLAINTEXT1:PLAINTEXT,PLAINTEXT:PLAINTEXT
你的答案

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