spring - cant connect to kafka from external machine -


i´m starting apache kafka , i´m facing problems when try conect external machine.

with configuration bellow, works fine if application , docker running @ same machine.

but when put application in machine , docker @ machine b, application cant connect.

my spring kafka @configuration have line @bean consumerfactory , producerfactory (imagine machine docker ip = 10.10.10.10)

props.put(consumerconfig.bootstrap_servers_config, "10.10.10.10:9092"); 

and docker file this:

version: '2' services: zookeeper:     image: wurstmeister/zookeeper:3.4.6     ports:       - 2181:2181 kafka:     image: wurstmeister/kafka:0.10.1.1     environment:         kafka_advertised_host_name: 0.0.0.0         kafka_advertised_port: 9092         kafka_zookeeper_connect: zookeeper:2181         kafka_create_topics: "topic-jhipster:1:1,process_order:1:1, process_channel:1:1"         jmx_port: 9999         kafka_jmx_opts: "-dcom.sun.management.jmxremote -dcom.sun.management.jmxremote.authenticate=false -dcom.sun.management.jmxremote.ssl=false -djava.rmi.server.hostname=127.0.0.1 -dcom.sun.management.jmxremote.rmi.port=9999"     ports:         - 9092:9092         - 9999:9999 kafka-manager:     image: sheepkiller/kafka-manager     ports:         - 9000:9000     links:         - zookeeper     environment:         zk_hosts: zookeeper:2181 

i error:

org.springframework.kafka.core.kafkaproducerexception: failed send; nested exception org.apache.kafka.common.errors.timeoutexception:  expiring 1 record(s) 

edit, add information..

i think configuration zookeeper i´m missing .. because if have zookeeper started @ machine .. , kafka in machine b.. works.. don´t know how :(

try setting listeners,

eg: listeners = plaintext://your.host.name:9092 

assuming can telnet between machines on kafka port.


Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -