且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Kafka - 无法使用Java向远程服务器发送消息

更新时间:2022-11-27 11:04:51

在你的kafka server.properties 中有一个注释配置

In your kafka server.properties there is a commented configuration

#advertised.host.name=<Some IP>

取消注释并添加运行kafka的Linux机器的IP。

Uncomment this and add the IP of the Linux Machine in which kafka is running.

advertised.host.name=<Kafka Running Machine IP>

从客户端连接到< Kafka Running Machine IP> 这应该可以解决您的问题。

And connect from clients to <Kafka Running Machine IP> This should fix your issue.

编辑

您可以选择可以取消注释

Optionally you can uncomment the

#advertised.port=9092

此外,如果您正在侦听与默认端口不同的端口。

Also if you are listening on a different port than the default one.