无法从hortonworks hdp沙盒2.5外部向apache kafka生成消息

sdnqo3pr  于 2021-06-07  发布在  Kafka
关注(0)|答案(0)|浏览(193)

我在尝试从hortonworks hdp沙盒外部向apachekafka主题生成消息时遇到问题。现在我正在使用部署到azure的2.5版本,但是我在本地virtualbox上使用hdp2.6时遇到了类似的行为。我能够打开端口6667并确认tcp连接正在通过vm。我还可以访问主题列表。
使用侦听器=plaintext://0.0.0.0:6667

C:\GIT\kafka\bin\windows>kafka-console-producer.bat --broker-list MY_PUBLIC_IP:6667 --topic test1
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/GIT/kafka/core/build/dependant-libs-2.11.11/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/GIT/kafka/tools/build/dependant-libs-2.11.11/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/GIT/kafka/connect/api/build/dependant-libs/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/GIT/kafka/connect/runtime/build/dependant-libs/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/GIT/kafka/connect/file/build/dependant-libs/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/GIT/kafka/connect/json/build/dependant-libs/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
>sadasdas
>[2017-11-04 23:06:14,672] WARN [Producer clientId=console-producer] Connection to node 1001 could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
[2017-11-04 23:06:15,174] ERROR Error when sending message to topic test1 with key: null, value: 8 bytes with error: (org.apache.kafka.clients.producer.internals.ErrorLoggingCallback)
org.apache.kafka.common.errors.TimeoutException: Expiring 1 record(s) for test1-0: 1508 ms has passed since batch creation plus linger time
[2017-11-04 23:06:15,724] WARN [Producer clientId=console-producer] Connection to node 1001 could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
[2017-11-04 23:06:16,875] WARN [Producer clientId=console-producer] Connection to node 1001 could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)

添加了以下配置条目:
播发端口=6667
播发的.listeners=plaintext://my_public_ip:6667
advised.host.name=我的\u公共\u ip
结果:

C:\GIT\kafka\bin\windows>kafka-console-producer.bat --broker-list MY_PUBLIC_IP:6667 --topic test1
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/GIT/kafka/core/build/dependant-libs-2.11.11/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/GIT/kafka/tools/build/dependant-libs-2.11.11/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/GIT/kafka/connect/api/build/dependant-libs/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/GIT/kafka/connect/runtime/build/dependant-libs/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/GIT/kafka/connect/file/build/dependant-libs/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/GIT/kafka/connect/json/build/dependant-libs/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
>asdasd
[2017-11-04 22:37:11,713] WARN [Producer clientId=console-producer] Error while fetching metadata with correlation id 2 : {test1=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient)

你能给我出什么问题的建议吗?我现在想继续用沙箱。
我终于成功了。这就是解决方案:

advertised.listeners=PLAINTEXT://sandbox.hortonworks.com:6667

似乎我的Kafka只能在主机名给定的情况下与代理对话,而不是ip。。。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题