美文网首页
spark submit常用参数及优化

spark submit常用参数及优化

作者: zhglance | 来源:发表于2019-08-07 15:17 被阅读0次
1.spark submit 基本格式举例:
spark-submit \
--class com.lance.MyMain  \
--master yarn-cluster \
--executor-memory 1G \
--num-executors 8  \
--executor-cores 2 \
--queue lance_queue
hdfs:////user/lance-1.0.jar arg1 arg2
2.spark submit 参数详解:
参数 参数说明 示例
--master master的地址,即提交任务在哪里执行 spark://host:port,yarn, local,yarn-cluster等
--deploy-mode 在本地 (client) 启动 driver 或在 cluster 上启动,默认是 client client,cluster
--class 程序的主类,主要是Java或scala --classcom.lance.MyMain
--name spark应用程序名字 --name my-spark
--jars spark依赖的jar,逗号分割 --jars /mysql-connector-java-5.1.27-bin.jar,hdfs:///user/lance/my.jar
--packages 包含在driver 和executor 的 classpath 中的 jar 的 maven 坐标 --packages com.lance.main
--exclude-packages 排除packages主要针对jar冲突 --exclude-packages com.lance.java.utils
--repositories 搜索packages的maven仓库地址 --repositories https://repo.maven.apache.org/maven2
--conf key=value 设置spark 属性值 --conf spark.speculation=true
--properties-file 加载配置文件,默认为 conf/spark-defaults.conf --properties-file lance.conf
--driver-memory 设置Driver的内存大小,默认为1G --driver-memory 5G
--driver-java-options 传给Driver的额外java选项 --java-options evn=online
--driver-library-path 传给Driver的额外的库路径 ...
--driver-class-path 传给Driver的额外的类路径 ...
--driver-cores 设置Driver的核数,默认1,在yarn或者 standalone下使用 --driver-cores 5
--executor-memory 每个executor的内存,默认1G --executor-memory 10G
--total-executor-cores 所有executor的总核数,仅仅在mesos 或者standalone下使用 --total-executor-cores 100
--num-executors 启动了executor个数,默认2,在yarn中使用 --num-executors 100,设置的太多的话,队列可能无法给予充分的资源。
--executor-core 每个executor的核数,在yarn或者standalone下使用 --executor-core 5

相关文章

网友评论

      本文标题:spark submit常用参数及优化

      本文链接:https://www.haomeiwen.com/subject/tyiodctx.html