一旦用户的应用打包后,就可以使用bin/spark-submit脚本来启动,此脚本就会为Spark和它的依赖安排配置环境变量,还支持不同的集群管理和部署模式:

./bin/spark-submit \
--class <main-class>
--master <master-url> \
--deploy-mode <deploy-mode> \
--conf <key>=<value> \
... # other options
<application-jar> \
[application-arguments]
 
一些常用的命令如下:
.--class:应用程序的入口(如:org.apache.spark.examples.SparkPi)

.--master:集群的master URL(如: spark://23.195.26.187:7077)

.--deploy-mode:选择集群模式来部署Driver进程或本地模式作为客户端

--conf:通过key=value格式来设置Spark配置文件属性,当value值包含格时,用引号引起key=value(”key=value“)

--application-jar:包含应用程序和应用程序所依赖包的路径,URL在集群中必须是全局可见的,例如:hdfs://或者file://路径必须在节点上也是存在的

--application-arguments:将参数传递在主要的main方法中

  

本地模式:
./bin/spark-submit \
--class org.apache.spark.examples.SparkPi \
--master local[8] \
/path/to/examples.jar \
100  
 
Spark独立部署模式(Client):
./bin/spark-submit \
--class org.apache.spark.examples.SparkPi \
--master spark://207.184.161.138:7077 \
--executor-memory 20G \
--total-executor-cores 100 \
/path/to/examples.jar \
1000

  

Spark独立部署模式并监视(Cluster)
./bin/spark-submit \
--class org.apache.spark.examples.SparkPi \
--master spark://207.184.161.138:7077 \
--deploy-mode cluster
--supervise
--executor-memory 20G \
--total-executor-cores 100 \
/path/to/examples.jar \
1000 
 
Yarn部署模式:
export HADOOP_CONF_DIR=XXX
./bin/spark-submit \
--class org.apache.spark.examples.SparkPi \
--master yarn-cluster \ # can also be `yarn-client` for client mode
--executor-memory 20G \
--num-executors 50 \
/path/to/examples.jar \
1000
 
Master URLs
通过如下方法将Master URL传递给Spark
local 单个本地工作线程程运行Spark
local[K] K个本地线程运行Spark(K为你机器的内核数)
local[*] 根据你机器的内核数据来启动多个线程运行Spark
spark://HOST:PORT 连接Spark集群的master,端口要和配置文件中的相同,默认为7077
mesos://HOST:PORT 连接Mesos集群,端口默认为5055
yarn-client 在client模式下连接YARN集群,集群的位置能在HADOOP_CONF_DIR 或YARN_CONF_DIR找到
yarn-cluster 在集群械下连接YARN集群,HADOOP_CONF_DIR 或YARN_CONF_DIR找到
 

spark-submit的更多相关文章

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

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

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

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

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

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

  4. spark standalone ha spark submit

    when you build a spark standalone ha cluster, when you submit your app,  you should send it to the l ...

  5. spark submit参数及调优

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

  6. Spark应用程序部署工具Spark Submit

    不多说,直接上干货!  spark-submit在哪个位置 [spark@master ~]$ cd $SPARK_HOME/bin [spark@master bin]$ pwd /usr/loca ...

  7. Spark Shell & Spark submit

    Spark 的 shell 是一个强大的交互式数据分析工具. 1. 搭建Spark 2. 两个目录下面有可执行文件: bin  包含spark-shell 和 spark-submit sbin 包含 ...

  8. spark submit参数调优

    在开发完Spark作业之后,就该为作业配置合适的资源了.Spark的资源参数,基本都可以在spark-submit命令中作为参数设置.很多Spark初学者,通常不知道该设置哪些必要的参数,以及如何设置 ...

  9. spark submit 入门

    spark dirver本质是一个spark集群的驱动程序,你要调用spark集群的计算功能,必须要通过它! from pyspark import SparkConf, SparkContext c ...

  10. Spark Submit 脚本

    当我们需要命令行传递参数时候,将--class 写在前面,然后是jar 最后是参数 spark-submit --master yarn --num-executors 3 --executor-me ...

随机推荐

  1. poj 3320 Jessica's Reading Problem(尺取法)

    Description Jessica's a very lovely girl wooed by lots of boys. Recently she has a problem. The fina ...

  2. Ant-进阶

    Ant的概念 可能有些读者并不连接什么是Ant以及入可使用它,但只要使用通过Linux系统得读者,应该知道make这个命令.当编译Linux内核及一些软件的源程序时,经常要用这个命令.Make命令其实 ...

  3. XNOR-Net ImageNet Classification Using Binary Convolutional Neural Networks

    转载请注明出处: http://www.cnblogs.com/sysuzyq/p/6245186.html by 少侠阿朱

  4. According to TLD or attribute directive in tag file, attribute value does not accept any expressions

    1.错误描写叙述 2014-7-13 17:27:21 org.apache.jasper.compiler.TldLocationsCache tldScanJar 信息: At least one ...

  5. 自定义 Layer 属性的动画

    默认情况下,CALayer 及其子类的绝大部分标准属性都可以执行动画,无论是添加一个 CAAnimation 到 Layer(显式动画),亦或是为属性指定一个动作然后修改它(隐式动画).   但有时候 ...

  6. Unity 图片的灰度处理

    我们平时在做项目时,经常遇到按钮的点击而且还要区分悬浮,点击,禁用的状态,美术要针对一张图片做多个状态图片,资源图片的数量也就增大了,那么打出的包的大小也就跟着上去了,所以我们可以针对原始图片进行Sh ...

  7. Android 开源框架

    不推荐使用UltimateAndroid.KJFrameForAndroid.ThinkAndroid.Afinal.xUtil等这种集成网络请求.图片加载.数据库ORM.视图依赖注入.UI框架等的集 ...

  8. Android 平滑图片加载和缓存库 Glide 使用详解

    在图片加载库烂大街的今天,选择一个适合自己使用的图片加载库已经成为了每一个Android开发者的必经之路.现在市面上知名的图片加载库有UIL,Picasso,Volley ImageLoader,Fr ...

  9. sqlserver 执行远程数据库代码

    1.启用Ad Hoc Distributed Queries: exec sp_configure 'show advanced options',1reconfigureexec sp_config ...

  10. UVA11401Triangle Counting(简单计数)

    转载请注明出处: http://www.cnblogs.com/fraud/          ——by fraud 题目意思:从1,2,3,……,n中选出3个不同的整数使其构成一个三角形,有多少种方 ...