这就是我的docker文件的样子,
version: "3.9"
services:
zookeeper:
image: 'bitnami/zookeeper:latest'
ports:
- '2181:2181'
environment:
- ALLOW_ANONYMOUS_LOGIN=yes
kafka:
image: 'bitnami/kafka:latest'
ports:
- '9092:9092'
- '9093:9093'
environment:
- KAFKA_BROKER_ID=1
- KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=CLIENT:PLAINTEXT,EXTERNAL:PLAINTEXT
- KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,EXTERNAL://:9093
- KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://127.0.0.1:9092,EXTERNAL://localhost:9093
- KAFKA_CFG_ZOOKEEPER_CONNECT=zookeeper:2181
- ALLOW_PLAINTEXT_LISTENER=yes
- KAFKA_CFG_INTER_BROKER_LISTENER_NAME=CLIENT
- KAFKA_ZOOKEEPER_PROTOCOL=PLAINTEXT
depends_on:
- zookeeper
当我运行下面的docker文件是错误的,我得到
kafka_1 | [2022-09-05 18:51:52,189] INFO Registered kafka:type=kafka.Log4jController MBean (kafka.utils.Log4jControllerRegistration$)
kafka_1 | [2022-09-05 18:51:54,618] INFO Setting -D jdk.tls.rejectClientInitiatedRenegotiation=true to disable client-initiated TLS renegotiation (org.apache.zookeeper.common.X509Util)
kafka_1 | [2022-09-05 18:51:54,810] ERROR Exiting Kafka due to fatal exception (kafka.Kafka$)
kafka_1 | java.lang.IllegalArgumentException: Error creating broker listeners from 'PLAINTEXT://127.0.0.1:9092,EXTERNAL://localhost:9093': No security protocol defined for listener PLAINTEXT
kafka_1 | at kafka.utils.CoreUtils$.listenerListToEndPoints(CoreUtils.scala:273)
kafka_1 | at kafka.server.KafkaConfig.effectiveAdvertisedListeners(KafkaConfig.scala:1924)
kafka_1 | at kafka.server.KafkaConfig.validateValues(KafkaConfig.scala:2033)
kafka_1 | at kafka.server.KafkaConfig.<init>(KafkaConfig.scala:1997)
kafka_1 | at kafka.server.KafkaConfig.<init>(KafkaConfig.scala:1471)
kafka_1 | at kafka.server.KafkaConfig$.fromProps(KafkaConfig.scala:1394)
kafka_1 | at kafka.Kafka$.buildServer(Kafka.scala:67)
kafka_1 | at kafka.Kafka$.main(Kafka.scala:87)
kafka_1 | at kafka.Kafka.main(Kafka.scala)
我已经按照下面码头工人帮助中提到的说明进行了操作
https://hub.docker.com/r/bitnami/kafka/
请告诉我该怎么修?
您的错误很可能来自KAFKA_CFG_INTER_BROKER_LISTENER_NAME=CLIENT
或KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=CLIENT:PLAINTEXT
您尚未将CLIENT
定义为侦听器。
此外,您发布的两个侦听器都是localhost。使用IP地址不会改变这一点。。。bitnami Kafka容器自述中有如何分离内部和外部侦听器地址的说明
我按照本页的说明进行了操作,它按预期工作,
https://developer.confluent.io/quickstart/kafka-docker/