#Spark提交作业参数
1)在提交任务时的几个重要参数
executor-cores —— 每个executor使用的内核数,默认为1,官方建议2-5个,我们企业是4个
num-executors —— 启动executors的数量,默认为2
executor-memory —— executor内存大小,默认1G
driver-cores —— driver使用内核数,默认为1
driver-memory —— driver内存大小,默认512M
2)边给一个提交任务的样式
spark-submit \
--master local[5] \
--driver-cores 2 \
--driver-memory 8g \
--executor-cores 4 \
--num-executors 10 \
--executor-memory 8g \
--class PackageName.ClassName XXXX.jar \
--name "Spark Job Name" \
InputPath \
OutputPath
3.参数说明
参数 | 解释 | 可选值举例 |
---|---|---|
–class | Spark程序中包含主函数的类 | |
–master | Spark程序运行的模式 | 本地模式:local[*]、spark://hadoop102:7077、 Yarn |
–executor-memory 1G | 指定每个executor可用内存为1G | 符合集群内存配置即可,具体情况具体分析。 |
–total-executor-cores 2 | 指定所有executor使用的cpu核数为2个 | |
application-jar | 打包好的应用jar,包含依赖。这个URL在集群中全局可见。 比如hdfs:// 共享存储系统,如果是file:// path,那么所有的节点的path都包含同样的jar | |
application-arguments | 传给main()方法的参数 | |
–deploy-mode client, | 表示Driver程序运行在本地客户端,默认模式 | client和cluster两种,cluster用的居多 |