我们正在尝试使用apachekafka从linux向windows传递消息;zookeeper和kafka在操作系统和消息传递中都配置在各自的本地主机上;
从windows到linux发送消息时出错;
error-向主题my\u topic发送消息时出错,关键字:null,值:5字节,错误为:(org.apache.kafka.clients.producer.internals.errorloggingcallback)org.apache.kafka.common.errors.timeoutexception:topic my\u topic 60000 ms后元数据中不存在。
[2020-10-09 11:24:22903]warn[producer clientid=console producer]获取相关id为51的元数据时出错:{my\u topic=leader\u not\u available}(org.apache.kafka.clients.networkclient)终止批处理作业(y/n)?
[20-10-09 11:24:28979]warn[consumer clientid=consumer-1,groupid=console-consumer-56715]获取相关id为81的元数据时出错:{my\u topic=leader\u not\u available}(org.apache.kafka.clients.networkclient)总共处理了0条消息
Listed below are the configuration files for Linux server endpoint
# producer properties
metadata.broker.list=localhost:9092,192.168.1.3:9092,192.168.0.103:9092
# consumer properties
zookeeper.connect=127.0.0.1:2181,192.168.1.3:2181,192.168.0.103:2181
# consumer group id
group.id=test-consumer-group
# server properties
broker.id=1
listeners=PLAINTEXT://localhost:9092
advertised.listeners=PLAINTEXT://192.168.1.3:9092,192.168.0.103:9092
zookeeper.connect=localhost:2181
# 192.168.0.103 is windows machine
# 172.22.3.28 is Linux machine
Windows producer –
kafka-console-producer.bat --broker-list 172.22.3.28:9092 --topic my_topic
Linux Consumer-
bin/kafka-console-consumer.sh --new-consumer --bootstrap-server 192.168.0.103:9092 --topic my_topic --from-beginning
我们开始在linux和windows中配置kafka individual,并成功地通过localhost发送消息。假设使用kafka可以跨操作系统进行实时消息传递。请更正。
1条答案
按热度按时间ijnw1ujt1#
您需要配置
advertised.listeners
以便windows客户机可以正确连接到linux代理。如果linux代理有ip
172.22.3.28
那么配置应该如下所示:裁判:https://www.confluent.io/blog/kafka-client-cannot-connect-to-broker-on-aws-on-docker-etc