【问题标题】:Kafka Server on Static IP instead of localhost静态 IP 而不是 localhost 上的 Kafka 服务器
【发布时间】:2020-06-09 15:47:54
【问题描述】:

我目前可以在本地机器上生成和使用消息。我想改变它,让一台机器有动物园管理员、经纪人和生产者,另一台机器有消费者。我需要调整哪些服务器属性才能使其正常工作?

在服务器属性中,我尝试取消注释listeners=PLAINTEXT://:9092,设置advertised.listeners=PLAINTEXT://< machineA's static IP >:9092,以及将zookeeper.connect=localhost:2181 更改为zookeeper.connect=< Machine A's static IP >:9092

但是,到目前为止,以上都没有奏效。任何正确方向的指导都会非常有帮助。

【问题讨论】:

    标签: apache-kafka apache-zookeeper


    【解决方案1】:

    设置advertised.listeners=PLAINTEXT://< machineA's static IP >:9092,以及将zookeeper.connect=localhost:2181更改为zookeeper.connect=:9092

    zookeeper.connect 应该指向 zookeeper 端口,而不是 kafka 代理端口。所以,应该是 zookeeper.connect=<Machine A's static IP>:2181

    以 hostname:port 形式指定 ZooKeeper 连接字符串 其中 host 和 port 是 ZooKeeper 服务器的主机和端口

    Broker configurations reference

    此外,请确保您的防火墙没有限制对代理端口 (9092) 上的消费者的访问。如果是 linux 并且您正在使用 iptables,您可能希望允许该端口。

    iptables -A INPUT -p tcp --dport 9092 -j ACCEPT
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-08-04
      • 2019-01-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-26
      • 2017-03-29
      • 2022-01-05
      相关资源
      最近更新 更多