-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Docker swarm - Cannot connect to kafka from outside #432
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This looks more like a Docker swarm question, rather than a kafka-docker image issue. It would help to include more information, such as the steps that are failing for you (e.g. commands that run) along with their log output and logs from the brokers etc. Also probably information on your swarm setup (nodes, OS etc) Looking at the port + hostname config - i'm not sure it looks correct. Given you're using the direct publishing of ports on every swarm node, i'm not sure how that relates to the value of |
I am able to create the swarm without any issues issues. The problem is i cannot Error
However i can do the below This means that i am able to connect to the Zookeeper cluster from outside, however i cannot connect to the kafka cluster from outside. Also I can connect to the cluster of zookeeper in yahoo/kafka-manager |
I'm not questioning how you create swarm. I'm just stating that it could be relevant for anyone trying to help you. For example, the way that you've structured the port allocation would indicated your running on a single node cluster (which would be advised against in a production environment. Also there is no pinning of broker to node, and therefore no pinning of broker to disk etc). Regarding connectivity; As you can see from the error message, the client has been told to connect to As you have only configured swarm node port mapping from ports 9092,9093 and 9094 this means that only one of your brokers is correctly addressable from the outside. In a vastly simplified example, you have defined a comparable setup to the following:
port-forwarding is configured to map However, as far as a Kafka client is concerned, during bootstrap it will retrieve the metadata information which will tell it to connect to
You will need to address at least both of those problems to move forward. It might also be worth looking through some of the other docker-swarm tagged issues (https://github.com/wurstmeister/kafka-docker/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3Adocker-swarm+) as other people have posted their configs. |
I am still not sure what should I do, How do i satisfy my purpose |
As per my above comment, you will need to make sure your advertised host is resolvable publicly (currently it isn't) and also publish the correct ports (to match the ones that are being advertised).
NOTE: I would recommend starting with a 1 node cluster and getting that working to make sure you are familiar with the operational aspects. Use the relevant documentation for the version you are running. However, this question is a more general Kafka configuration issues as opposed to a bug with the Kafka-docker image. I would suggest posting any further questions to the Kafka Mailing List which has a much broader support base. Also, for issues with Swarm you can ask on the Swarm forum. Good luck! p.s. Please re-open if you think there is a bug with the kafka-docker image. Thanks. |
Answering another ticket reminded me of this open PR: #377. It won't fix all your issues, but if may help you for the |
For docker swarm, I used the following command and it worked like a charm |
Hi @enricodvn and @njpsanghani , I encountered exactly the same issue, even I do tried the command you suggested. My env as following
Any idea ? |
original title: Cannot connect to kafka from outside
I have created this docker-compose file
running it using
docker stack deploy -c stack.yml zookeeper
The problem is the kafka cluster is not accessible from outside, what should i do.
i.e I can see the cluster using yahoo/kafka-manager, the zookeeper-s are visible hence i can create , list topic from outside, I cannot directly connect to the zookeeper cluster where needed like the console producer/consumer from host machine
The text was updated successfully, but these errors were encountered: