9.8

没想到这么快就要开学 

前几天一直忙着迎新的事情 8'29来的 

1.spark主要有四种运行模式:Local、standalone、yarn、mesos。

  1)Local模式:在一台机器上,一般用于开发测试

  2)standalone模式:完全独立的spark集群,不依赖其他集群,分为Master和work。

    客户端向Master注册应用,Master向work发送消息,依次启动Driver,executor,Driver负责向executors发送任务消息。

  3)yarn模式:依赖于hadoop集群,yarn资源调度框架,将应用提交给yarn,在ApplactionMaster(相当于Stand alone模式中的Master)中运行driver,在集群上调度资源,开启excutor执行任务。

  4)Spark on Mesos模式:类似于yarn模式,运行在Mesos集群上(MesosApache下的开源分布式资源管理框架,它被称为是分布式系统的内核。Mesos最初是由加州大学伯克利分校的AMPLab开发的,后在Twitter得到广泛使用。)

2、启动方式:sparkShell

spark-shell通过不同的参数控制采用何种模式进行。 涉及两个参数:

--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).

  1)本地模式

./spark-shell --master local
./spark-shell --master local[2]  # 本地运行,两个worker线程,理想状态下为本地CPU core数

  2)standalone模式

./spark-shell --master spark://192.168.1.10:7077

  3)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 job部署模式:

通过启动spark-submit 形式提交作业任务时通过自定参数来指定作业部署模式。

eg:

//client模式
spark-submit --master yarn --deploy-mode client --class xxx --executor-memory 1g --executor-cores 2 --num-executors 4 xxx.jar 1000
//cluster模式 spark-submit --master yarn --deploy-mode cluster --class xxx --executor-memory 1g --executor-cores 2 --num-executors 4 xxx.jar 1000
posted @   晨观夕  阅读(35)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
点击右上角即可分享
微信分享提示