This is how my docker file looks like,
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
When I run the docker file below is the error I am getting
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)
I have followed the instructions mentioned at below docker help,
https://hub.docker.com/r/bitnami/kafka/
Please advise how can I fix it?
CodePudding user response:
I followed the instructions at this page and it worked as expected,
https://developer.confluent.io/quickstart/kafka-docker/
CodePudding user response:
Your error is most likely coming from KAFKA_CFG_INTER_BROKER_LISTENER_NAME=CLIENT
.
You've not defined CLIENT
as a listener.
Also, both of your advertised listeners are localhost. Using an IP address doesn't change that... The bitnami Kafka container readme has instructions how to separate internal and external listener addresses