kafka: Connection to node 1001 could not be established. Broker may not be available

Viewed 3479

I started zookeeper and kafka container using below commands in CentOS 7.9:

docker run -it -d --net=sup-network  --name zookeeper --ip 200.100.0.140 -p 2181:2181  zookeeper:3.7.0

docker run -it --net=sup-network --name kafka -p 9092:9092 \
-e KAFKA_ZOOKEEPER_CONNECT=200.100.0.140:2181 \
-e KAFKA_LISTENERS=PLAINTEXT://0.0.0.0:9092 \
-e KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://200.100.0.141:9092 \
-e ALLOW_PLAINTEXT_LISTENER=yes \
-d bitnami/kafka:3.0.0

The 200.100.0.xxx ips are defined in docker swarm.

But kafka consistently gave below logs:

 WARN [Controller id=1001, targetBrokerId=1001] Connection to node 1001 (/200.100.0.141:9092) 
could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)

How to fix it out?


additional info:

I removed -e KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://200.100.0.141:9092 \, then kafka didn't give Broker may not be available log info. But why there're so many posts suggest that this line should be added?

0 Answers
Related