您的位置:首页 > 编程语言 > Java开发

Kafka producer无法发送消息解决办法

2017-11-24 14:32 495 查看
在虚拟机搭建了kafka集群,在集群内使用Shell可以成功发送消息创建Topic。

但是在外部使用API无法发送消息,但是能创建topic

具体原因

Hostname and port the broker will advertise to producers and consumers. If not set, it uses the value for “listeners” if configured. Otherwise, it will use the value returned from java.net.InetAddress.getCanonicalHostName().

所以将

#advertised.listeners=PLAINTEXT://your.host.name:9092


修改为

advertised.listeners=PLAINTEXT://192.168.84.136:9092
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  虚拟机 kafka-java