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是一个后台 ...
随机推荐
- windows上部署hadoop(单机版)
在window系统开发程序时,远程linux服务器上的hadoop速度很慢,影响开发效率,能不能在本地搭建hadoop环境的?答案肯定的,且看下文如何在window上部署hadoop: (源文地址:h ...
- 数据库基本概念及Oracle基本语句
一.数据库分类 通常是按照数据模型的特点将传统数据库系统分成网状数据库.层次数据库和关系数据库三种. 1.网状数据库 顾名思义,网状数据库采用的是以记录类型为结点的网状数据模型,是一种导航式(Navi ...
- python运算符Ⅵ
Python成员运算符 除了以上的一些运算符之外,Python还支持成员运算符,测试实例中http://www.xuanhe.net/包含了一系列的成员,包括字符串,列表或元组. 实例(Python ...
- shiro框架学习-9-shiroSession
1.什么是会话session : 用户和程序直接的链接,程序可以根据session识别到哪个用户,和javaweb中的session类似 2. 什么是会话管理器SessionManager : 会话管 ...
- docker-compose命令及yaml文件
Docker-compose常用命令 docker-compose up -d nginx 构建建启动nignx容器 docker-compose exec nginx bash 登录到nginx容器 ...
- Redis实战(十二)Redis实现分布式锁
序言 SET my_key my_value NX PX milliseconds 资料 如何优雅地用Redis实现分布式锁?
- #383 Div1 Problem B Arpa's weak amphitheater.... (分组背包 && 并查集)
题意 : 有n个人,每个人都有颜值bi与体重wi.剧场的容量为W.有m条关系,xi与yi表示xi和yi是好朋友,在一个小组. 每个小组要么全部参加舞会,要么参加人数不能超过1人. 问保证总重量不超过W ...
- [jvm学习笔记]-类加载过程
JVM类加载的过程 加载=>验证=>准备=>解析=>初始化 5个阶段所执行的具体动作 加载 在加载阶段,虚拟机需要完成3个事情1.通过一个类的全限定名获取定义此类的二进制字节流 ...
- Android图片上传(头像裁切+原图原样)
下面简单铺一下代码: (一)头像裁切.上传服务器(代码) 这里上边的按钮是头像的点击事件,弹出底部的头像选择框,下边的按钮跳到下个页面,进行原图上传. ? 1 2 3 4 5 6 7 8 9 10 1 ...
- 当SQL Server出现当 MUST_CHANGE 为 ON (开)时
取消账号强制策略时出现错误 当 MUST_CHANGE 为 ON (开)时,不能将 CHECK_POLICY 和 CHECK_EXPIRATION 选项设为 OFF (关). (Microsoft S ...