我有一個Java Spark作業,它可以在EC2上以獨立模式手動部署Spark 1.6.0。EMR上的Spark YARN - JavaSparkContext - IllegalStateException:庫目錄不存在
我正在使用YARN將此作業提交給主站上的EMR 5.3.0羣集,但它失敗。
火花提交線是,
spark-submit --class <startclass> --master yarn --queue default --deploy-mode cluster --conf spark.eventLog.enabled=true --conf spark.eventLog.dir=hdfs://`hostname -f`:8020/tmp/ourSparkLogs --driver-memory 4G --executor-memory 4G --executor-cores 2 hdfs://`hostname -f`:8020/data/x.jar yarn-client
的「紗線的客戶端」是第一個參數x.jar應用和被饋送到SparkContext作爲setMaster,
conf.setMaster(args[0]);
當我提交它,它開始運行良好,直到我從SparkConf初始化JavaSparkContext,
JavaSparkContext sc = new JavaSparkContext(conf);
... an d然後Spark崩潰。
紗線日誌,我可以看到下面,
yarn logs -applicationId application_1487325147456_0051
...
17/02/17 16:27:13 WARN Client: Neither spark.yarn.jars nor spark.yarn.archive is set, falling back to uploading libraries under SPARK_HOME.
17/02/17 16:27:13 INFO Client: Deleted staging directory hdfs://ip-172-31-8-237.eu-west-1.compute.internal:8020/user/ec2-user/.sparkStaging/application_1487325147456_0052
17/02/17 16:27:13 ERROR SparkContext: Error initializing SparkContext.
java.lang.IllegalStateException: Library directory '/mnt/yarn/usercache/ec2-user/appcache/application_1487325147456_0051/container_1487325147456_0051_01_000001/assembly/target/scala-2.11/jars' does not exist; make sure Spark is built.
...
注意到WARN spark.yarn.jars標誌缺失的,我在
/usr/lib/spark/jars/
發現火花紗JAR文件。並根據Cloudera的指南將其上傳到HDFS,以便如何在Spark上運行YARN應用程序並嘗試添加該配置文件,因此這成爲我的火花提交線,
spark-submit --class <startclass> --master yarn --queue default --deploy-mode cluster --conf spark.eventLog.enabled=true --conf spark.eventLog.dir=hdfs://`hostname -f`:8020/tmp/ourSparkLogs --conf spark.yarn.jars=hdfs://`hostname -f`:8020/sparkyarnlibs/spark-yarn_2.11-2.1.0.jar --driver-memory 4G --executor-memory 4G --executor-cores 2 hdfs://`hostname -f`:8020/data/x.jar yarn-client
但是這並沒有工作,給這個:
Could not find or load main class org.apache.spark.deploy.yarn.ApplicationMaster
我,什麼是圖書館的錯誤是造成,以及如何從這裏開始進行真正的疑惑。