在这里,我找到了一种解决方案:
props文件 :(mypropsfile.conf)// 注意:密钥的前缀为“ spark”。 否则道具将被忽略。
spark.myapp.input /input/pathspark.myapp.output /output/path
发射
$SPARK_HOME/bin/spark-submit --properties-file mypropsfile.conf
如何调用代码 :(内部代码)
sc.getConf.get("spark.driver.host") // localhostsc.getConf.get("spark.myapp.input") // /input/pathsc.getConf.get("spark.myapp.output") // /output/path


