我试图测试从一个环境到运行我们的kafka服务器的数字海洋的连接。
我试图运行./kafka-console-producer.sh --broker-list <HOST_NAME>:9092 --topic <topic>
我一直在
[2017-10-17 14:38:59,438] WARN Connection to node -1 could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient) [2017-10-17 14:38:59,490] WARN Connection to node -1 could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient) [2017-10-17 14:38:59,542] WARN Connection to node -1 could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient) [2017-10-17 14:38:59,644] WARN Connection to node -1 could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient) [2017-10-17 14:38:59,696] WARN Connection to node -1 could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
到目前为止采取的步骤:
PLAINTEXT://<ipaddress>:9092
我的server.properties文件的相关部分(HOST_NAME是保留隐私的实际主机名的别名):
listeners=PLAINTEXT://HOST_NAME:9092
host.name=HOST_NAME
# 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://HOST_NAME:9092
advertised.host.name=HOST_NAME
advertised.port=9092
我可以从本地机器连接到自己,但我在绳索的尽头是如何得到一个愚蠢的小测试信息来接触电线。
我做错了什么?
答案 0 :(得分:1)
通过在我的iptables配置中添加此规则来修改远程主机上的iptables配置,解决了这个问题:
-A INPUT -s [hosts went here] -p tcp -m state --state NEW -m tcp --dport 9092 -j ACCEPT
我必须允许TCP连接到远程主机上的端口9092。我们的基础架构团队阻止了我们开发环境中的所有特定端口,这些端口阻止开发人员使用telnet。
总结:使用iptable配置打开远程kafka服务器上的端口。确认您的localhost可以将TCP连接数据发送到该端口。