当初搭建Spark On Yarn时候 配置yarn端获取spark运行的jar包时候,配置如下:
spark.yarn.jars hdfs:///sparkrunjar/
提交程序:
spark-submit --class org.apache.spark.examples.SparkPi --master yarn --deploy-mode client /home/daxin/spark/examples/jars/spark-examples_2.11-2.0.1.jar 100
显示错误:
16/11/01 17:37:25 ERROR spark.SparkContext: Error initializing SparkContext.
org.apache.spark.SparkException: Yarn application has already ended! It might have been killed or unable to launch application master.
at org.apache.spark.scheduler.cluster.YarnClientSchedulerBackend.waitForApplication(YarnClientSchedulerBackend.scala:85)
at org.apache.spark.scheduler.cluster.YarnClientSchedulerBackend.start(YarnClientSchedulerBackend.scala:62)
at org.apache.spark.scheduler.TaskSchedulerImpl.start(TaskSchedulerImpl.scala:149)
at org.apache.spark.SparkContext.<init>(SparkContext.scala:497)
at org.apache.spark.SparkContext$.getOrCreate(SparkContext.scala:2275)
at org.apache.spark.sql.SparkSession$Builder$$anonfun$8.apply(SparkSession.scala:831)
at org.apache.spark.sql.SparkSession$Builder$$anonfun$8.apply(SparkSession.scala:823)
at scala.Option.getOrElse(Option.scala:121)
at org.apache.spark.sql.SparkSession$Builder.getOrCreate(SparkSession.scala:823)
at org.apache.spark.examples.SparkPi$.main(SparkPi.scala:31)
at org.apache.spark.examples.SparkPi.main(SparkPi.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 org.apache.spark.deploy.SparkSubmit$.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:736)
at org.apache.spark.deploy.SparkSubmit$.doRunMain$1(SparkSubmit.scala:185)
at org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:210)
at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:124)
at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
16/11/01 17:37:25 INFO server.ServerConnector: Stopped ServerConnector@52b8e429{HTTP/1.1}{0.0.0.0:4040}
Hadoop集群错WebUI显示错误:Could not find or load main class org.apache.spark.deploy.yarn.ExecutorLauncher。
此时候定位错误应该是找不到saprk运行时jar导致的,但是:
hdfs dfs -ls hdfs:///sparkrunjar/ 的确显示有jar包,一脸懵逼啊!!!
最后将spark.yarn.jars的配置修改 hdfs:///sparkrunjar/* (后面加一个*解决问题)