最近在yarn 上運行spark 遇到一個奇怪的問題:
Diagnostics: ExitCodeException exitCode=2:
gzip: /spare/hadoop/yarn/local/filecache/21_tmp/tmp_spark2-hdp-yarn-archive.tar.gz: unexpected end of file
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors
查閲了很多資料,偶然看到以下的url 受到啓發,發現在 hdfs://xxxxx/hdp/apps/<version>/spark2/ 下的spark2-hdp-yarn-archive.tar.gz 有問題,並不是一個真正的gz file, 這個就是問題所在。
解決方案:
把/usr/hdp/current/spark2-client/jars 打包成spark2-hdp-yarn-archive.tar.gz, 並put 到hdp/apps/<version>/spark2/ 。 記得檢查權限,至少444.
然後使用 spark-submit xxx --master yarn 執行,通過!
我使用的是hdp 2.5, spark 2.1.
[參考]
https://community.hortonworks.com/articles/30096/foxing-broken-targz-and-jar-files-in-hdp-24.html