spark Master启动流程
spark Master是spark集群的首脑,负责资源调度,任务分配,负载平衡等功能
以下是master启动流程概述
通过shell进行对master进行启动
首先看一下启动脚本more start-master.sh
此时我们知道最终调用的是org.apache.spark.deploy.master.Master
这是Master源码:
- private[spark] object Master extends Logging {
- val systemName = "sparkMaster"
- private val actorName = "Master"
- //master启动的入口
- def main(argStrings: Array[String]) {
- SignalLogger.register(log)
- //创建SparkConf
- val conf = new SparkConf
- //保存参数到SparkConf
- val args = new MasterArguments(argStrings, conf)
- //创建ActorSystem和Actor
- val (actorSystem, _, _, _) = startSystemAndActor(args.host, args.port, args.webUiPort, conf)
- //等待结束
- actorSystem.awaitTermination()
- }
- /**
- * Returns an `akka.tcp://...` URL for the Master actor given a sparkUrl `spark://host:port`.
- *
- * @throws SparkException if the url is invalid
- */
- def toAkkaUrl(sparkUrl: String, protocol: String): String = {
- val (host, port) = Utils.extractHostPortFromSparkUrl(sparkUrl)
- AkkaUtils.address(protocol, systemName, host, port, actorName)
- }
- /**
- * Returns an akka `Address` for the Master actor given a sparkUrl `spark://host:port`.
- *
- * @throws SparkException if the url is invalid
- */
- def toAkkaAddress(sparkUrl: String, protocol: String): Address = {
- val (host, port) = Utils.extractHostPortFromSparkUrl(sparkUrl)
- Address(protocol, systemName, host, port)
- }
- /**
- * Start the Master and return a four tuple of:
- * (1) The Master actor system
- * (2) The bound port
- * (3) The web UI bound port
- * (4) The REST server bound port, if any
- */
- def startSystemAndActor(
- host: String,
- port: Int,
- webUiPort: Int,
- conf: SparkConf): (ActorSystem, Int, Int, Option[Int]) = {
- val securityMgr = new SecurityManager(conf)
- //利用AkkaUtils创建ActorSystem
- val (actorSystem, boundPort) = AkkaUtils.createActorSystem(systemName, host, port, conf = conf,
- securityManager = securityMgr)
- //通过ActorSystem创建Actor -> actorSystem.actorOf, 就会执行Master的构造方法->然后执行生命周期方法
- val actor = actorSystem.actorOf(
- Props(classOf[Master], host, boundPort, webUiPort, securityMgr, conf), actorName)
- val timeout = AkkaUtils.askTimeout(conf)
- val portsRequest = actor.ask(BoundPortsRequest)(timeout)
- val portsResponse = Await.result(portsRequest, timeout).asInstanceOf[BoundPortsResponse]
- (actorSystem, boundPort, portsResponse.webUIPort, portsResponse.restPort)
- }
- }
最终会通过Master的main函数进行最jvm进程启动
spark Master启动流程的更多相关文章
- Spark-源码-Spark-StartAll Master Worler启动流程
Spark start-all>> """Master启动流程""" Master类 class Master( host: S ...
- Spark启动流程(Standalone)- master源码
Master源码 package org.apache.spark.deploy.master //伴生类 private[deploy] class Master( override val rpc ...
- Spark Worker启动Driver和Executor工作流程
二:Spark Worker启动Driver源码解析 case LaunchDriver(driverId, driverDesc) => { logInfo(s"Asked to l ...
- Spark启动流程(Standalone)-分析
1.start-all.sh脚本,实际上执行java -cp Master 和 java -cp Worker 2.Master 启动时首先穿件一个RpcEnv对象,负责管理所有通信逻辑 3.Mast ...
- Spark基本工作流程及YARN cluster模式原理(读书笔记)
Spark基本工作流程及YARN cluster模式原理 转载请注明出处:http://www.cnblogs.com/BYRans/ Spark基本工作流程 相关术语解释 Spark应用程序相关的几 ...
- Spark配置&启动脚本分析
本文档基于Spark2.0,对spark启动脚本进行分析. date:2016/8/3 author:wangxl Spark配置&启动脚本分析 我们主要关注3类文件,配置文件,启动脚本文件以 ...
- 【Spark2.0源码学习】-4.Master启动
Master作为Endpoint的具体实例,下面我们介绍一下Master启动以及OnStart指令后的相关工作 一.脚本概览 下面是一个举例: /opt/jdk1..0_79/ ...
- 【Spark】部署流程的深度了解
文章目录 Spark核心组件 Driver Executor Spark通用运行流程图 Standalone模式运行机制 Client模式流程图 Cluster模式流程图 On-Yarn模式运行机制 ...
- Storm启动流程简介
storm启动流程 storm是一个流行的开源的,分布式实时处理框架,关于storm的基本介绍可以参加这篇官方文档.大致的拓扑结构如图所示: 其中Nimbus是一个后台 ...
随机推荐
- SpringBoot框架(5)-- @EableAutoConfiguration项目应用
场景:在项目中想在当前maven项目中自动装配其他自定义的Maven项目,例如,创建数据库配置中心,被夺多个maven引用,希望简单配置,就实现springboot自动装配数据库配置类. 由此我们联想 ...
- registry搭建及镜像管理
registry 的搭建 docker pull registry:2 docker run -d -v /opt/registry:/var/lib/registry -p 5000:5000 -- ...
- Codeforces Round #302 (Div. 2) D. Destroying Roads 最短路 删边
题目:有n个城镇,m条边权为1的双向边让你破坏最多的道路,使得从s1到t1,从s2到t2的距离分别不超过d1和d2. #include <iostream> #include <cs ...
- ELK结合logback
之前ELK的安装可以查看前面一篇博客 下面是我的logback的配置文件,通过logback的appender直接导入logstash <?xml version="1.0" ...
- js for循环中i++与++i有什么区别
平时都是这样写的for循环, 1 2 3 for(var i = 0; i < 20 ; i++){ .... } 但我看有的人这样写 for (var i = 0; ...
- onload,domcontentload区别+onload详解
todo onLoad是的在页面所有文件加载完成后执行 DomContentLoad是Dom加载完成后执行,不必等待样式脚本和图片加载 domContentLoad更为合理, 原理: 如果是webki ...
- socket的补充
- legend3---Windows 7/8/10 系统下Laravel框架的开发环境安装及部署详解(Vagrant + Homestead)
legend3---Windows 7/8/10 系统下Laravel框架的开发环境安装及部署详解(Vagrant + Homestead) 一.总结 一句话总结: 1.安装的话就是下载好git,va ...
- java中FastJson的json类型转换
JSON Gson: 来自Google,功能全面.快速.简洁.面向对象.数据传递和解析方便. Jackson:来源FasterXML项目,社区活跃,更新快 解析速度和效率比Gson快,但无法按需解析, ...
- leetcode234 回文链表 两种做法(stack(空间非O(1)),空间O(1))
link: leetcode234 回文链表 方法1, 快慢指针,把前半部分存入栈中和后半部分比较 public boolean isPalindrome(ListNode head) { if(he ...