有许多相似类型的查询上的计算器,但没有完全匹配,我看到了问题的时候。集装箱卡夫卡客户端产生的错误信息给主机服务器卡夫卡
我在我的服务器上有一个zookeeper/kafka安装程序,它可以很好地工作。人们可以产生
bin/kafka-console-producer.sh --broker-list 192.168.2.80:9092 --topic test
和消费
bin/kafka-console-consumer.sh --bootstrap-server 192.168.2.80:9092 --topic test --from-beginning
本地的Linux操作系统Ubuntu 16.04服务器上。
从Docker容器 - 也运行Ubuntu 16.04 - 我想生产和消费。容器的Kafka代码是从服务器上复制的。 首先,我可以从容器中创建一个新的话题
bin/kafka-topics.sh --create --zookeeper 192.168.2.80:2181 --replication-factor 1 --partitions 1 --topic test2
,然后再列出它
bin/kafka-topics.sh --list --zookeeper 192.168.2.80:2181
然而,当我试图产生新的消息,使用上述(kafka-console-producer.sh )命令失败,并显示以下消息:
[2017-06-05 13:59:05,317] ERROR Error when sending message to topic test2 with key: null, value: 2 bytes with error: (org.apache.kafka.clients.producer.internals.ErrorLoggingCallback)
org.apache.kafka.common.errors.TimeoutException: Expiring 1 record(s) for test2-0: 1526 ms has passed since batch creation plus linger time
紧接在输入消息文本后按回车。
在同一个主机上运行Docker容器似乎有点奇怪,但是一旦这个工作正常,我将把容器移动到一个单独的主机进行生产。
我卡夫卡server.properties文件:
listeners=PLAINTEXT://0.0.0.0:9092
卡夫卡版本:
2.12-0.10.2.1
泊坞版本:
Docker version 1.12.6, build 78d1802
如果您在主机上使用mac和docker-machine,您必须执行端口转发: docker-machine ssh default -L 9092:localhost:9092 -L 2181:localhost:2181 – Andy
以及Kafka的图像你用?这个为我工作:https://hub.docker.com/r/wurstmeister/kafka/ – Andy
谢谢安迪, 我想保持简单的事情。所以我刚刚使用此链接下载它: wget ftp://apache.cs.utah.edu/apache.org/kafka/0.10.2.1/kafka_2.12-0.10.2.1.tgz 使用焦油它然后一次性解包动物园管理员和卡夫卡。它似乎在我的主Ubuntu服务器上运行良好。 然后我在我的Ubuntu里做了同样的事情:最新的docker镜像。但是,我在容器中运行的所有内容都是kafka bin目录中的命令。我还没有开始动物园管理员或卡夫卡的守护进程。 –