spark streaming kafka Couldn't find leader
問題描述:
使用spark streaming接受kafka數(shù)據(jù)(使用direct方式)報錯
Couldn't find leader offsets for Set([test,0], [test,1], [test,3])
?
?
Exception in thread "main" org.apache.spark.SparkException: java.nio.channels.ClosedChannelException
java.nio.channels.ClosedChannelException
org.apache.spark.SparkException: Couldn't find leader offsets for Set([test,0], [test,1], [test,3])
??????? at org.apache.spark.streaming.kafka.KafkaCluster$$anonfun$checkErrors$1.apply(KafkaCluster.scala:366)
??????? at org.apache.spark.streaming.kafka.KafkaCluster$$anonfun$checkErrors$1.apply(KafkaCluster.scala:366)
??????? at scala.util.Either.fold(Either.scala:97)
??????? at org.apache.spark.streaming.kafka.KafkaCluster$.checkErrors(KafkaCluster.scala:365)
??????? at org.apache.spark.streaming.kafka.KafkaUtils$.getFromOffsets(KafkaUtils.scala:222)
??????? at org.apache.spark.streaming.kafka.KafkaUtils$.createDirectStream(KafkaUtils.scala:484)
??????? at Apps.KafkaStreaming$.main(KafkaStreaming.scala:52)
??????? at Apps.KafkaStreaming.main(KafkaStreaming.scala)
??????? at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
??????? at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
??????? at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
??????? at java.lang.reflect.Method.invoke(Method.java:606)
??????? at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
解決辦法:
嘗試方法1. 因為我有3個broker 所以嘗試更改 num.partitions=3 ?在創(chuàng)建一個新的 topic 仍舊不可以
嘗試方法2.將本機(jī)host中維護(hù)服務(wù)器ip hostname,以及服務(wù)器中保證/etc/hosts下ip hostname關(guān)系? 仍舊不可以
?
1.???? 停止kafka、zookeeper服務(wù)
2.???? 刪除zookeeper、kafka?? 配置的logs下文件
3.???? 啟動zookeeper、kafka服務(wù)
4.???? 創(chuàng)建新的topic
[hduser@BDTEST05 bin]$ ./kafka-console-producer.sh --broker-list? BDTEST05:9092 --topic test1
問題解決
注意 此處剛剛創(chuàng)建萬的topic 如果立即跑程序? 會報 是否存在這個topic 一定要topic里有內(nèi)容了 才可以執(zhí)行成功
轉(zhuǎn)載于:https://www.cnblogs.com/OS-BigData/p/8527348.html
超強(qiáng)干貨來襲 云風(fēng)專訪:近40年碼齡,通宵達(dá)旦的技術(shù)人生總結(jié)
以上是生活随笔為你收集整理的spark streaming kafka Couldn't find leader的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: bootstrap+fileinput插
- 下一篇: nSamplesPerSec和nAvgB