1.spark submit参数

$ ./bin/spark-submit --class path.to.your.Class --master yarn --deploy-mode cluster [options] <app jar> [app options]
Multiple versions of Spark are installed but SPARK_MAJOR_VERSION is not set
Spark1 will be picked by default
Usage: spark-submit [options] <app jar | python file> [app arguments]
Usage: spark-submit --kill [submission ID] --master [spark://...]
Usage: spark-submit --status [submission ID] --master [spark://...] Options:
--master MASTER_URL spark://host:port, mesos://host:port, yarn, or local.
--deploy-mode DEPLOY_MODE Whether to launch the driver program locally ("client") or
on one of the worker machines inside the cluster ("cluster")
(Default: client).
--class CLASS_NAME Your application's main class (for Java / Scala apps).
--name NAME A name of your application.
--jars JARS Comma-separated list of local jars to include on the driver
and executor classpaths.
--packages Comma-separated list of maven coordinates of jars to include
on the driver and executor classpaths. Will search the local
maven repo, then maven central and any additional remote
repositories given by --repositories. The format for the
coordinates should be groupId:artifactId:version.
--exclude-packages Comma-separated list of groupId:artifactId, to exclude while
resolving the dependencies provided in --packages to avoid
dependency conflicts.
--repositories Comma-separated list of additional remote repositories to
search for the maven coordinates given with --packages.
--py-files PY_FILES Comma-separated list of .zip, .egg, or .py files to place
on the PYTHONPATH for Python apps.
--files FILES Comma-separated list of files to be placed in the working
directory of each executor. --conf PROP=VALUE Arbitrary Spark configuration property.
--properties-file FILE Path to a file from which to load extra properties. If not
specified, this will look for conf/spark-defaults.conf. --driver-memory MEM Memory for driver (e.g. 1000M, 2G) (Default: 1024M).
--driver-java-options Extra Java options to pass to the driver.
--driver-library-path Extra library path entries to pass to the driver.
--driver-class-path Extra class path entries to pass to the driver. Note that
jars added with --jars are automatically included in the
classpath. --executor-memory MEM Memory per executor (e.g. 1000M, 2G) (Default: 1G). --proxy-user NAME User to impersonate when submitting the application.
This argument does not work with --principal / --keytab. --help, -h Show this help message and exit
--verbose, -v Print additional debug output
--version, Print the version of current Spark Spark standalone with cluster deploy mode only:
--driver-cores NUM Cores for driver (Default: ). Spark standalone or Mesos with cluster deploy mode only:
--supervise If given, restarts the driver on failure.
--kill SUBMISSION_ID If given, kills the driver specified.
--status SUBMISSION_ID If given, requests the status of the driver specified. Spark standalone and Mesos only:
--total-executor-cores NUM Total cores for all executors. Spark standalone and YARN only:
--executor-cores NUM Number of cores per executor. (Default: in YARN mode,
or all available cores on the worker in standalone mode) YARN-only:
--driver-cores NUM Number of cores used by the driver, only in cluster mode
(Default: ).
--queue QUEUE_NAME The YARN queue to submit to (Default: "default").
--num-executors NUM Number of executors to launch (Default: ).
--archives ARCHIVES Comma separated list of archives to be extracted into the
working directory of each executor.
--principal PRINCIPAL Principal to be used to login to KDC, while running on
secure HDFS.
--keytab KEYTAB The full path to the file that contains the keytab for the
principal specified above. This keytab will be copied to
the node running the Application Master via the Secure
Distributed Cache, for renewing the login tickets and the
delegation tokens periodically.

For example:

$ ./bin/spark-submit --class org.apache.spark.examples.SparkPi \
--master yarn \
--deploy-mode cluster \
--driver-memory 4g \
--executor-memory 2g \
--executor-cores \
--queue thequeue \
lib/spark-examples*.jar \

In client mode:

$ ./bin/spark-shell --master yarn --deploy-mode client

最近一直测试spark程序,对spark-submit的参数进行了调节。

通过上面图片可以看到,总共有7个节点,总共的VCores为133,总共内存为1.49TB,有3个application在运行,2个分别为spark thrift server和spark2 thrift server,1个为我提交的任务,可以看出我提交的任务占用了81个cpu VCores(1个为application master)。

提交命令:

time spark-submit --master yarn-client --driver-memory 10g --executor-memory 10g --num-executors  --class com.test.test.ByHour ~/cs0308/quickstart-SNAPSHOT.jar /test/origin/20170306_02 /test/result/

其中

--num-executors 80           80个executor(默认是2个)
--executor-memory 10g        exector内存大小(默认1g)
--driver-memory 10g          Driver程序使用内存大小

--executor-cores             每个executor使用的内核数,默认为1

发现在设置过程中运行起来还有剩余的资源,但是若把参数直接设成80以上,程序一运行就直接报错,程序刚运行时申请资源会超过设置参数,然后就会下降80(设置参数)+1个cpu,1个为Application Master。这个是跑了1.2T大小的gz文件,跑完为4.6T的txt文件。
同样的程序在第二天跑的时候,发现老报sockettimeoutexception,重启集群(没有程序在运行)后,再一次运行同样的命令发现正常了(用的HDP的集群)。 具体spark-submit参数说明: https://my.oschina.net/u/140462/blog/519409

Spark on YARN资源申请的更多相关文章

  1. Apache Spark源码走读之8 -- Spark on Yarn

    欢迎转载,转载请注明出处,徽沪一郎. 概要 Hadoop2中的Yarn是一个分布式计算资源的管理平台,由于其有极好的模型抽象,非常有可能成为分布式计算资源管理的事实标准.其主要职责将是分布式计算集群的 ...

  2. Spark On Yarn的两种模式yarn-cluster和yarn-client深度剖析

    Spark On Yarn的优势 每个Spark executor作为一个YARN容器(container)运行.Spark可以使得多个Tasks在同一个容器(container)里面运行 1. Sp ...

  3. <YARN><MRv2><Spark on YARN>

    MRv1 VS MRv2 MRv1: - JobTracker: 资源管理 & 作业控制- 每个作业由一个JobInProgress控制,每个任务由一个TaskInProgress控制.由于每 ...

  4. 基础概念 之 Spark on Yarn

    先抛出问题:Spark on Yarn有cluster和client两种模式,它们有什么区别? 用Jupyter写Spark时,只能使用client模式,为什么? 写一篇文章,搞清楚 Spark on ...

  5. Spark on YARN的部署

    Spark on YARN的原理就是依靠yarn来调度Spark,比默认的Spark运行模式性能要好的多,前提是首先部署好hadoop HDFS并且运行在yarn上,然后就可以开始部署spark on ...

  6. 配置Spark on YARN集群内存

    参考原文:http://blog.javachen.com/2015/06/09/memory-in-spark-on-yarn.html?utm_source=tuicool 运行文件有几个G大,默 ...

  7. Spark on Yarn 学习(一)

    最近看到明风的关于数据挖掘平台下实用Spark和Yarn来做推荐的PPT,感觉很赞,现在基于大数据和快速计算方面技术的发展很快,随着Apache基金会上发布的一个个项目,感觉真的新技术将会不断出现在大 ...

  8. Spark on Yarn:任务提交参数配置

    当在YARN上运行Spark作业,每个Spark executor作为一个YARN容器运行.Spark可以使得多个Tasks在同一个容器里面运行. 以下参数配置为例子: spark-submit -- ...

  9. 运行 Spark on YARN

    运行 Spark on YARN Spark 0.6.0 以上的版本添加了在yarn上执行spark application的功能支持,并在之后的版本中持续的 改进.关于本文的内容是翻译官网的内容,大 ...

随机推荐

  1. 零元学Expression Blend 4 - Chapter 45 ListBox里的物件不能换行吗?

    原文:零元学Expression Blend 4 - Chapter 45 ListBox里的物件不能换行吗? ListBox里的排列不是垂直就是水平,觉得这样的排列很枯燥乏味吗? 想要它变聪明吗? ...

  2. UWP开发学习笔记1

    导航到页面: this.Frame.Navigate(typeof(SecondPage)); 导航进入当前页面时会调用OnNavigatedTo方法:导航从当前页面离开时会调用OnNavigatin ...

  3. 领域驱动设计(DDD)的实践经验分享之ORM的思考

    原文:领域驱动设计(DDD)的实践经验分享之ORM的思考 最近一直对DDD(Domain Driven Design)很感兴趣,于是去网上找了一些文章来看看,发现它确实是个好东西.于是我去买了两本关于 ...

  4. UWP-动态磁贴

    原文:UWP-动态磁贴 来自:IT追梦园 (http://www.zmy123.cn/?p=1172) UWP应用的一大特色就是动态磁贴,所以,你的应用如果还没有设置动态磁贴,那么,和我一起来为应用加 ...

  5. Delphi 10.2 非官方补丁合集

    Delphi 10.2 非官方补丁合集http://blog.qdac.cc/?p=4485 FMXObject和TFORM的释放都变成异步了.虽然能保证是在主线程中释放,但是Windows部分的线程 ...

  6. RIO的性能

    看了一下微软官网RIO没有达到四五倍的宣称(而且必须在windows 2012r2才可以)最多一倍github.com/aspnet/benchmarks测试代码可以从github.com/zelia ...

  7. qt sql事务操作

    事务是数据库的一个重要功能,所谓事务是用户定义的一个数据库操作序列,这些操作要么全做要么全不做,是一个不可分割的工作单位.在Qt中用transaction()开始一个事务操作,用commit()函数或 ...

  8. Kafka笔记3

    向Kafka写入消息从创建一个ProducerRecord对象开始,ProducerRecord需要包含目标主题和要发送的内容,我们还可以指定键或分区,在发送ProducerRecord对象时,生产者 ...

  9. Java多线程同步工具类之CountDownLatch

    在过去我们实现多线程同步的代码中,往往使用join().wait().notiyAll()等线程间通信的方式,随着JUC包的不断的完善,java为我们提供了丰富同步工具类,官方也鼓励我们使用工具类来实 ...

  10. Tido 习题-二叉树-树状数组求逆序对

    这里给大家提供一个全新的求逆序对的方法 是通过树状数组来实现的 题目描述   样例输入 Copy 5 2 3 1 5 4 样例输出 Copy 3 提示     #include<iostream ...