Interact with kafka docker container from outside of docker host -
i have built kafka docker container , orchestrate using docker-compose.
calling docker ps
following putput:
container id image command created status ports names 5bde6f76246e hieutrtr/docker-kafka:0.0.1 "/start.sh" hour ago hour 7203/tcp, 0.0.0.0:32884->9092/tcp dockerkafka_kafka_3 be354f1b8cc0 hieutrtr/docker-ubuntu:devel "/usr/bin/supervisor hour ago hour 22/tcp producer1 50d3203af90e hieutrtr/docker-kafka:0.0.1 "/start.sh" hour ago hour 7203/tcp, 0.0.0.0:32883->9092/tcp dockerkafka_kafka_2 61b285f39615 hieutrtr/docker-kafka:0.0.1 "/start.sh" 2 hours ago 2 hours 7203/tcp, 0.0.0.0:32882->9092/tcp dockerkafka_kafka_1 20c9c5ccec05 jplock/zookeeper:3.4.6 "/opt/zookeeper/bin/ 2 hours ago 2 hours 2888/tcp, 3888/tcp, 0.0.0.0:32881->2181/tcp dockerkafka_zookeeper_1
i can run producer , consumer inside docker container, not working outside docker network.
for example:
i run kafka producer on localhost , following error appears:
$ kafka_2.9.1-0.8.2.1: bin/kafka-console-producer.sh --topic test --broker-list $docker_host:32884 [2015-08-31 06:55:15,450] warn property topic not valid (kafka.utils.verifiableproperties) [2015-08-31 06:55:20,214] warn failed send producer request correlation id 2 broker 1 data partitions [test,0] (kafka.producer.async.defaulteventhandler) java.nio.channels.closedchannelexception @ kafka.network.blockingchannel.send(blockingchannel.scala:100) @ kafka.producer.syncproducer.liftedtree1$1(syncproducer.scala:73) @ kafka.producer.syncproducer.kafka$producer$syncproducer$$dosend(syncproducer.scala:72) @ kafka.producer.syncproducer$$anonfun$send$1$$anonfun$apply$mcv$sp$1.apply$mcv$sp(syncproducer.scala:103) @ kafka.producer.syncproducer$$anonfun$send$1$$anonfun$apply$mcv$sp$1.apply(syncproducer.scala:103) @ kafka.producer.syncproducer$$anonfun$send$1$$anonfun$apply$mcv$sp$1.apply(syncproducer.scala:103)
this kafka docker example on github includes mentioned problem.
so, experiencing same problems , can me in way?
additional info:
(just fork ches/kafka , modify docker-compose) :
in kafka server properties need set advertised.host.name
, advertised.port
to ip/port of running container , should work.
Comments
Post a Comment