gpt4 book ai didi

amazon-ec2 - 为什么我无法从外部连接到 Kafka?

转载 作者:行者123 更新时间:2023-12-03 07:36:18 33 4
gpt4 key购买 nike

我正在 ec2 实例上运行 kafka。所以amazon ec2实例有两个ip,一个是内部ip,第二个是外部使用的。

我从本地计算机创建了生产者,但它重定向到内部 IP 并给出连接失败错误。任何人都可以帮助我在 ec2 实例上配置 kafka,以便我可以从本地计算机运行生产者。我尝试了很多组合但没有成功。

最佳答案

Kafka FAQ (更新新属性)您可以阅读:

When a broker starts up, it registers its ip/port in ZK. You need to make sure the registered ip is consistent with what's listed in bootstrap.servers in the producer config. By default, the registered ip is given by InetAddress.getLocalHost.getHostAddress(). Typically, this should return the real ip of the host. However, sometimes (e.g., in EC2), the returned ip is an internal one and can't be connected to from outside. The solution is to explicitly set the host ip and port to be registered in ZK by setting the advertised.listeners property in server.properties.

关于amazon-ec2 - 为什么我无法从外部连接到 Kafka?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27191347/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com