Connection timeout with a Kafka running with Windows Subsystem For Linux

大憨熊 提交于 2020-01-15 10:28:53

问题


I have installed Kafka 1.1.0 with Zookeeper 3.4.12 under Windows SubSystem for Linux on my Windows 10 laptop. I'm able to procude and consume messages while I stay in ubuntu but when I want to produce a message from windows (with a java program or with the tool kafka-console-producer.bat) I have the following error :

[2018-05-11 15:31:01,449] ERROR Error when sending message to topic test with key: null, value: 15 bytes with error: (org.apache.kafka.clients.producer.internals.ErrorLoggingCallback) org.apache.kafka.common.errors.TimeoutException: Expiring 1 record(s) for test-0: 1534 ms has passed since batch creation plus linger time

Any idea ?


回答1:


I had a similar issue and I solved it testing kafka from console like this:

  1. Creating a topic: bin/kafka-topics.sh --zookeeper zooker-domain:2181 --create --topic test --replication-factor 1 --partitions 1

  2. Inserting a message: bin/kafka-console-producer.sh --broker-list kafka-domain:9092 --topic test

  3. Consuming messages: (old api) bin/kafka-console-consumer.sh --zookeeper zookeeper-domain:2181 --topic test --from-beginning
    (or with new api) bin/kafka-console-consumer.sh --new-consumer --topic test --from-beginning --bootstrap-server kafka-domain:9092 --partition 0

(Instead of domains you can use directly IPs).

I tested it with kafka 0.11.0.1 and it works.

If you still have problems try with: https://stackoverflow.com/a/51071306/2493852



来源:https://stackoverflow.com/questions/50293757/connection-timeout-with-a-kafka-running-with-windows-subsystem-for-linux

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!