按照官网gettingStarted ->http://kafka.apache.org/documentation.html#gettingStarted ,我单独安装的zookeeper, 启动了三个boroker。创建了一个topic,按照官网的步骤发送消息的时候,总是出现LeaderNotAvailableException异常。
部分错误信息:
[2015-04-11 14:14:15,076] WARN Error while fetching metadata [{TopicMetadata for topic my-replicated-topic ->
No partition metadata for topic my-replicated-topic due to kafka.common.LeaderNotAvailableException}] for topic [my-replicated-topic]: class kafka.common.LeaderNotAvailableException (kafka.producer.BrokerPartitionInfo)
[2015-04-11 14:14:15,076] ERROR Failed to collate messages by topic, partition due to: Failed to fetch topic metadata for topic: my-replicated-topic (kafka.producer.async.DefaultEventHandler)
[2015-04-11 14:14:15,183] WARN Error while fetching metadata [{TopicMetadata for topic my-replicated-topic ->
No partition metadata for topic my-replicated-topic due to kafka.common.LeaderNotAvailableException}] for topic [my-replicated-topic]: class kafka.common.LeaderNotAvailableException (kafka.producer.BrokerPartitionInfo)
[2015-04-11 14:14:15,186] ERROR Failed to send requests for topics my-replicated-topic with correlation ids in [0,8] (kafka.producer.async.DefaultEventHandler)
[2015-04-11 14:14:15,188] ERROR Error in handling batch of 1 events (kafka.producer.async.ProducerSendThread)
kafka.common.FailedToSendMessageException: Failed to send messages after 3 tries.
at kafka.producer.async.DefaultEventHandler.handle(DefaultEventHandler.scala:90)
at kafka.producer.async.ProducerSendThread.tryToHandle(ProducerSendThread.scala:105)
at kafka.producer.async.ProducerSendThread$$anonfun$processEvents$3.apply(ProducerSendThread.scala:88)
at kafka.producer.async.ProducerSendThread$$anonfun$processEvents$3.apply(ProducerSendThread.scala:68)
at scala.collection.immutable.Stream.foreach(Stream.scala:594)
at kafka.producer.async.ProducerSendThread.processEvents(ProducerSendThread.scala:67)
at kafka.producer.async.ProducerSendThread.run(ProducerSendThread.scala:45)
在stackoverflow上面找到了一个类似的问题http://stackoverflow.com/questions/23228222/running-into-leadernotavailableexception-when-using-kafka-0-8-1-with-zookeeper-3 ,按照下面的回答说配置有问题,我停掉kafka和zookeeper清除掉kafka的log和zookeeper的内容。重新启动但还是有上述问题。
各位有遇到这个问题吗?
1
lszwycn 2015-04-12 00:30:01 +08:00
你的topic是咋创建的?
|
2
alangz OP @lszwycn 按照官网的教程:
``` kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 3 --partitions 1 --topic my-replicated-topic ``` |
3
lszwycn 2015-04-12 22:04:00 +08:00
|
5
alangz OP 这个问题知道什么原因了,是因为主机名映射的ip错误,导致节点之间无法通信。
|