实战 - 部署 Spark Application 到集群
2017-07-21 09:50
211 查看
命令格式
【命令式】 spark-submit [options] <app jar | python file> [app options] 【例子】 spark-submit --master spark://host:7077 --executor-memory 10g my_script.py
参数 :
1. –master :指定 cluster connetion URL , 可以有多种集群设置模式:
值 | 说明 |
---|---|
spark://host:port | 连接到 spark standalone clustr ,默认端口为 7707 |
mesos://host:port | 连接到 mesos cluster , 默认端口为 5050 |
yarn | 连接到 Yarn cluster , 需要配置 HADOOP_CONF_DIR 环境变量 |
local | 运行在本地模式,单核运行 |
local | 运行在本地模式,使用n核运行 |
local[*] | 运行在本地模式,使用本机所有核运行 |
选项 | 说明 |
---|---|
–master | spark 连接 url |
–deploy-mode | 运行driver的模式, client , 则在执行spark-submit的机上运行; cluster ,则交给集群去指定一台机器运行;默认是 client 。 |
–class | main() 所在的 class ,要全名(针对java或scala)。 |
–name | 指定运行的应用名称,将会在 webui 上显示 。 |
–jars | 指定jar包列表,将添加到应用程序的 classpath 。 |
–files | 指定file列表,这些文件会被部署到集群节点上。 |
–py-files | 指定python文件、.zip文件 、 .eeg文件列表,将添加到应用程序的 PYTHONPATH 。 |
–executor-memory | 给executor申请内存。 |
–driver-memory | 给executor 申请内存。 |
部署到各cluster manager
部署 java 程序到 Standalone 使用 cluster 模式./bin/spark-submit \ --master spark://hostname:7077 \ --deploy-mode cluster \ --class com.databricks.examples.SparkExample \ --name "Example Program" \ --jars dep1.jar,dep2.jar,dep3.jar \ --total-executor-cores 300 \ --executor-memory 10g \ myApp.jar "options" "to your application" "go here"
部署 python 程序到 yarn 使用 client 模式
export HADOOP_CONF_DIR=/opt/hadoop/conf ./bin/spark-submit \ --master yarn --py-files somelib-1.2.egg,otherlib-4.4.zip,other-file.py \ --deploy-mode client \ --name "Example Program" \ --queue exampleQueue \ --num-executors 40 \ --executor-memory 10g \ my_script.py "options" "to your application" "go here"
相关文章推荐
- codis集群部署实战
- [实战] 用数人云,部署弹性 ELK 集群就五步
- docker 实战---部署tomcat\weblogic集群 (二)
- 实战CentOS系统部署Hadoop集群服务
- 实战CentOS6.3部署Hadoop集群服务
- jmeter压测集群部署和实战
- Ceph实战入门系列(一)——三节点Ceph集群的安装与部署
- 实战Centos系统部署Codis集群服务
- Centos7+nginx+tomcat 集群部署实战
- codis集群部署实战 - 入门篇
- codis集群部署实战
- 开源Nosql数据库Cassandra3.0实战-集群部署与插件使用
- 实战部署weblogic集群及发布应用(1)
- 实战Centos系统部署Codis集群服务
- Elasticsearch单机双节点集群部署实战
- 生产环境实战spark (11)分布式集群 5台设备 Zookeeper集群、Kafka集群安装部署
- J2EE集群开发部署实战
- CentOS 6.8 实战部署JStorm集群
- MyRocketMQ集群部署实战-双master-双slave-同步双写-异步刷盘(7台机器)
- 实战部署weblogic集群及发布应用(2)