使用脚本时无法向Kafka生成数据,但是可以使用脚本列出主题 [英] I can't produce data to Kafka when use the script, But I can list topics with the script
问题描述
每个人,局域网中都有一个虚拟服务器,其IP为192.168.18.230
,而我的机器IP为192.168.0.175
.
今天,我尝试通过Kafka控制台生产者
everybody,there is a virtual server in the local area network which ip is 192.168.18.230
, and my machine ip is 192.168.0.175
.
Today, I try to use my machine (192.168.0.175
) to send some messages to my virtual server(192.168.18.230
), with the Kafka console producer
$ bin/kafka-console-producer.sh --broker-list 192.168.18.230:9092 --topic test
,但是出了点问题.问题的描述是:
but there is something wrong. The description of the problem is :
[2017-04-10 17:25:40,396] ERROR Error when sending message to topic test with key: null, value: 6 bytes with error: (org.apache.kafka.clients.producer.internals.ErrorLoggingCallback)
org.apache.kafka.common.errors.TimeoutException: Expiring 1 record(s) for test-0 due to 1568 ms has passed since batch creation plus linger time
但是当我使用kafka-topics
脚本列出主题时,它会起作用:
But when I use the kafka-topics
script to list topics, it works:
$ bin/kafka-topics.sh --list --zookeeper 192.168.18.230:2181
这个问题困扰了我很长时间,有人可以帮助我解决这个问题吗?
This problem confused me a very long period, can any body help me to solve it?
推荐答案
如果您有正在运行的zookeeper实例,您当然可以询问主题列表.但是,似乎您没有可用的Kafka经纪人.
If you have a zookeeper instance which is running, you can of course ask the list of topics. However, it seems that you have no Kafka broker available.
您可能有一个动物园管理员在运行,但没有Kafka.
You maybe have a zookeeper running but not Kafka.
这篇关于使用脚本时无法向Kafka生成数据,但是可以使用脚本列出主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!