Skip to content
Advertisement

running Kafka on WSL and make producer on windows

I’m running Kafka on WSL. I’m trying to make simple producer like this (I’m using intellj)

JavaScript

but there’s a problem, when I try to run the code it shows this error

JavaScript

i even checked the port on my Windows

JavaScript

my question is, is it impossible to make producer on windows and while running kafka on WSL ?

Advertisement

Answer

Your Kafka broker is using the local hostname (AD17-2.localdomain) in its advertised listener. When you client connects to it initially on 127.0.0.1:9092 the broker returns this address for it to connect to for producing messages. Your producer fails to resolve this address, and fails.

To fix it, in the broker’s server.properties set

JavaScript

More info: https://rmoff.net/2018/08/02/kafka-listeners-explained/

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement