Kafka Listeners
While developing in a Docker environment it’s important to get a good understanding of Kafka listeners / advertised listeners. This notion is really well explained in this article: Kafka Listeners Explained
You need to set advertised.listeners (or
KAFKA_ADVERTISED_LISTENERS
if you’re using Docker images) to the external address (host/IP) so that clients can correctly connect to it. Otherwise, they’ll try to connect to the internal host address—and if that’s not reachable, then problems ensue.
You can also use this Github repository to play around with this notion: