行业知识
spark 自定义外部配置参数的三种方式
2026-12-03 06:04:43
来源:互联网转载
文章目录
- 1、通过脚本 --conf 方式来提交
- 2、通过配置文件的方式–properties-file,如果不配置默认读取当前提交节点的 conf/spark-defaults.conf
- 3、通�index.php/tags-41973.html" >�main函数传递
前言
1、2 方式只能修改spark内置参数,外部自定义参数不支持此方式
如果传递,将提示
Warning: Ignoring non-spark config property: count.end.time=1564122000000
3方式可以用来传递自定义参数,通过args[]去获取
()1、通过脚本 --conf 方式来提交
多个配置参会传递多个 --config
./bin/spark-submit --class com.xx.TestApp --master yarn --deploy-mode cluster --driver-memory 1g --num-executors 2 --executor-memory 512M --executor-cores 2 //配置信息 --conf spark.mongodb.input.uri=mongodb://192.168.1.2:27017/onemap-statis --conf spark.mongodb.output.collection=test_collection test-0.0.1-SNAPSHOT.jar
2、通过配置文件的方式–properties-file,如果不配置默认读取当前提交节点的 conf/spark-defaults.conf
./bin/spark-submit --class com.xx.TestAppp --master yarn --deploy-mode cluster --driver-memory 1g --num-executors 2 --executor-memory 512M --executor-cores 2 //配置信息 --properties-file extend.conf test-0.0.1-SNAPSHOT.jar
3、通过main函数传递
arg0 arg1 arg3可以传递自定义参数,主函数里面获取
()./bin/spark-submit --class com.xx.TestAppp --master yarn --deploy-mode cluster --driver-memory 1g --num-executors 2 --executor-memory 512M --executor-cores 2 test-0.0.1-SNAPSHOT.jar arg0 arg1 arg3 //配置信息
下一篇:云服务器平衡设置在哪