与Windows子系统一起用于Linux的Kafka的连接超时 [英] Connection timeout with a Kafka running with Windows Subsystem For Linux
问题描述
我在Windows 10笔记本电脑上的Linux的Windows SubSystem下安装了带Zookeeper 3.4.12的Kafka 1.1.0.我可以在ubuntu中处理和使用消息,但是当我想从Windows(使用Java程序或使用工具kafka-console-producer.bat)生成消息时,出现以下错误:
[2018-05-11 15:31:01,449]错误当将消息发送到主题测试时,使用键:null,值:15个字节,错误时出错,错误为:(org.apache.kafka.clients.producer.internals.ErrorLoggingCallback) org.apache.kafka.common.errors.TimeoutException:测试0的1条记录已过期:自创建批处理以来,经过了1534 ms的时间
有什么主意吗?
我有一个类似的问题,我通过这样的控制台测试kafka解决了该问题:
-
创建主题: bin/kafka-topics.sh --zookeeper zooker-domain:2181 --create --topic test --replication-factor 1 --partitions 1
-
插入消息: bin/kafka-console-producer.sh --broker-list kafka-domain:9092 --topic测试
-
正在使用的消息: (旧的api) bin/kafka-console-consumer.sh --zookeeper zookeeper-domain:2181 --topic测试--from-beginning
(或使用新的api) bin/kafka-console-consumer.sh --new-consumer --topic测试--from-beginning --bootstrap-server kafka-domain:9092 --partition 0
(代替域,您可以直接使用IP).
我用kafka 0.11.0.1进行了测试,并且可以正常工作.
如果您仍然有问题,请尝试: https://stackoverflow.com/a/51071306/2493852 >
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 ?
I had a similar issue and I solved it testing kafka from console like this:
Creating a topic: bin/kafka-topics.sh --zookeeper zooker-domain:2181 --create --topic test --replication-factor 1 --partitions 1
Inserting a message: bin/kafka-console-producer.sh --broker-list kafka-domain:9092 --topic test
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
这篇关于与Windows子系统一起用于Linux的Kafka的连接超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!