如何加载Java属性文件,并在星火使用? [英] How to load java properties file and use in Spark?

查看:151
本文介绍了如何加载Java属性文件,并在星火使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想星火参数,如输入文件,输出文件存储到一个Java属性文件和传递文件到星火驱动程序。我使用的火花提交提交作业,但无法找到一个参数来传递属性文件。你有什么建议吗?

I want to store the Spark arguments such as input file, output file into a Java property files and pass that file into Spark Driver. I'm using spark-submit for submitting the job but couldn't find a parameter to pass the properties file. Have you got any suggestions?

推荐答案

在这里我发现了一个解决办法:

here i found one solution:

道具文件:preFIX与键:(mypropsfile.conf)// 注意火花。其他道具将被忽略。

props file : (mypropsfile.conf) // note: prefix your key with "spark." else props will be ignored.

spark.myapp.input /input/path
spark.myapp.output /output/path

发布

$SPARK_HOME/bin/spark-submit --properties-file  mypropsfile.conf

如何在code调用 :(里面code)

sc.getConf.get("spark.driver.host")  // localhost
sc.getConf.get("spark.myapp.input")       // /input/path
sc.getConf.get("spark.myapp.output")      // /output/path

这篇关于如何加载Java属性文件,并在星火使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆