kafka报No security protocol defined for listener INTERNAL

啊啊 发表于: 2021-09-28   最后更新时间: 2021-09-28 18:46:04   131 游览

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

ERROR Exiting Kafka due to fatal exception (kafka.Kafka$)
java.lang.IllegalArgumentException: Error creating broker listeners from 'INTERNAL://192.168.40.174:9092': No security protocol defined for listener INTERNAL

错误详情:

[2021-09-28 10:12:14,960] INFO Registered kafka:type=kafka.Log4jController MBean (kafka.utils.Log4jControllerRegistration$)
[2021-09-28 10:12:15,460] INFO Setting -D jdk.tls.rejectClientInitiatedRenegotiation=true to disable client-initiated TLS renegotiation (org.apache.zookeeper.common.X509Util)
[2021-09-28 10:12:15,535] ERROR Exiting Kafka due to fatal exception (kafka.Kafka$)
java.lang.IllegalArgumentException: Error creating broker listeners from 'INTERNAL://192.168.40.174:9092': No security protocol defined for listener INTERNAL
    at kafka.utils.CoreUtils$.listenerListToEndPoints(CoreUtils.scala:273)
    at kafka.server.KafkaConfig.advertisedListeners(KafkaConfig.scala:1842)
    at kafka.server.KafkaConfig.validateValues(KafkaConfig.scala:1948)
    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)
Caused by: java.lang.IllegalArgumentException: No security protocol defined for listener INTERNAL
    at kafka.cluster.EndPoint$.$anonfun$createEndPoint$2(EndPoint.scala:48)
    at scala.collection.immutable.Map$Map4.getOrElse(Map.scala:530)
    at kafka.cluster.EndPoint$.securityProtocol$1(EndPoint.scala:48)
    at kafka.cluster.EndPoint$.createEndPoint(EndPoint.scala:56)
    at kafka.utils.CoreUtils$.$anonfun$listenerListToEndPoints$6(CoreUtils.scala:270)
    at scala.collection.StrictOptimizedIterableOps.map(StrictOptimizedIterableOps.scala:99)
    at scala.collection.StrictOptimizedIterableOps.map$(StrictOptimizedIterableOps.scala:86)
    at scala.collection.mutable.ArraySeq.map(ArraySeq.scala:37)
    at kafka.utils.CoreUtils$.listenerListToEndPoints(CoreUtils.scala:270)
    ... 7 more

我的server.properties配置如下:

listeners=PLAINTEXT://172.21.0.1:9092
advertised.listeners=INTERNAL://192.168.40.174:9092

请问我该如何解决?



添加评论

参数值必须为listeners中定义的某个listener或者对应name的listener在listeners中的定义使用了0.0.0.0作为host,在advertised.listeners中可以指定某个网卡ip。

所以,你需要改成

listeners=PLAINTEXT://172.21.0.1:9091,INTERNAL://172.21.0.1:9092
advertised.listeners=INTERNAL://172.21.0.1:9091
listener.security.protocol.map=INTERNAL:PLAINTEXT,PLAINTEXT:PLAINTEXT
你的答案

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

找不到想要的答案?提一个您自己的问题。

我要提问
提问