structstreaming消费kafka,报找不到kafka source
执行脚本:spark-submit --class com.bigdata.SparkDemo --master yarn --deploy-mode client --driver-memory 1g /tmp/StructStreamingdemo-1.0-SNAPSHOT.jar报错信息如下Exception in thread "main" org.apache.spark.sql.Ana
执行脚本:spark-submit --class com.bigdata.SparkDemo --master yarn --deploy-mode client --driver-memory 1g /tmp/StructStreamingdemo-1.0-SNAPSHOT.jar
报错信息如下
Exception in thread "main" org.apache.spark.sql.AnalysisException: Failed to find data source: kafka. Please deploy the application as per the deployment section of "Structured Streaming + Kafka Integration Guide".;
at org.apache.spark.sql.execution.datasources.DataSource$.lookupDataSource(DataSource.scala:697)
at org.apache.spark.sql.streaming.DataStreamReader.load(DataStreamReader.scala:161)
at com.bigdata.SparkDemo.main(SparkDemo.java:35)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.spark.deploy.JavaMainApplication.start(SparkApplication.scala:52)
at org.apache.spark.deploy.SparkSubmit.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:845)
at org.apache.spark.deploy.SparkSubmit.doRunMain$1(SparkSubmit.scala:161)
at org.apache.spark.deploy.SparkSubmit.submit(SparkSubmit.scala:184)
at org.apache.spark.deploy.SparkSubmit.doSubmit(SparkSubmit.scala:86)
at org.apache.spark.deploy.SparkSubmit$$anon$2.doSubmit(SparkSubmit.scala:920)
at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:929)
后来改成
spark-submit --class com.bigdata.SparkDemo --master yarn --deploy-mode client --packages org.apache.spark:spark-sql-kafka-0-10_2.11:2.4.5 --driver-memory 1g /tmp/StructStreamingdemo-1.0-SNAPSHOT.jar
如果需要依赖多个jar
最终我是这样了,把kafka的数据写入了hudi
spark-submit --class com.bigdata.StructuredStreamingProcess --master yarn --deploy-mode client --packages org.apache.spark:spark-sql-kafka-0-10_2.11:2.4.5,org.apache.spark:spark-avro_2.11:2.4.5,org.apache.hudi:hudi-spark-bundle_2.11:0.7.0 --repositories http://maven.aliyun.com/nexus/content/groups/public/ --driver-memory 2g /tmp/WordCount-jar-with-dependencies.jar
更多推荐
所有评论(0)