简体   繁体   English

如何使用jar运行Spark Java示例

[英]How to run Spark Java samples using jar

I am trying to run Spark Java samples using jar. 我正在尝试使用jar运行Spark Java示例。 For sparkPi sample alone command is available. 对于单独的sparkPi示例命令可用。 How to run other Java samples like HdfsLR , Logquery , Pagerank , Statustrackerdemo , javaTC in spark using jar. 如何使用jar在javaTC中运行其他Java示例,例如HdfsLRLogqueryPagerankStatustrackerdemojavaTC

The standard way of submitting jars to spark cluster is through the following command if running in local mode : 如果以本地模式运行,则将jar提交到Spark集群的标准方法是通过以下命令:

spark-submit --class "package.class Name" --master local[2] "path_to_your_jar_file" spark-submit --class“ package.class名称” --master local [2]“ path_to_your_jar_file”

If there is no package name ignore package & just give class name in the above command. 如果没有包名,则忽略包并在上述命令中给出类名。

Note if spark home is not set you should go to spark/bin directory & execute the above command there 请注意,如果未设置spark home,则应转到spark / bin目录并在其中执行上述命令

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM