kafka-docker
kafka-docker copied to clipboard
New install, `Connection to node 1005 (/172.19.0.2:64289) could not be established. Broker may not be available`
Starting kafka via:
$ docker-compose up
Gives me the above error, after:
- Cloning the repo from fresh
- Changing the line
KAFKA_ADVERTISED_HOST_NAME: 192.168.99.100
toHOSTNAME_COMMAND: "ip a | grep inet | grep -v 127 | awk '{print $$2}' | awk -F/ '{print $$1}'"
(I've pasted a patch to this issue to show precisely what I have done)
My use case is pretty simple- I have a series of containers I want to access kafka. They will attach to the network that docker-compose creates (kafka-docker_default
by default), and access kafka through there, by using kafka-docker_kafka_1
as the initial broker.
Is this not possible? Is there a smarter way to accomplish what I want to accomplish? I've verified inside the container that this command correctly returns the correct IP address.
I note that if I set KAFKA_ADVERTISED_HOST_NAME
to the IP 172.19.0.2
specifically (and get lucky on containers starting in the correct order, getting the correct address, and some other reason I don't follow) then the logs are clear and everything works as I want it to.
Am I misunderstanding the docs? Does HOSTNAME_COMMAND
not do what i'm trying to get it to do?
diff --git a/docker-compose.yml b/docker-compose.yml
index 30ad6c4..d7e3dbe 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -10,7 +10,7 @@ services:
- "9092"
environment:
DOCKER_API_VERSION: 1.22
- KAFKA_ADVERTISED_HOST_NAME: 192.168.99.100
+ HOSTNAME_COMMAND: "ip a | grep inet | grep -v 127 | awk '{print $$2}' | awk -F/ '{print $$1}'"
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
volumes:
- /var/run/docker.sock:/var/run/docker.sock
did you ever find a fix for this?
Are there any news about this?
use confluent's kafka image...works right out of the box. @dibericky
This image also works out of the box if the listeners are used instead of advertised host/port