fix: change advertised listeners#112
Conversation
Signed-off-by: yasin <yasin.lachiny@gmail.com>
|
Can you please provide more infos about your setup?
|
|
Thank you for your response @charlescd root@yasin:~# lsb_release -d
Description: Ubuntu 22.04 LTS2- root@yasin:~# docker -v
Docker version 20.10.17, build 100c701
root@yasin:~# docker compose version
Docker Compose version v2.6.03- I am using Docker for Linux. 4- For reproducing the error: root@yasin:~# git clone https://github.com/conduktor/kafka-stack-docker-compose.git
root@yasin:~# cd kafka-stack-docker-compose/
root@yasin:~/kafka-stack-docker-compose# docker compose -f zk-multiple-kafka-multiple.yml up -d
root@yasin:~/kafka-stack-docker-compose# docker exec -it kafka1 bash
[appuser@kafka1 ~]$ kafka-topics --create --bootstrap-server localhost:9092 --topic test --partitions 3 --replication-factor 3
[2022-07-10 20:06:27,044] WARN [AdminClient clientId=adminclient-1] Connection to node 3 (/127.0.0.1:9094) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
[2022-07-10 20:06:27,088] WARN [AdminClient clientId=adminclient-1] Connection to node 3 (/127.0.0.1:9094) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
[2022-07-10 20:06:27,188] WARN [AdminClient clientId=adminclient-1] Connection to node 3 (/127.0.0.1:9094) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
root@yasin:~/kafka-stack-docker-compose# docker exec -it kafka2 bash
[appuser@kafka2 ~]$ kafka-topics --create --bootstrap-server localhost:9093 --topic test --partitions 3 --replication-factor 3
[2022-07-10 20:11:25,188] WARN [AdminClient clientId=adminclient-1] Connection to node 3 (/127.0.0.1:9094) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
[2022-07-10 20:11:25,224] WARN [AdminClient clientId=adminclient-1] Connection to node 1 (/127.0.0.1:9092) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
[2022-07-10 20:11:25,247] WARN [AdmiIf we export I tested it from all containers and also from outside of the container and it didn't work. It makes sense because It will advertise [appuser@kafka2 ~]$ kafka-topics --create --bootstrap-server kafka2:19093 --topic test --partitions 3 --replication-factor 3
Created topic test.My host network IP is [appuser@kafka2 ~]$ kafka-topics --create --bootstrap-server 203.0.113.168:9093 --topic test2 --partitions 3 --replication-factor 3
[2022-07-10 20:17:45,879] WARN [AdminClient clientId=adminclient-1] Connection to node 3 (/127.0.0.1:9094) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
[2022-07-10 20:17:45,948] WARN [AdminClient clientId=adminclient-1] Connection to node 3 (/127.0.0.1:9094) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
[2022-07-10 20:17:46,034] WARN [AdminClient clientId=adminclient-1] Connection to node 3 (/127.0.0.1:9094) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient) |
|
There are 2 options: In both options, |
96d41b0 to
971e501
Compare
74bda0e to
2028c4f
Compare
|
Hi @shounakchandra007 , |
|
I approved the changes @yasinlachiny |
|
@shounakchandra007 Thank you a lot. |
Can you please check your mail and revert me back, if possible |
|
I had the same error, because I didn't specify |
|
For anyone working on MacOS this worked for me: export DOCKER_HOST_IP=$(ifconfig en0 | grep inet | grep -v inet6 | awk '{print $2}')
docker compose up |
DOCKER_HOST_IPhas a default environment variable.It will create problems in multiple Kafka if you didn't specify
DOCKER_HOST_IP.KAFKA_ADVERTISED_LISTENERSwill be127.0.0.1:9092 , 127.0.0.1:9093, 127.0.0.1:9094and if you want to connect for example from kafka1 or outside the cluster the Kafka will return for example
127.0.0.1:9094and for sure it is not accessible from kafka1 or outside of the cluster.
If we specify
DOCKER_HOST_IPeverything would work fine but if we didn't specifyDOCKER_HOST_IPthe cluster wouldn't work.Signed-off-by: yasin yasin.lachiny@gmail.com