Closed holgerbrandl closed 5 years ago
The quickstart is only intended for single machine configurations, and not expected to work when another machine is introduced.
That being said, on port 9092, the advertised listeners hostname is localhost
.
On port 29092, the advertised listeners is broker
.
If you'd like all client requests to be routed over the Docker network to the broker service, use port 29092
If you'd like services to communicate with host dddocker02, you need an advertised listener with that hostname in it
When using the local quickstart mode, broker access from another host is working without any issues using the default 9092 port. So the problem is tied to the docker deployment mode (which makes it a bug imho).
If broker access is limited by design to only the docker host (which would be a rather odd design imho), it should be maybe made much more clear in the docker quickstart docs?
I'd say it's not a bug; it's a (lack of) networking configuration.
Running Kafka outside of Docker works better because Kafka's source code sets up the advertised listeners to be the externally resolvable address such that other systems in your LAN can reach. When you add the Docker bridge network in there, and Kafka doesn't know it's in a container, then it's isolated to that network unless otherwise configured. A simple port forwarding will not work.
If you'd like the same behavior from Docker, you'd have to adjust one configuration that is very specific to your own system / environment to include your own IP/Hostname.
Since confluent UI is accessible from other non-docker-host machines, it gives the incorrect impression that the quickstart docker deployment is fully functional.
Is the additional configuration which would be necessary to enable communication from other hosts with a dockerized quickstart-broker documented in the manual (or elsewhere)? I'd guess, it's not just me having some basic idea about kafka and docker, but struggling with setting up such networking details.
A UI of static html doesn't necessarily mean that each backing API or system is responsive and healthy.
Yes, advertised.listeners
is documented in the Kafka documentation as well as within the server.properties file.
And no, it's not just you. The same problem is seemingly posted multiple times per week on Stackoverflow. And it prompted a blog https://www.confluent.io/blog/kafka-listeners-explained
But there's no good place to really consolidate the information - the quickstart is simply to get it all working locally, as a POC or demo, but I agree it could have a note saying as much. If you really want to scale it out, there's obvious networking considerations that need taken into account
Thanks for sharing this article. It perfectly described the underlying kafka concepts and detailed out the solution of my issue (which was simply to replace localhost
with the actual hostname of the docker host in the yaml).
When using the quickstart protocol to deploy a local cluster with
the broker can be used on the same host with
But when trying to use the broker from a different machine (dddocker02 is the hostname where the docker confluent deployment is runnig it fails with:
Could this be a an issue with the docker deployment?
The port binding seems fine
For completeness here's the docker ps info