spark 自定义外部配置参数的三种方式


前言
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    //配置信息

相关推荐

  1. spark 定义外部配置参数方式

    2024-03-16 05:04:01       37 阅读
  2. Spark基础】-- RDD 转 Dataframe 方式

    2024-03-16 05:04:01       48 阅读
  3. 配置Spring程序方法

    2024-03-16 05:04:01       56 阅读
  4. Spark_spark参数配置优先级

    2024-03-16 05:04:01       69 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-03-16 05:04:01       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-03-16 05:04:01       100 阅读
  3. 在Django里面运行非项目文件

    2024-03-16 05:04:01       82 阅读
  4. Python语言-面向对象

    2024-03-16 05:04:01       91 阅读

热门阅读

  1. 低代码与数智制造:引领软件开发的革新之旅

    2024-03-16 05:04:01       46 阅读
  2. bash: sqlplus: command not found 问题解决方法

    2024-03-16 05:04:01       44 阅读
  3. js的MediaRecorder录音录视频方法笔记

    2024-03-16 05:04:01       38 阅读
  4. kubernetes实战(1)之虚拟机centos搭建k8s集群

    2024-03-16 05:04:01       43 阅读
  5. Spring Cloud Gateway如何实现灰度发布

    2024-03-16 05:04:01       37 阅读
  6. C语言中volatile关键字的用法

    2024-03-16 05:04:01       43 阅读
  7. c++排序算法

    2024-03-16 05:04:01       42 阅读
  8. rsync+inotify-tools文件传输

    2024-03-16 05:04:01       37 阅读
  9. 蓝桥杯---棋盘(典型的二维差分问题)

    2024-03-16 05:04:01       41 阅读