使用脚本时无法向Kafka生成数据,但可以使用脚本列出主题 [英] I can't produce data to Kafka when use the script, But I can list topics with the script

查看:21
本文介绍了使用脚本时无法向Kafka生成数据,但可以使用脚本列出主题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

各位,局域网有一台虚拟服务器,ip是192.168.18.230,我的机器ip是192.168.0.175.今天,我尝试使用我的机器(192.168.0.175)向我的虚拟服务器(192.168.18.230)发送一些消息,与 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆