Kafka收不到消息(本人遇到的情况)

发布于:2021-10-28 03:45:05

报错如下
19/09/10 09:02:40 WARN ClientUtils$: Fetching topic metadata with correlation id 0 for topics [Set(nb6)] from broker [id:0,host:node01,port:9092] failed
java.nio.channels.ClosedChannelException
at kafka.network.BlockingChannel.send(BlockingChannel.scala:100)
at kafka.producer.SyncProducer.liftedTree1




1


(


S


y


n


c


P


r


o


d


u


c


e


r


.


s


c


a


l


a


:


73


)


a


t


k


a


f


k


a


.


p


r


o


d


u


c


e


r


.


S


y


n


c


P


r


o


d


u


c


e


r


.


k


a


f


k


a



1(SyncProducer.scala:73) at kafka.producer.SyncProducer.kafka


1(SyncProducer.scala:73)atkafka.producer.SyncProducer.kafkaproducer




S


y


n


c


P


r


o


d


u


c


e


r



SyncProducer


SyncProducer




d


o


S


e


n


d


(


S


y


n


c


P


r


o


d


u


c


e


r


.


s


c


a


l


a


:


72


)


a


t


k


a


f


k


a


.


p


r


o


d


u


c


e


r


.


S


y


n


c


P


r


o


d


u


c


e


r


.


s


e


n


d


(


S


y


n


c


P


r


o


d


u


c


e


r


.


s


c


a


l


a


:


113


)


a


t


k


a


f


k


a


.


c


l


i


e


n


t


.


C


l


i


e


n


t


U


t


i


l


s



doSend(SyncProducer.scala:72) at kafka.producer.SyncProducer.send(SyncProducer.scala:113) at kafka.client.ClientUtils


doSend(SyncProducer.scala:72)atkafka.producer.SyncProducer.send(SyncProducer.scala:113)atkafka.client.ClientUtils.fetchTopicMetadata(ClientUtils.scala:58)
at kafka.client.ClientUtils




.


f


e


t


c


h


T


o


p


i


c


M


e


t


a


d


a


t


a


(


C


l


i


e


n


t


U


t


i


l


s


.


s


c


a


l


a


:


93


)


a


t


k


a


f


k


a


.


c


o


n


s


u


m


e


r


.


C


o


n


s


u


m


e


r


F


e


t


c


h


e


r


M


a


n


a


g


e


r



.fetchTopicMetadata(ClientUtils.scala:93) at kafka.consumer.ConsumerFetcherManager


.fetchTopicMetadata(ClientUtils.scala:93)atkafka.consumer.ConsumerFetcherManagerLeaderFinderThread.doWork(ConsumerFetcherManager.scala:66)
at kafka.utils.ShutdownableThread.run(ShutdownableThread.scala:60)
19/09/10 09:02:40 WARN ConsumerFetcherManager




L


e


a


d


e


r


F


i


n


d


e


r


T


h


r


e


a


d


:


[


t


e


s



t


L



A


P


T


O


P


?


B


M


8


E


A


J


V


7


?


1568077329506


?


830


e


6395


?


l


e


a


d


e


r


?


f


i


n


d


e


r


?


t


h


r


e


a


d


]


,


F


a


i


l


e


d


t


o


f


i


n


d


l


e


a


d


e


r


f


o


r


S


e


t


(


[


n


b


6


,


0


]


)


k


a


f


k


a


.


c


o


m


m


o


n


.


K


a


f


k


a


E


x


c


e


p


t


i


o


n


:


f


e


t


c


h


i


n


g


t


o


p


i


c


m


e


t


a


d


a


t


a


f


o


r


t


o


p


i


c


s


[


S


e


t


(


n


b


6


)


]


f


r


o


m


b


r


o


k


e


r


[


A


r


r


a


y


B


u


f


f


e


r


(


i


d


:


0


,


h


o


s


t


:


n


o


d


e


01


,


p


o


r


t


:


9092


)


]


f


a


i


l


e


d


a


t


k


a


f


k


a


.


c


l


i


e


n


t


.


C


l


i


e


n


t


U


t


i


l


s



LeaderFinderThread: [test_LAPTOP-BM8EAJV7-1568077329506-830e6395-leader-finder-thread], Failed to find leader for Set([nb6,0]) kafka.common.KafkaException: fetching topic metadata for topics [Set(nb6)] from broker [ArrayBuffer(id:0,host:node01,port:9092)] failed at kafka.client.ClientUtils


LeaderFinderThread:[testL?APTOP?BM8EAJV7?1568077329506?830e6395?leader?finder?thread],FailedtofindleaderforSet([nb6,0])kafka.common.KafkaException:fetchingtopicmetadatafortopics[Set(nb6)]frombroker[ArrayBuffer(id:0,host:node01,port:9092)]failedatkafka.client.ClientUtils.fetchTopicMetadata(ClientUtils.scala:72)
at kafka.client.ClientUtils




.


f


e


t


c


h


T


o


p


i


c


M


e


t


a


d


a


t


a


(


C


l


i


e


n


t


U


t


i


l


s


.


s


c


a


l


a


:


93


)


a


t


k


a


f


k


a


.


c


o


n


s


u


m


e


r


.


C


o


n


s


u


m


e


r


F


e


t


c


h


e


r


M


a


n


a


g


e


r



.fetchTopicMetadata(ClientUtils.scala:93) at kafka.consumer.ConsumerFetcherManager


.fetchTopicMetadata(ClientUtils.scala:93)atkafka.consumer.ConsumerFetcherManagerLeaderFinderThread.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


(


S


y


n


c


P


r


o


d


u


c


e


r


.


s


c


a


l


a


:


73


)


a


t


k


a


f


k


a


.


p


r


o


d


u


c


e


r


.


S


y


n


c


P


r


o


d


u


c


e


r


.


k


a


f


k


a



1(SyncProducer.scala:73) at kafka.producer.SyncProducer.kafka


1(SyncProducer.scala:73)atkafka.producer.SyncProducer.kafkaproducer




S


y


n


c


P


r


o


d


u


c


e


r



SyncProducer


SyncProducer




d


o


S


e


n


d


(


S


y


n


c


P


r


o


d


u


c


e


r


.


s


c


a


l


a


:


72


)


a


t


k


a


f


k


a


.


p


r


o


d


u


c


e


r


.


S


y


n


c


P


r


o


d


u


c


e


r


.


s


e


n


d


(


S


y


n


c


P


r


o


d


u


c


e


r


.


s


c


a


l


a


:


113


)


a


t


k


a


f


k


a


.


c


l


i


e


n


t


.


C


l


i


e


n


t


U


t


i


l


s



doSend(SyncProducer.scala:72) at kafka.producer.SyncProducer.send(SyncProducer.scala:113) at kafka.client.ClientUtils


doSend(SyncProducer.scala:72)atkafka.producer.SyncProducer.send(SyncProducer.scala:113)atkafka.client.ClientUtils.fetchTopicMetadata(ClientUtils.scala:58)
… 3 more


本人操作是这样的:之前我的kafka是三节点集群的,这次由于做项目需要所以就装了个单节点的kafka,然后就在信心满满的测试kafkaAPI消费者接收消息时出现了问题,就出现了以上错误。不管我是用什么版本就是收不到,那么就不废话了,直接上解决办法吧。
由于之前本人一直使用的是三节点kafka集群,所以在windows系统里的这个目录下的hosts文件我是这么配置的
文件路径


重点看最下面四行,这个是IP地址映射,图上的是我的四台虚拟机集群,而我的伪分布式单节点IP地址是192.168.145.130,单节点的名字也是node01,所以我就把192.168.145.131改为了192.168.145.130.然后就可以接收到消息了。就是这么神奇。
本人猜测:由于我的虚拟机主机名重复冲突,所以可能会导致无法识别主机名,导致虚拟机找不到虚拟机主机地址。

相关推荐

最新更新

猜你喜欢