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是一个后台 ...
随机推荐
- LAMP 系统性能调优之内核调优措施
LAMP 系统性能调优之内核调优措施 2011-03-18 11:21 Sean A. Walberg 网络转载 字号:T | T 在对系统的 Apache.PHP 和 MySQL 组件进行调优之前, ...
- 【UOJ#450】[集训队作业2018] 复读机
题目链接 题目描述 群里有\(k\)个不同的复读机.为了庆祝平安夜的到来,在接下来的\(n\)秒内,它们每秒钟都会选出一位优秀的复读机进行复读.非常滑稽的是,一个复读机只有总共复读了\(d\)的倍数次 ...
- Python---面向对象的三大特征
# 面向对象的三大特征 - 继承 - 封装 - 多态 # 继承 - 子类可以使用父类定义的内容或者行为等 - 继承的实现 - 父类:基类,超类:被继承的类, Base Class, Super Cla ...
- U盘安装linux(CentOS Kali ubuntu)无法挂载_实测
最新的Kali linux官方下载地址: https://www.kali.org/downloads/ 刻录软件官网:http://rufus.ie/ 1.打开. 2.插入U盘. 3.自动下载插件. ...
- JAVA笔记28-正则表达式(补充、不重要)
一.Greedy(贪婪的)尽可能多的匹配,Reluctant(不情愿的)尽可能少的匹配.Possessive(独占的)不常用. Greedy 数量词 X? X,一次或一次也没有 X* X,零次或多次 ...
- Chrome开发者工具面板 F12 调试大全 记录
面板上包含了Elements面板.Console面板.Sources面板.Network面板.Timeline面板.Profiles面板.Application面板.Security面板.Audits ...
- cpu、gpu 安装框架pytorch,cntk,theano及测试
一,cpu 下安装 tensorflow conda env list source activate tensorflow 直接安装相应版本 python import tensorflow as ...
- Kotlin使用率达35%,Java要退位了?
在今年的Google I/O大会上,关于Kotlin,Google只说了只言片语: 在过去一年里,有35%的专业Android开发者在使用Kotlin,其中95%的开发者都对Kotlin非常满意. 之 ...
- Python连接MySQL之Python库pymysql
连接数据库 pymysql连接数据库的方式和使用sqlite的方式基本相同: 使用connect创建连接对象 connect.cursor创建游标对象,SQL语句的执行基本都在游标上进行 cursor ...
- cocos2d 15款游戏源码
https://blog.csdn.net/jailman/article/details/78678972