Error creating broker listeners from 'PLAINTEXT://172.23.15.130:9092': No security protocol defined for listener PLAINTEXT at

啊啊 发表于: 2024-11-04   最后更新时间: 2024-11-05 10:10:51   178 游览
Exception in thread "main" java.lang.IllegalArgumentException: Error creating broker listeners from 'PLAINTEXT://172.23.15.130:9092': No security protocol defined for listener PLAINTEXT at kafka.utils.CoreUtils$.listenerListToEndPoints(CoreUtils.scala:216) at kafka.server.KafkaConfig.effectiveAdvertisedListeners(KafkaConfig.scala:1138) at kafka.server.KafkaConfig.validateValues(KafkaConfig.scala:1262) at kafka.server.KafkaConfig.<init>(KafkaConfig.scala:1223) at kafka.server.KafkaConfig.<init>(KafkaConfig.scala:545) at kafka.tools.StorageTool$.$anonfun$execute$1(StorageTool.scala:72) at scala.Option.flatMap(Option.scala:283) at kafka.tools.StorageTool$.execute(StorageTool.scala:72) at kafka.tools.StorageTool$.main(StorageTool.scala:53) at kafka.docker.KafkaDockerWrapper$.main(KafkaDockerWrapper.scala:48) at kafka.docker.KafkaDockerWrapper.main(KafkaDockerWrapper.scala) Caused by: java.lang.IllegalArgumentException: No security protocol defined for listener PLAINTEXT at kafka.cluster.EndPoint$.$anonfun$createEndPoint$2(EndPoint.scala:49) at scala.collection.mutable.HashMap.getOrElse(HashMap.scala:451) at kafka.cluster.EndPoint$.securityProtocol$1(EndPoint.scala:49) at kafka.cluster.EndPoint$.createEndPoint(EndPoint.scala:57) at kafka.utils.CoreUtils$.$anonfun$listenerListToEndPoints$10(CoreUtils.scala:213) at scala.collection.StrictOptimizedIterableOps.map(StrictOptimizedIterableOps.scala:100) at scala.collection.StrictOptimizedIterableOps.map$(StrictOptimizedIterableOps.scala:87) at scala.collection.convert.JavaCollectionWrappers$JListWrapper.map(JavaCollectionWrappers.scala:138) at kafka.utils.CoreUtils$.listenerListToEndPoints(CoreUtils.scala:213) ... 10 more

我的配置如下:

advertised.listeners=PLAINTEXT://172.23.198.184:9092
listeners=SASL_PLAINTEXT://:9092,CONTROLLER://:9093
transaction.state.log.min.isr=1
controller.quorum.voters=0@kafka-raft-0.kafka-hs:9093,1@kafka-raft-1.kafka-hs:9093,2@kafka-raft-2.kafka-hs:9093
transaction.state.log.replication.factor=1
sasl.enabled.mechanisms=PLAIN
node.id=0
group.initial.rebalance.delay.ms=0
process.roles=broker,controller
log.dirs=/tmp/kraft-combined-logs
listener.security.protocol.map=CONTROLLER:PLAINTEXT,SASL_PLAINTEXT:SASL_PLAINTEXT
inter.broker.listener.name=SASL_PLAINTEXT
sasl.mechanism.inter.broker.protocol=PLAIN
controller.listener.names=CONTROLLER
sasl.mechanism.controller.protocol=PLAIN

请问是什么问题?

发表于 2024-11-04

Error creating broker listeners from 'PLAINTEXT://172.23.15.130:9092': No security protocol defined for listener

这是你对外暴露的策略:

advertised.listeners=PLAINTEXT://172.23.198.184:9092

你有效的是,SASL_PLAINTEXTCONTROLLER

listeners=SASL_PLAINTEXT://:9092,CONTROLLER://:9093

所以,你把PLAINTEXT换成有效的SASL_PLAINTEXTCONTROLLER 就可以了,如:

advertised.listeners=SASL_PLAINTEXT://172.23.198.184:9092
你的答案

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