【spark-submit】【spark】

Spark的spark-submit脚本用于在集群上启动应用程序,支持所有Spark集群管理器。你需要将应用程序及其依赖打包成assembly jar,使用spark-submit指定入口点、主URL等参数来启动。此外,可以使用--conf选项设置配置,--master选项选择集群管理器,--deploy-mode决定驱动程序部署方式。对于Python应用,可以使用--py-files传递.py或.zip文件。
摘要由CSDN通过智能技术生成

目录

1 Submitting Applications 

1 提交应用 

2 Bundling Your Application’s Dependencies

2 捆绑应用程序的依赖

3 Launching Applications with spark-submit

3 使用spark-submit启动应用程序

4 Master URLs 

5 Loading Configuration from a File

5 从文件加载配置

6 Advanced Dependency Management

6 高级依赖管理

8 More Information 

8 更多信息 


1 Submitting Applications 

1 提交应用 

The spark-submit script in Spark’s bin directory is used to launch applications on a cluster. It can use all of Spark’s supported cluster managers through a uniform interface so you don’t have to configure your application especially for each one.
Spark的 bin 目录中的 spark-submit 脚本用于在集群上启动应用程序。它可以通过统一的接口使用所有Spark支持的集群管理器,因此您不必为每个集群管理器配置应用程序。

2 Bundling Your Application’s Dependencies

2 捆绑应用程序的依赖

If your code depends on other projects, you will need to package them alongside your application in order to distribute the code to a Spark cluster. To do this, create an assembly jar (or “uber” jar) containing your code and its dependencies. Both sbt and Maven have assembly plugins. When creating assembly jars, list Spark and Hadoop as provided dependencies; these need not be bundled since they are provided by the cluster manager at runtime. Once you have an assembled jar you can call the bin/spark-submit script as shown here while passing your jar.
如果您的代码依赖于其他项目,则需要将它们与应用程序一起打包,以便将代码分发到Spark集群。为此,创建一个包含代码及其依赖项的组装jar(或“uber”jar)。sbt和Maven都有汇编插件。在创建assembly jar时,将Spark和Hadoop列为 provided 依赖项;这些不需要捆绑,因为它们是由集群管理器在运行时提供的。一旦你有了一个组装好的jar,你就可以在传递你的jar的时候调用这里所示的 bin/spark-submit 脚本。

For Python, you can use the --py-files argument of spark-submit to add .py.zip or .egg files to be distributed with your application. If you depend on multiple Python files we recommend packaging them into a .zip or .egg. For third-party Python dependencies, see Python Package Management.
对于Python,您可以使用 spark-submit 的 --py-files 参数来添加要与应用程序一起分发的 .py 、 .zip 或 .egg 文件。如果你依赖于多个Python文件,我们建议将它们打包到 .zip 或 .egg 中。有关第三方Python依赖项,请参阅Python包管理。

3 Launching Applications with spark-submit

3 使用spark-submit启动应用程序

Once a user application is bundled, it can be launched using the bin/spark-submit script. This script takes care of setting up the classpath with Spark and its dependencies, and can support different cluster managers and deploy modes that Spark supports:
一旦用户应用程序被捆绑,就可以使用 bin/spark-submit 脚本启动它。此脚本负责使用Spark及其依赖项设置类路径,并可以支持Spark支持的不同集群管理器和部署模式:

./bin/spark-submit \
  --class <main-class> \
  --master <master-url> \
  --deploy-mode <deploy-mode> \
  --conf <key>=<value> \
  ... # other options
  <application-jar> \
  [application-arguments]

Some of the commonly used options are:
一些常用的选项是:

  • --class: The entry point for your application (e.g. org.apache.spark.examples.SparkPi)
    --class :应用程序的入口点(例如 org.apache.spark.examples.SparkPi )
  • --master: The master URL for the cluster (e.g. spark://23.195.26.187:7077)
    --master :集群的主URL(例如 spark://23.195.26.187:7077 )
  • --deploy-mode: Whether to deploy your driver on the worker nodes (cluster) or locally as an external client (client) (default: client
    --deploy-mode :是将驱动程序部署在工作节点上( cluster )还是作为外部客户端部署在本地( client )࿰
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

资源存储库

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值