1

It will be 6 hours now that I'm trying to access to kafka with my spring producer (which I launch on local machine). When I start producer I got this issue :

WARN 16800 --- [| adminclient-1] org.apache.kafka.clients.NetworkClient   : [AdminClient clientId=adminclient-1] Error connecting to node 2dd34aa10a8e:9092 (id: 0 rack: null)
java.net.UnknownHostException: 2dd34aa10a8e

Where 2dd34aa10a8e is the container id (kafka)

Next is my producer properties :

spring.kafka.producer.bootstrap-servers=localhost:9092

For kafka, I'm using the ubuntu/kafka image from docker hub https://hub.docker.com/r/ubuntu/kafka (same for zookeeper https://hub.docker.com/r/ubuntu/zookeeper)

I'm using docker desktop and wsl2

I'm trying to make communicate producers with kafka

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
Farfetch'd
  • 110
  • 7
  • Please, ensure you are running your container with the correct `network_mode` and exposing the port `correctly`. Also, Kafka depends on Zookeeper. Is it up too? I don't think Zookeeper is included in the Kafka container. – Marco Frag Delle Monache May 04 '23 at 15:43
  • 1
    @MarcoFragDelleMonache Yes zookeeper is not included inside ubuntu/kafka image so I also build aan another container with ubuntu/zookeeper image. By default bridge is the default network driver (which is the network mode I should use ) so I should be able to connect my kafka container with my spring boot producer, isn't it ? – Farfetch'd May 05 '23 at 08:52
  • I hope so.. maybe you have to specify the zookeeper host to kafka – Marco Frag Delle Monache May 05 '23 at 12:11
  • 1
    Do not use the Ubuntu/kafka image. It does not allow you to configure the necessary properties from environment variables – OneCricketeer May 05 '23 at 13:56
  • Also, Zookeeper is no longer required for Kafka – OneCricketeer May 05 '23 at 13:57

0 Answers0