I´m starting with Apache Kafka and i´m facing problems when i try to conect from an external machine.
With this configuration bellow, all works fine if the application and the docker are running at the same machine.
but when i put the application in machine A and docker at machine B, the application cant connect.
My spring Kafka @Configuration have this line to @Bean consumerFactory and producerFactory (imagine my machine with docker ip = 10.10.10.10)
props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, "10.10.10.10:9092");
And my docker file is 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 get this error:
org.springframework.kafka.core.KafkaProducerException: Failed to send;
nested exception is org.apache.kafka.common.errors.TimeoutException:
Expiring 1 record(s) for
Edit, add some information..
I think its any configuration about the zookeeper i´m missing .. because if i have only the zookeeper started at my machine A .. and the kafka in machine B.. that works.. i only don´t know how :(