美文网首页
spark-submit启动方式

spark-submit启动方式

作者: 王金松 | 来源:发表于2019-04-01 15:02 被阅读0次

参考
https://blog.csdn.net/wonderful_life_mrchi/article/details/77870670
之前的部署中yarn的模式中master可以指定yarn-cluster和yarn-client,并且deploy-model这个参数没有,但是之后这个参数已经过期了 ,现在采用的是master+deploy-mode共同决定,如果采用yarn的方式运行,master执行yarn,deploy-mode指定client或者cluster

本地模式

Spark单机运行,一般用于开发测试。
Standalone模式
构建一个由Master+Slave构成的Spark集群,Spark运行在集群中。
Spark on Yarn模式
Spark客户端直接连接Yarn。不需要额外构建Spark集群。
Spark on Mesos模式
Spark客户端直接连接Mesos。不需要额外构建Spark集群。
–master参数用于指定采用哪种运行模式。
对于Spark on Yarn模式和Spark on Mesos模式还可以通过 –deploy-mode参数控制Drivers程序的启动位置。
  • 进入本地模式:
./spark-shell --master local
./spark-shell --master local[2]  # 本地运行,两个worker线程,理想状态下为本地CPU core数
  • 进入Standalone模式:
./spark-shell --master spark://192.168.1.10:7077

备注:测试发现MASTER_URL中使用主机名替代IP地址无法正常连接(hosts中有相关解析记录),即以下命令连接不成功:

./spark-shell --master spark://ctrl:7077  # 连接失败
  • Spark on Yarn模式
./spark-shell --master yarn
./spark-shell --master yarn-client
#不支持这种模式
#./spark-shell --master yarn-cluster
./spark-shell --master yarn --deploy-mode client
#不支持这种模式
#./spark-shell --master yarn --deploy-mode cluster
  • Spark on Mesos模式:
./spark-shell --master mesos://host:port
./spark-shell --master mesos://host:port --deploy-mode client
./spark-shell --master mesos://host:port --deploy-mode cluster

启动方式: pyspark(Python)

参数及用法与Scala语言的spark-shell相同,比如:

pyspark --master local[2]
[admin@A01-R15-I55-237-40007D7 detection_test]$ spark-submit
Usage: spark-submit [options] <app jar | python file | R file> [app arguments]
Usage: spark-submit --kill [submission ID] --master [spark://...]
Usage: spark-submit --status [submission ID] --master [spark://...]
Usage: spark-submit run-example [options] example-class [example args]

Options:
  --master MASTER_URL         spark://host:port, mesos://host:port, yarn,
                              k8s://https://host:port, or local (Default: 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).

相关文章

网友评论

      本文标题:spark-submit启动方式

      本文链接:https://www.haomeiwen.com/subject/yjlvvqtx.html