2016-10-26 11:05:29,716  WARN [flume_dx2.zdp.ol-1477451127056-e2015d55-leader-finder-thread] kafka.consumer.ConsumerFetcherManager$LeaderFinderThread (line 89) [flume_dx2.zdp.ol-1477451127056-e2015d55-leader-finder-thread], Failed to find leader for Set([v4-avail-service-request,0])
kafka.common.KafkaException: fetching topic metadata for topics [Set(v4-avail-service-request)] from broker [ArrayBuffer(BrokerEndPoint(0,ip-192-168-110-4.cn-north-1.compute.internal,9092))] failed
at kafka.client.ClientUtils$.fetchTopicMetadata(ClientUtils.scala:72)
at kafka.client.ClientUtils$.fetchTopicMetadata(ClientUtils.scala:93)
at kafka.consumer.ConsumerFetcherManager$LeaderFinderThread.doWork(ConsumerFetcherManager.scala:66)
at kafka.utils.ShutdownableThread.run(ShutdownableThread.scala:63)
Caused by: java.nio.channels.ClosedChannelException
at kafka.network.BlockingChannel.send(BlockingChannel.scala:110)
at kafka.producer.SyncProducer.liftedTree1$1(SyncProducer.scala:76)
at kafka.producer.SyncProducer.kafka$producer$SyncProducer$$doSend(SyncProducer.scala:75)
at kafka.producer.SyncProducer.send(SyncProducer.scala:120)
at kafka.client.ClientUtils$.fetchTopicMetadata(ClientUtils.scala:58)
... 3 more


Flume从Kafka订阅数据报错Failed to find leader for Set

Flume部署在本地,Kafka集群部署在AWS云上。

解决办法

Consume端服务器配置/etc/hosts文件,其中机器名从要同Kafka服务端私有DNS名称相同(这个名称可以在报错信息中看到)

123.123.123.123 ip-192-168-110-4.cn-north-1.compute.internal