【From】 https://www.cnblogs.com/weiweifeng/p/8073553.html#undefined

spark-submit 可以提交任务到 spark 集群执行,也可以提交到 hadoop 的 yarn 集群执行。

1. 例子

一个最简单的例子,部署 spark standalone 模式后,提交到本地执行。

./bin/spark-submit \
--master spark://localhost:7077 \
examples/src/main/python/pi.py

如果部署 hadoop,并且启动 yarn 后,spark 提交到 yarn 执行的例子如下。

注意,spark 必须编译成支持 yarn 模式,编译 spark 的命令为:

build/mvn -Pyarn -Phadoop-2.x -Dhadoop.version=2.x.x -DskipTests clean package

其中, 2.x 为 hadoop 的版本号。编译完成后,可执行下面的命令,提交任务到 hadoop yarn 集群执行。

./bin/spark-submit --class org.apache.spark.examples.SparkPi \
--master yarn \
--deploy-mode cluster \
--driver-memory 1g \
--executor-memory 1g \
--executor-cores 1 \
--queue thequeue \
examples/target/scala-2.11/jars/spark-examples*.jar 10

2. spark-submit 详细参数说明

参数名 参数说明
--master  master 的地址,提交任务到哪里执行,例如 spark://host:port,  yarn,  local
--deploy-mode  在本地 (client) 启动 driver 或在 cluster 上启动,默认是 client
--class  应用程序的主类,仅针对 java 或 scala 应用
--name  应用程序的名称
--jars  用逗号分隔的本地 jar 包,设置后,这些 jar 将包含在 driver 和 executor 的 classpath 下
--packages  包含在driver 和executor 的 classpath 中的 jar 的 maven 坐标
--exclude-packages  为了避免冲突 而指定不包含的 package
--repositories  远程 repository
--conf PROP=VALUE

指定 spark 配置属性的值,

例如 -conf spark.executor.extraJavaOptions="-XX:MaxPermSize=256m"

--properties-file  加载的配置文件,默认为 conf/spark-defaults.conf
--driver-memory  Driver内存,默认 1G
--driver-java-options  传给 driver 的额外的 Java 选项
--driver-library-path  传给 driver 的额外的库路径
--driver-class-path  传给 driver 的额外的类路径
--driver-cores  Driver 的核数,默认是1。在 yarn 或者 standalone 下使用
--executor-memory  每个 executor 的内存,默认是1G
--total-executor-cores  所有 executor 总共的核数。仅仅在 mesos 或者 standalone 下使用
--num-executors  启动的 executor 数量。默认为2。在 yarn 下使用
--executor-core  每个 executor 的核数。在yarn或者standalone下使用

[转] spark-submit 提交任务及参数说明的更多相关文章

  1. spark下使用submit提交任务后报jar包已存在错误

    使用spark submit进行任务提交,离线跑数据,提交后的一段时间内可以application可以正常运行.过了一段时间后,就抛出以下错误: org.apache.spark.SparkExcep ...

  2. 【原创】大数据基础之Spark(1)Spark Submit即Spark任务提交过程

    Spark2.1.1 一 Spark Submit本地解析 1.1 现象 提交命令: spark-submit --master local[10] --driver-memory 30g --cla ...

  3. spark submit参数及调优(转载)

    spark submit参数介绍 你可以通过spark-submit --help或者spark-shell --help来查看这些参数. 使用格式:  ./bin/spark-submit \ -- ...

  4. Spark作业提交至Yarn上执行的 一个异常

    (1)控制台Yarn(Cluster模式)打印的异常日志: client token: N/A         diagnostics: Application application_1584359 ...

  5. spark submit local遇到路径hdfs的问题

    有时候第一次执行 spark submit --master local[*] 单机模式的时候,可以对linux本地路径进行输出.但是有时候提交到yarn的时候,是自动加上hdfs的路径这没问题, 但 ...

  6. Spark学习(四) -- Spark作业提交

    标签(空格分隔): Spark 作业提交 先回顾一下WordCount的过程: sc.textFile("README.rd").flatMap(line => line.s ...

  7. submit(提交)按钮

    为form添加一个submit(提交)按钮,点击这个按钮,表单中的数据将会被发送到通过action属性指定的地址上. 下面是submit按钮的例子: <button type="sub ...

  8. submit()提交表单时,显示警示框

    我同事在实现submit()提交表单时,想要页面弹出警示框. 但是折腾了几小时后发现,submit()始终不执行. 她的代码如下: $(document).ready(function(){ $(&q ...

  9. Spark集群模式&Spark程序提交

    Spark集群模式&Spark程序提交 1. 集群管理器 Spark当前支持三种集群管理方式 Standalone-Spark自带的一种集群管理方式,易于构建集群. Apache Mesos- ...

  10. 【jquery采坑】Ajax配合form的submit提交(微擎表单提交,ajax验证,submit提交)

    1.采坑:实现form的submit提交,在提交之前,进行ajax的不同校验,然后onsubmit=return check(),进行提交 1/1 目的:可以实现以 from的submit提交,然后还 ...

随机推荐

  1. URL Scheme

    [URL Scheme] 可以通过info.plist注册url types来实现程序自定义的协议,以供外部程序调起. NSURL *myURL = [NSURL URLWithString:@&qu ...

  2. 优秀前端工程师必备: 我要一个新窗口: js开新窗的2种姿势

    1.<a href="https://www.cnblogs.com/" title="博客园">当前页面打开博客园</a> js代码等 ...

  3. Kali linux切换语言为中文

    echo LANG="zh_CN.UTF-8" > /etc/default/locale

  4. 主键冲突异常 DuplicateKeyException

    org.springframework.dao.DuplicateKeyException Exception thrown when an attempt to insert or update d ...

  5. git fatal:HttpRequestException encountered

    网上查了一下发现是Github 禁用了TLS v1.0 and v1.1,必须更新Windows的git凭证管理器,才行. https://github.com/Microsoft/Git-Crede ...

  6. [转]Clean up after Visual Studio

    本文转自:https://weblogs.asp.net/psheriff/clean-up-after-visual-studio As programmer’s we know that if w ...

  7. CodeForces - 589F —(二分+贪心)

    A gourmet came into the banquet hall, where the cooks suggested n dishes for guests. The gourmet kno ...

  8. GPU的历史:从固定管线到可编程管线再到通用计算平台

    开始的时候GPU不能编程,也叫固定管线的,就是把数据按照固定的通路走完. 和CPU同样作为计算处理器,顺理成章就出来了可编程的GPU,但是那时候想在GPU上编程可不是容易的事,你只能使用GPU汇编来写 ...

  9. [leetcode] 5. Minimum Depth of Binary Tree

    二叉树基本功练习题,题目如下: Given a binary tree, find its minimum depth. The minimum depth is the number of node ...

  10. 开源WebGIS实施方案(三):Shapefile数据导入到PostGIS

    PostGIS新版中提供了一个可视化的工具,用于Shapefile数据的导入和导出,极大的方便了使用者的操作. 创建空间数据库 以具有创建用户权限的账号登录pgAdminIII,连接到数据库 创建一个 ...