分享

kafka producer 发布消息的时候报错

m331283153 发表于 2016-12-16 11:38:35 [显示全部楼层] 回帖奖励 阅读模式 关闭右栏 2 13341
用java写了个kafka producer小程序,启动的时候报错,topic已经创建成功了,但是消息发布不了
急求大神帮忙看看



16/12/16 11:30:51 INFO client.ClientUtils$: Fetching metadata from broker BrokerEndPoint(0,act201,9092) with correlation id 5 for 1 topic(s) Set(ncytest1)
16/12/16 11:30:51 INFO producer.SyncProducer: Connected to act201:9092 for producing
16/12/16 11:30:51 INFO producer.SyncProducer: Disconnecting from act201:9092
16/12/16 11:30:51 WARN producer.BrokerPartitionInfo: Error while fetching metadata [{TopicMetadata for topic ncytest1 ->
No partition metadata for topic ncytest1 due to org.apache.kafka.common.errors.LeaderNotAvailableException}] for topic [ncytest1]: class org.apache.kafka.common.errors.LeaderNotAvailableException
16/12/16 11:30:51 ERROR async.DefaultEventHandler: Failed to collate messages by topic, partition due to: Failed to fetch topic metadata for topic: ncytest1
16/12/16 11:30:51 INFO async.DefaultEventHandler: Back off for 100 ms before retrying send. Remaining retries = 1
16/12/16 11:30:51 INFO client.ClientUtils$: Fetching metadata from broker BrokerEndPoint(1,act202,9092) with correlation id 6 for 1 topic(s) Set(ncytest1)
16/12/16 11:30:51 INFO producer.SyncProducer: Connected to act202:9092 for producing
16/12/16 11:30:51 INFO producer.SyncProducer: Disconnecting from act202:9092
16/12/16 11:30:51 WARN producer.BrokerPartitionInfo: Error while fetching metadata [{TopicMetadata for topic ncytest1 ->
No partition metadata for topic ncytest1 due to org.apache.kafka.common.errors.LeaderNotAvailableException}] for topic [ncytest1]: class org.apache.kafka.common.errors.LeaderNotAvailableException
16/12/16 11:30:51 INFO client.ClientUtils$: Fetching metadata from broker BrokerEndPoint(0,act201,9092) with correlation id 7 for 1 topic(s) Set(ncytest1)
16/12/16 11:30:51 INFO producer.SyncProducer: Connected to act201:9092 for producing
16/12/16 11:30:51 INFO producer.SyncProducer: Disconnecting from act201:9092
16/12/16 11:30:51 WARN producer.BrokerPartitionInfo: Error while fetching metadata [{TopicMetadata for topic ncytest1 ->
No partition metadata for topic ncytest1 due to org.apache.kafka.common.errors.LeaderNotAvailableException}] for topic [ncytest1]: class org.apache.kafka.common.errors.LeaderNotAvailableException
16/12/16 11:30:51 ERROR async.DefaultEventHandler: Failed to collate messages by topic, partition due to: Failed to fetch topic metadata for topic: ncytest1
16/12/16 11:30:51 INFO async.DefaultEventHandler: Back off for 100 ms before retrying send. Remaining retries = 0
16/12/16 11:30:51 INFO client.ClientUtils$: Fetching metadata from broker BrokerEndPoint(3,act204,9092) with correlation id 8 for 1 topic(s) Set(ncytest1)
16/12/16 11:30:51 INFO producer.SyncProducer: Connected to act204:9092 for producing
16/12/16 11:30:51 INFO producer.SyncProducer: Disconnecting from act204:9092
16/12/16 11:30:51 ERROR async.DefaultEventHandler: Failed to send requests for topics ncytest1 with correlation ids in [0,8]
Exception in thread "Thread-10" kafka.common.FailedToSendMessageException: Failed to send messages after 3 tries.
        at kafka.producer.async.DefaultEventHandler.handle(DefaultEventHandler.scala:93)
        at kafka.producer.Producer.send(Producer.scala:77)
        at kafka.javaapi.producer.Producer.send(Producer.scala:33)
        at com.surfilter.ip.kafka.producer.KafkaSend.send(KafkaSend.java:51)
        at com.surfilter.ip.kafka.producer.KafkaProducer.run(KafkaProducer.java:32)




已有(2)人评论

跳转到指定楼层
arsenduan 发表于 2016-12-16 14:37:14
只要从程序和配置入手了。
从上面错误来看,建议检测核实下
server.properties文件里
下面是否注释掉
#host.name=localhost

回复

使用道具 举报

ighack 发表于 2019-8-8 14:25:43
你可以用自带的测试程序试一下。感觉是你的主题创建的有点问题
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

推荐上一条 /2 下一条