kafka 更新版本之后报错如下:

2015-12-02 15:14:12  [ pool-1-thread-2:4217697 ] - [ ERROR ]  Failed to collate messages by topic, partition due to: fetching topic metadata for topics [Set(test)] from broker [ArrayBuffer(id:0,host:172.16.4.214,port:9092)] failed
2015-12-02 15:14:12  [ pool-1-thread-5:4217707 ] - [ ERROR ]  Producer connection to 172.16.4.214:9092 unsuccessful
java.net.ConnectException: Connection refused: connect
    at sun.nio.ch.Net.connect0(Native Method)
    at sun.nio.ch.Net.connect(Net.java:435)
    at sun.nio.ch.Net.connect(Net.java:427)
    at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:643)
    at kafka.network.BlockingChannel.connect(Unknown Source)
    at kafka.producer.SyncProducer.connect(Unknown Source)
    at kafka.producer.SyncProducer.getOrMakeConnection(Unknown Source)
    at kafka.producer.SyncProducer.kafka$producer$SyncProducer$$doSend(Unknown Source)
	at kafka.producer.SyncProducer.send(Unknown Source)
	at kafka.client.ClientUtils$.fetchTopicMetadata(Unknown Source)
	at kafka.producer.BrokerPartitionInfo.updateInfo(Unknown Source)
	at kafka.producer.async.DefaultEventHandler$$anonfun$handle$2.apply$mcV$sp(Unknown Source)
    at kafka.utils.Utils$.swallow(Unknown Source)
    at kafka.utils.Logging$class.swallowError(Unknown Source)
    at kafka.utils.Utils$.swallowError(Unknown Source)
    at kafka.producer.async.DefaultEventHandler.handle(Unknown Source)
    at kafka.producer.Producer.send(Unknown Source)
    at kafka.javaapi.producer.Producer.send(Unknown Source)
    at com.hta.webmagic.pipeline.TestKafkaPipeline.KafkaProducer(TestKafkaPipeline.java:42)
    at com.hta.webmagic.pipeline.TestKafkaPipeline.process(TestKafkaPipeline.java:35)
    at us.codecraft.webmagic.Spider.processRequest(Spider.java:439)
    at us.codecraft.webmagic.Spider$1.run(Spider.java:336)
    at us.codecraft.webmagic.thread.CountableThreadPool$1.run(CountableThreadPool.java:74)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
2015-12-02 15:14:12  [ pool-1-thread-5:4217707 ] - [ ERROR ]  fetching topic metadata for topics [Set(test)] from broker [ArrayBuffer(id:0,host:172.16.4.214,port:9092)] failed
kafka.common.KafkaException: fetching topic metadata for topics [Set(test)] from broker [ArrayBuffer(id:0,host:172.16.4.214,port:9092)] failed
    at kafka.client.ClientUtils$.fetchTopicMetadata(Unknown Source)
    at kafka.producer.BrokerPartitionInfo.updateInfo(Unknown Source)
    at kafka.producer.async.DefaultEventHandler$$anonfun$handle$2.apply$mcV$sp(Unknown Source)
	at kafka.utils.Utils$.swallow(Unknown Source)
	at kafka.utils.Logging$class.swallowError(Unknown Source)
	at kafka.utils.Utils$.swallowError(Unknown Source)
	at kafka.producer.async.DefaultEventHandler.handle(Unknown Source)
	at kafka.producer.Producer.send(Unknown Source)
	at kafka.javaapi.producer.Producer.send(Unknown Source)
	at com.hta.webmagic.pipeline.TestKafkaPipeline.KafkaProducer(TestKafkaPipeline.java:42)
	at com.hta.webmagic.pipeline.TestKafkaPipeline.process(TestKafkaPipeline.java:35)
	at us.codecraft.webmagic.Spider.processRequest(Spider.java:439)
	at us.codecraft.webmagic.Spider$1.run(Spider.java:336)
	at us.codecraft.webmagic.thread.CountableThreadPool$1.run(CountableThreadPool.java:74)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.net.ConnectException: Connection refused: connect
	at sun.nio.ch.Net.connect0(Native Method)
	at sun.nio.ch.Net.connect(Net.java:435)
	at sun.nio.ch.Net.connect(Net.java:427)
	at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:643)
	at kafka.network.BlockingChannel.connect(Unknown Source)
	at kafka.producer.SyncProducer.connect(Unknown Source)
	at kafka.producer.SyncProducer.getOrMakeConnection(Unknown Source)
	at kafka.producer.SyncProducer.kafka$producer$SyncProducer$$doSend(Unknown Source)
    at kafka.producer.SyncProducer.send(Unknown Source)
    ... 17 more

网上都是说配置文件出问题的,还有建议删除log 目录

经研究解决办法如下:
先看版本

旧版本:kafka_2.10-0.8.2.2
基本上就是server.xml 配置问题,保证hostname 和zookeer 的IP地址正确

报错表现:可以看到topicList
可以新建topic

不能正常接收、发送消息

新版本:kafka_2.10-0.9.0.0
最后报错最可能是hosts 文件配置问题,需要配置好对应关系
这点和clouder 的集群安装类似
然后再检查server.xml 配置文件

新版本 报错表现:
本地命令行可以正常的发送、接收消息,Eclipse 和远程机器无法发送消息。

Logo

Kafka开源项目指南提供详尽教程,助开发者掌握其架构、配置和使用,实现高效数据流管理和实时处理。它高性能、可扩展,适合日志收集和实时数据处理,通过持久化保障数据安全,是企业大数据生态系统的核心。

更多推荐