spark-submit提交任务的方式

spark-submit命令

(集群模式)限制资源,资源不足时候会卡在分配资源(–total-executor-cores 和 –executor-cores为总数和单点cores数量)

spark-submit --class test.Streamings --master spark://192.168.3.74:7077 --deploy-mode cluster --executor-memory 1024M --total-executor-cores 5 sparkdemo-0.0.1.jar

(集群模式)控制台输出(不限制资源),可用于调试

spark-submit --class test.Streamings --master spark://192.168.3.74:7077 sparkdemo-0.0.1.jar

(集群模式)控制台无输出(不限制资源),提交任务,最大资源分配

spark-submit --class test.Streamings --master spark://192.168.3.74:7077 --deploy-mode cluster sparkdemo-0.0.1.jar

(单点模式)控制台输出

spark-submit --class test.Streamings sparkdemo-0.0.1.jar

官方附言

spark-submit –help

操作解析
–master MASTER_URLspark://host:port, mesos://host:port, yarn, or local.
–deploy-mode DEPLOY_MODEWhether to launch the driver program locally (“client”) or on one of the worker machines inside the cluster (“cluster”) (Default: client).在本地还是在集群内的某个工作机器上启动驱动程序,默认本地。
–class CLASS_NAMEYour application’s main class (for Java / Scala apps).app的入口类
–name NAMEA name of your application.app名称
–jars JARSComma-separated list of local jars to include on the driver and executor classpaths.多个jar用逗号分隔
–packagesComma-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.提供groupId:artifactId:version形式的maven库的jar包依赖,逗号分隔
–exclude-packagesComma-separated list of groupId:artifactId, to exclude while resolving the dependencies provided in –packages to avoid dependency conflicts.以逗号分隔的groupId:artifactId,以排除解析–packages中提供的依赖关系以避免依赖冲突。
–repositoriesComma-separated list of additional remote repositories to search for the maven coordinates given with –packages.
–py-files PY_FILESComma-separated list of .zip, .egg, or .py files to place on the PYTHONPATH for Python apps.用于Python应用程序的PYTHONPATH上的.zip,.egg或.py文件的逗号分隔列表。
–files FILESComma-separated list of files to be placed in the working directory of each executor.逗号分隔的文件列表
–conf PROP=VALUEArbitrary Spark configuration property.任意Spark配置属性。
–properties-file FILEPath to a file from which to load extra properties. If not specified, this will look for conf/spark-defaults.conf.指向要从其加载额外属性的文件的路径。 如果没有指定,这将寻找conf/spark-defaults.conf。
–driver-memory MEMMemory for driver (e.g. 1000M, 2G) (Default: 1024M).设置driver内存大小
–driver-java-optionsExtra Java options to pass to the driver.额外的Java选项给driver。
–driver-library-pathExtra library path entries to pass to the driver.额外的库路径给driver。
–driver-class-pathExtra class path entries to pass to the driver. Note that jars added with –jars are automatically included in the classpath.额外的类路径给driver。注意添加了 –jars 会自动包含在classpath下
–executor-memory MEMMemory per executor (e.g. 1000M, 2G) (Default: 1G).每个执行器的内存大小
–proxy-user NAMEUser to impersonate when submitting the application. This argument does not work with –principal / –keytab.用户在提交应用是代理。 这个参数不适用于–principal/–keytab。
–help, -hShow this help message and exit.帮助
–verbose, -vPrint additional debug output.打印调试信息
–version,Print the version of current Spark.输出版本

Spark standalone with cluster deploy mode only: 仅限Spark单机与群集部署模式

操作解析
–driver-cores NUMCores for driver (Default: 1).driver 核数,默认1

Spark standalone or Mesos with cluster deploy mode only: 仅限Spark单机或Mesos与群集部署模式

操作解析
–superviseIf given, restarts the driver on failure.如果给出,失败时重新启动驱动程序。
–kill SUBMISSION_IDIf given, kills the driver specified.如果给定,则会杀死指定的驱动程序。
–status SUBMISSION_IDIf given, requests the status of the driver specified.如果给出,请求指定的驱动程序的状态。

Spark standalone and Mesos only:仅限Spark单机和Mesos

操作解析
–total-executor-cores NUMTotal cores for all executors.所有执行器的核心总数。

Spark standalone and YARN only:仅限Spark单机和YARN

操作解析
–executor-cores NUMNumber of cores per executor. (Default: 1 in YARN mode, or all available cores on the worker in standalone mode) 每个执行器的核心数。 (默认值:YARN模式下为1,或单机模式下使用所有核)

YARN-only: 仅限YARN

操作解析
–driver-cores NUMNumber of cores used by the driver, only in cluster mode (Default: 1).仅在集群下使用,driver的核心数量,默认1
–queue QUEUE_NAMEThe YARN queue to submit to (Default: “default”).YARN队列名,默认叫default
–num-executors NUMNumber of executors to launch (Default: 2). If dynamic allocation is enabled, the initial number of executors will be at least NUM. 要启动的执行器数(默认值:2)。 如果启用动态分配,则初始执行者数将至少为NUM。
–archives ARCHIVESComma separated list of archives to be extracted into the working directory of each executor.逗号分隔的目录列表
–principal PRINCIPALPrincipal to be used to login to KDC, while running on secure HDFS.
–keytab KEYTABThe 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.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值