spark on yarnタスクのコミットの遅い解決

4281 ワード

spark on yarnタスクのコミットの遅い解決
sparkバージョン:spark-2.0.0 hadoop 2.7.2.
spark on yarnモードでタスクのコミットを実行すると、特に遅く、数分待つ必要があります.
クラスタ・モード・モードを使用したタスクの発行:./bin/spark-submit --class org.apache.spark.examples.SparkPi --master yarn --deploy-mode cluster --driver-memory 4g --executor-memory 2g --executor-cores 1 --queue thequeue examples/jars/spark-examples*.jar 10
次の警告メッセージが表示されます.
17/02/08 18:26:23 WARN yarn.Client: Neither spark.yarn.jars nor spark.yarn.archive is set, falling back to uploading libraries under SPARK_HOME.
17/02/08 18:26:29 INFO yarn.Client: Uploading resource file:/tmp/spark-91508860-fdda-4203-b733-e19625ef23a0/__spark_libs__4918922933506017904.zip -> hdfs://dbmtimehadoop/user/fuxin.zhao/.sparkStaging/application_1486451708427_0392/__spark_libs__4918922933506017904.zip

このログの後、アップロードプログラムに依存しているjarは、30 sほどかかり、タスクの提出速度が遅いため、公式サイトで解決策を調べました.
To make Spark runtime jars accessible from YARN side, you can specify spark.yarn.archive or spark.yarn.jars. 
For details please refer to Spark Properties. If neither spark.yarn.archive nor spark.yarn.jars is specified, 
Spark will create a zip file with all jars under $SPARK_HOME/jars and upload it to the distributed cache.

yarn側(yarnのノード)でsparkのruntime jarsにアクセスするには、spark.yarn.archiveまたはspark.yarn.jarsを指定する必要があります.両方のパラメータが指定されていない場合、sparkは$SPARK_HOME/jars/すべてのjarを分散キャッシュにアップロードします.これも、以前のタスクのコミットが特に遅かった理由です.
次のソリューション:$SPARK_HOME/jars/*下spark運転依存のjarをhdfsにアップロードします.
hadoop fs -mkdir hdfs://dbmtimehadoop/tmp/spark/lib_jars/
hadoop fs -put  $SPARK_HOME/jars/* hdfs://dbmtimehadoop/tmp/spark/lib_jars/

vi $SPARK_HOME/conf/spark-defaults.confは以下の内容を追加します:spark.yarn.jars hdfs://dbmtimehadoop/tmp/spark/lib_jars/再実行タスクのコミットにより、次の異常が検出されました.
Exception in thread "main" 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.(SparkContext.scala:500)

ResourceManagerのログの例外を表示するには、次の手順に従います.http://db-namenode01.host-mtime.com:19888/jobhistory/logs/db-datanode03.host-mtime.com:34545/container_e08_1486451708427_0346_02_000001/
Log Length: 191

Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
Error: Could not find or load main class org.apache.spark.deploy.yarn.ExecutorLauncher

説明前の構成に誤りがあり、spark関連jarパッケージのロードに成功しなかったため、以下のいくつかの構成方法が有効です.
#  
spark.yarn.jars                  hdfs://dbmtimehadoop/tmp/spark/lib_jars/*.jar ##  
#spark.yarn.jars                  hdfs://dbmtimehadoop/tmp/spark/lib_jars/*   ##  
##            jar,     。
#spark.yarn.jars                 hdfs://dbmtimehadoop/tmp/spark/lib_jars/activation-1.1.1.jar,hdfs://dbmtimehadoop/tmp/spark/lib_jars/antlr-2.7.7.jar,hdfs://dbmtimehadoop/tmp/spark/lib_jars/antlr4-runtime-4.5.3.jar,hdfs://dbmtimehadoop/tmp/spark/lib_jars/antlr-runtime-3.4.jar
                                                               

タスクを再コミットし、実行に成功しました.jarの追加に成功したことを示すメッセージが表示されます.
17/02/08 19:28:21 INFO yarn.Client: Source and destination file systems are the same. Not copying hdfs://dbmtimehadoop/tmp/spark/lib_jars/spark-mllib-local_2.11-2.0.0.jar
17/02/08 19:28:21 INFO yarn.Client: Source and destination file systems are the same. Not copying hdfs://dbmtimehadoop/tmp/spark/lib_jars/spark-mllib_2.11-2.0.0.jar
17/02/08 19:28:21 INFO yarn.Client: Source and destination file systems are the same. Not copying hdfs://dbmtimehadoop/tmp/spark/lib_jars/spark-network-common_2.11-2.0.0.jar
17/02/08 19:28:21 INFO yarn.Client: Source and destination file systems are the same. Not copying hdfs://dbmtimehadoop/tmp/spark/lib_jars/spark-network-shuffle_2.11-2.0.0.jar

転載先:https://www.cnblogs.com/honeybee/p/6379599.html