Possible typo in the kafka listeners configuration in rmoff's blog?

If you are starting learning Kafka, like me, you might be familiar with the extremely informative Robin Mofatt’s blog, https://rmoff.net . While informing myself about Kafka listeners in his blog post:

I saw the following listener configuration for the Docker container environment:
KAFKA_LISTENERS: LISTENER_BOB://kafka0:29092,LISTENER_FRED://localhost:9092.

In this example the LISTENER_BOB is a kafka broker client, internal to the docker network, whereas LISTENER_FRED is an external client. My question is, assuming the docker network where kafka sits in is the usual bridge, and that I am mapping the kafka:9092 to localhost:9092 , shouldn’t the LISTENER_FRED listener still be configured as ‘kafka:9092’ but advertised to ‘localhost:9092’?

Thanks and kind regards,
Daniel

@dcguim I haven’t tested but I think either of these will work in this situation. If I understand correctly, the reason localhost works in this case is a nuance of Docker networking where if you had this configuration on a standard machine the localhost binding would not accept external connections.

Robin does go on to say:

KAFKA_LISTENERS is a comma-separated list of listeners, and the host/ip and port to which Kafka binds to on which to listen. For more complex networking this might be an IP address associated with a given network interface on a machine. The default is 0.0.0.0, which means listening on all interfaces.

Not sure I’ve helped :wink: but thanks for the question

+1 to what @rick said :slight_smile:

There’s a more recent version of this post that’s basically variations on the same theme, but perhaps might shed more light: Why Can’t I Connect to Kafka? | Troubleshoot Connectivity