-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Unable to consume/produce data in Kafka Docker Swarm Mode #376
Comments
You've specified |
@sscaling Do I have to give brokers as "OUTSIDE://quad.cmp.com:9094" OR only "quad.cmp.com:9094" to consumers/producers services? Because I am unable to produce/consume messages when I pass "quad.cmp.com:9094" to producers/consumers services. Also do I need to publish 9094 port in producer/consumers services? Thanks, |
brokers should connect via I'm not sure about your usage of 'global' the example file already contains the ports in host networking mode which implies that only one service can be run on each node. Also, if you are running multiple brokers each broker should have a unique OUTSIDE host name otherwise the broker will advertise the same address for each partition's metadata. |
In link : https://hub.docker.com/r/wurstmeister/kafka/ it is mentioned for swarm mode use "global" deployment. But now again I tried without global mode, still I am not able to connect my consumer/producer services to kafka brokers. Also each Kafka broker has unique OUTSIDE hostname. Is there any need to publish 9094 port & set host mode in my producer/consumer services too? Thanks, |
(just as a note, that documentation doesn't get updated anymore - there is a ticket open to manually update it to link to the up-to-date readme on github)
no Looking at the docker swarm documentation I guess it depends what you want to do. If you want to run on all nodes then global is fine but the cluster will be scaled with the number of swarm nodes (for me the number of kafka brokers and swarm nodes should be independent). Refs:
Try some basic networking debugging - can each of the nodes resolve the other node by the name supplied? assuming you have something like kafka.host1.com and kafka.host2.com
If you post the log output of the producer/consumer and brokers when trying to send/receive messages I can take a quick look. |
Hi, Attached is the log file of kafka broker. I tried pinging from consumer and producer services to kafka brokers, but got following error:
But I am able to ping by ip address of host machine running kafka broker from within consumer/producer services Also I checked /etc/hosts file on host machine for node name mapping, it contains following details :
What might be the issue? Thanks, |
You didn't include the producer/consumer logs (only the broker) so there's only one half of the communication path to look at. That looks OK (other than the warning about the topic name containing an underscore). If consumer and producer cannot resolve the broker address then there is no way for them to connect. What producer / consumer are you using? How are they run? inside the docker network or from your host machine? |
|
The Exception looks to be in
I would suggest using basic consumer to validate that kafka is configured correctly without having to configure a full distributed system such as ignite. Once that is working, then try move onto a more complex system. I'm not sure how you determine that messages are not produced in Kafka if you can't read from it. If clients are inside the docker network, I'm not sure they will have any knowledge of the hosts /etc/hosts file - the docker cli normally uses |
Hi @sscaling I am checking messages produced in topic using kafka manager service " I checked by adding "host-machine-name:ipaddress" mapping using "extra_hosts" parameter in docker-compose. But still consumer and producer containers are unable to resolve my host-machine-name[Unable to ping Kafka broker by host-machine-name either from producer/consumer]. In docker configuration what does command Thanks, |
If you want to see what If this does not have a resolvable name from the other nodes (e.g. statically / via DNS) then it won't be routable from other nodes without addressing this issue. Also, as your producers/consumers run within docker, the address will need to be resolvable from inside the containers. From what you've described, it seems like you have a fundamental Swarm / networking setup. I'd recommend posting on the Docker forums for more help if you haven't found the solution by now. Also, make sure the firewall is disabled when testing this to rule that out as the problem. (Enable again after any testing) |
Hi @sscaling , Is it posssible to use KAFKA_ADVERTISED_HOST_NAME INSTEAD of listeners? and use it as follows? for launching one Kafka broker per host machine in swarm mode?
with these settings it gives error :
Thanks, |
Yes (https://kafka.apache.org/documentation/#brokerconfigs) it's deprecated, but still supported - even in Kafka 2.0.
It depends on your host and Swarm networking and security configuration.
Fundamentally means that that component can't talk to the location you've specified. So you need to address that first - As far as I am aware this is not a kafka-docker image issue, this is a system configuration issue. |
you can change this line HOSTNAME_COMMAND: "docker info | grep 'Node Address:' | cut -d' ' -f 4" |
I am deploying kafka cluster on swarm docker cluster. I am running example at https://github.com/wurstmeister/kafka-docker/blob/master/docker-compose-swarm.yml with deploy mode as "global". But in Kafka config values I get null advertized hostname as below:
[2018-08-02 09:13:26,029] INFO KafkaConfig values:
advertised.host.name = null
advertised.listeners = INSIDE://:9092,OUTSIDE://quad.cmp.com:9094
advertised.port = null
alter.config.policy.class.name = null
alter.log.dirs.replication.quota.window.num = 11
alter.log.dirs.replication.quota.window.size.seconds = 1
authorizer.class.name =
auto.create.topics.enable = true
auto.leader.rebalance.enable = true
background.threads = 10
broker.id = -1
broker.id.generation.enable = true
broker.rack = null
client.quota.callback.class = null
compression.type = producer
Due to this my other services are unable to produce data and consume data from these kafka brokers.
In my kafka consumer & producer settings I give brokers ip addresses as : hostname_of_machine1:9092, hostname_of_machine2:9092 for reading from and producing to these kafka brokers.
What is the issue?
Thanks,
Rishikesh
The text was updated successfully, but these errors were encountered: