Closed cojack closed 7 years ago
Hi @cojack
Kafka has a concept of advertised host, and when you talk to kafka, it will ask you to communicate using the advertised host (all of that is done by the client). So as I set the advertised host to kafka1
for the first broker, when your programs connect to kafka1
, they actually need to know that is also means localhost, hence the /etc/hosts
file changes.
Makes sense?
It's also very much due to how docker handles networking, as every machine inherits a hostname and knows about each other within their network, but not the host machine
@simplesteph nope I does not explain me anything xD But don't worry, I don't have to know everything, just figured out that npm package no-kafka allows me to redirect brokers so I just map kafka{N} to correct host without touching the /etc/hosts files. Thanks a lot for your work with this easy docker kafka setup!
@simplesteph could you explain to me why do I have to change hosts file on machine where I run app that connect to kafka? I guess it's only required for HOST where kafka is running.