kafka报Invalid security protocol `PLAINTEXT1` defined in listener.security.protocol.map

啊啊 发表于: 2021-09-28   最后更新时间: 2021-09-28 19:11:19   1,599 游览

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

ERROR Exiting Kafka due to fatal exception (kafka.Kafka$)
org.apache.kafka.common.config.ConfigException: Invalid security protocol PLAINTEXT1 defined in listener.security.protocol.map

错误详情:

[2021-09-28 10:38:21,708] INFO Registered kafka:type=kafka.Log4jController MBean (kafka.utils.Log4jControllerRegistration$)
[2021-09-28 10:38:22,161] INFO Setting -D jdk.tls.rejectClientInitiatedRenegotiation=true to disable client-initiated TLS renegotiation (org.apache.zookeeper.common.X509Util)
[2021-09-28 10:38:22,226] ERROR Exiting Kafka due to fatal exception (kafka.Kafka$)
org.apache.kafka.common.config.ConfigException: Invalid security protocol `PLAINTEXT1` defined in listener.security.protocol.map
    at kafka.server.KafkaConfig.getSecurityProtocol(KafkaConfig.scala:1882)
    at kafka.server.KafkaConfig.$anonfun$listenerSecurityProtocolMap$1(KafkaConfig.scala:1889)
    at scala.collection.Iterator$$anon$9.next(Iterator.scala:575)
    at scala.collection.mutable.Growable.addAll(Growable.scala:62)
    at scala.collection.mutable.Growable.addAll$(Growable.scala:57)
    at scala.collection.immutable.MapBuilderImpl.addAll(Map.scala:692)
    at scala.collection.immutable.Map$.from(Map.scala:643)
    at scala.collection.immutable.Map$.from(Map.scala:173)
    at scala.collection.MapOps.map(Map.scala:299)
    at scala.collection.MapOps.map$(Map.scala:299)
    at scala.collection.AbstractMap.map(Map.scala:405)
    at kafka.server.KafkaConfig.listenerSecurityProtocolMap(KafkaConfig.scala:1888)
    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://172.21.0.1:9092
advertised.listeners=PLAINTEXT1://172.21.0.1:9091
listener.security.protocol.map=PLAINTEXT:PLAINTEXT1

请问我该如何解决?

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

你写反了,应该是:

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

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