标签:park height bin dfs line strong 标记 font chmod
启动Spark任务时,在没有配置spark.yarn.archive
或者spark.yarn.jars
时, 会看到不停地上传jar,非常耗时;使用spark.yarn.archive
可以大大地减少任务的启动时间,整个处理过程如下。
1.在本地创建zip文件
silent@bd01:~/env/spark$ cd jars/ silent@bd01:~/env/spark$ zip spark2.0.0.zip ./*
注:zip包为全量包
2.上传至HDFS并更改权
silent@bd01:~/env/spark$ /usr/ndp/current/hdfs_client/bin/hdfs dfs -mkdir /tmp/spark-archive silent@bd01:~/env/spark$ /usr/ndp/current/hdfs_client/bin/hdfs dfs -put ./spark2.0.0.zip /tmp/spark-archive silent@bd01:~/env/spark$ /usr/ndp/current/hdfs_client/bin/hdfs dfs -chmod 775 /tmp/spark-archive/spark2.0.0.zip.zip
3.配置spark-defaut.conf
spark.yarn.archive hdfs:///tmp/spark-archive/spark2.0.0.zip
1. 上传依赖jar包
silent@bd01:~/env/spark$ /usr/ndp/current/hdfs_client/bin/hdfs dfs -mkdir hdfs://bd01/user/asiainfo/jars/
silent@bd01:~/env/spark$ /usr/ndp/current/hdfs_client/bin/hdfs dfs -put ./spark2.0.0.zip hdfs://bd01/user/asiainfo/jars/
silent@bd01:~/env/spark$ /usr/ndp/current/hdfs_client/bin/hdfs dfs -chmod 775 hdfs://bd01/user/asiainfo/jars/spark2.0.0.zip.zip
2.配置spark-defaut.conf
spark.yarn.jars=local:/opt/cloudera/parcels/CDH-6.1.0-1.cdh6.1.0.p0.770702/lib/spark/jars/*,local:/opt/cloudera/parcels/CDH-6.1.0-1.cdh6.1.0.p0.770702/lib/spark/hive/*,hdfs://bd01/user/asiainfo/jars/*.jar
注:本地配置local,hdfs标记为hdfs目录即可
将spark依赖包传入HDFS_spark.yarn.jar和spark.yarn.archive的使用
标签:park height bin dfs line strong 标记 font chmod
原文地址:https://www.cnblogs.com/yyy-blog/p/11110388.html