卡夫卡消息传递失败

时间:2016-08-03 14:02:13

标签: rubygems apache-kafka kafka-producer-api

我正在尝试使用kafka ruby​​客户端 - https://github.com/zendesk/ruby-kafka将日志发布到kafka。以下是kafka的日志

I, [2016-08-03T17:54:38.131775 #14887]  INFO -- : Fetching cluster metadata from kafka://10.10.10.162:9092
D, [2016-08-03T17:54:38.131939 #14887] DEBUG -- : Opening connection to 10.40.50.16:9092 with client id ruby-kafka...
D, [2016-08-03T17:54:38.133199 #14887] DEBUG -- : Sending request 1 to 10.40.50.16:9092
D, [2016-08-03T17:54:38.133339 #14887] DEBUG -- : Waiting for response 1 from 10.40.50.16:9092
D, [2016-08-03T17:54:38.134763 #14887] DEBUG -- : Received response 1 from 10.40.50.16:9092
I, [2016-08-03T17:54:38.134823 #14887]  INFO -- : Discovered cluster metadata; nodes: kafka1:9092 (node_id=1), kafka2:9092 (node_id=2), kafka3:9092 (node_id=3)
D, [2016-08-03T17:54:38.134882 #14887] DEBUG -- : Closing socket to 10.40.50.16:9092
D, [2016-08-03T17:54:38.135018 #14887] DEBUG -- : Current leader for TRANSACTION_GOCARS/0 is node kafka2:9092 (node_id=2)
I, [2016-08-03T17:54:38.135092 #14887]  INFO -- : Sending 1 messages to kafka2:9092 (node_id=2)
D, [2016-08-03T17:54:38.135195 #14887] DEBUG -- : Opening connection to kafka2:9092 with client id ruby-kafka...
E, [2016-08-03T17:54:38.135750 #14887] ERROR -- : Failed to connect to kafka2:9092: getaddrinfo: Name or service not known
E, [2016-08-03T17:54:38.135825 #14887] ERROR -- : Could not connect to broker kafka2:9092 (node_id=2): getaddrinfo: Name or service not known

是否有任何人有关于如何修复它的任何信息。

2 个答案:

答案 0 :(得分:0)

我认为错误消息在您的情况下非常有用 - kafka2不可路由,因此您应该配置连接,以便您尝试访问kafka2的计算机真的可以访问它或者更改Kafka advertised.host.name中的server.properties以便为客户公开不同的地址

答案 1 :(得分:0)

尝试在您的应用程序中ping {或{} kafka2代理,以查看您是否可以连接到它。或者你可以告诉我们关于server.properties的{​​{1}}。主机名可能无法访问。