kafka producer 发布消息的时候报错
用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 : 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 : 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 : 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
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)
只要从程序和配置入手了。
从上面错误来看,建议检测核实下
server.properties文件里
下面是否注释掉
#host.name=localhost
你可以用自带的测试程序试一下。感觉是你的主题创建的有点问题
页:
[1]