我们在Windows环境中安装了Kafka_2.10_0.9.0.1 / zookeeper-3.4.6。我们正在将传感器数据生成到kafka主题中,复制1&分区10.数据产生了几天。但有一段时间后无法发布/使用数据
为什么Leader不可用的例外即将到来!是否需要配置高级属性?
消费者错误:
WARN Fetching topic metadata with correlation id 50 for topics [Set(mydata)] from broker [id:0,host:MYServer,port:9082] failed (kafka.client.ClientUtils$)
java.nio.channels.ClosedChannelException
at kafka.network.BlockingChannel.send(BlockingChannel.scala:100)
at kafka.producer.SyncProducer.liftedTree1$1(SyncProducer.scala:73)
at kafka.producer.SyncProducer.kafka$producer$SyncProducer$$doSend(SyncProducer.scala:72)
at kafka.producer.SyncProducer.send(SyncProducer.scala:113)
at kafka.client.ClientUtils$.fetchTopicMetadata(ClientUtils.scala:58)
at kafka.client.ClientUtils$.fetchTopicMetadata(ClientUtils.scala:93)
at kafka.consumer.ConsumerFetcherManager$LeaderFinderThread.doWork(ConsumerFetcherManager.scala:66)
at kafka.utils.ShutdownableThread.run(ShutdownableThread.scala:60)
[2016-12-02 10:39:06,556] WARN [console-consumer-32849_myComp-1480655296645-12172d87-leader-finder-thread], Failed to find leader for Set([mydata,0]) (kafka.consumer.ConsumerFetcherManager$LeaderFinderThread)
kafka.common.KafkaException: fetching topic metadata for topics [Set(mydata)] from broker [ArrayBuffer(id:0,host:MYServer,port:9082)] 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:60)
Caused by: java.nio.channels.ClosedChannelException
at kafka.network.BlockingChannel.send(BlockingChannel.scala:100)
at kafka.producer.SyncProducer.liftedTree1$1(SyncProducer.scala:73)
at kafka.producer.SyncProducer.kafka$producer$SyncProducer$$doSend(SyncProducer.scala:72)
at kafka.producer.SyncProducer.send(SyncProducer.scala:113)
at kafka.client.ClientUtils$.fetchTopicMetadata(ClientUtils.scala:58)
配置zoo.config
tickTime=2000
initLimit=10
syncLimit=5
dataDir=C:\\Softwares\\zookeeper-3.4.6\\data
clientPort=2182
autopurge.snapRetainCount=3
autopurge.purgeInterval=1
kafka config:
############################# Server Basics #############################
broker.id=0
############################# Socket Server Settings #############################
listeners=PLAINTEXT://:9082
port=9082
advertised.host.name=1.2.3.8
advertised.port=9082
num.network.threads=3
num.io.threads=8
socket.send.buffer.bytes=102400
socket.receive.buffer.bytes=102400
socket.request.max.bytes=104857600
############################# Log Basics #############################
log.dirs=F:\\Datalogs\\kafkaLogs
num.partitions=10
num.recovery.threads.per.data.dir=1
############################# Log Retention Policy #############################
log.retention.hours=48
log.retention.bytes=1073741824
log.segment.bytes=1073741824
log.retention.check.interval.ms=300000
############################# Zookeeper #############################
zookeeper.connect=localhost:2182
zookeeper.connection.timeout.ms=6000
delete.topic.enable=true