惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
H
Hacker News: Front Page
P
Palo Alto Networks Blog
T
ThreatConnect
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
T
True Tiger Recordings
P
Privacy & Cybersecurity Law Blog
B
Blog
IT之家
IT之家
Last Week in AI
Last Week in AI
F
Full Disclosure
Hacker News: Ask HN
Hacker News: Ask HN
C
Comments on: Blog
Microsoft Azure Blog
Microsoft Azure Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Microsoft Security Blog
Microsoft Security Blog
博客园 - 【当耐特】
N
News and Events Feed by Topic
NISL@THU
NISL@THU
腾讯CDC
雷峰网
雷峰网
Security Latest
Security Latest
李成银的技术随笔
M
Microsoft Research Blog - Microsoft Research
L
LangChain Blog
L
Lohrmann on Cybersecurity
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Check Point Blog
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
博客园 - Franky
N
News | PayPal Newsroom
V
V2EX
A
About on SuperTechFans
The Register - Security
The Register - Security
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google Online Security Blog
Google Online Security Blog
MyScale Blog
MyScale Blog
Cisco Talos Blog
Cisco Talos Blog
Vercel News
Vercel News
WordPress大学
WordPress大学
C
Cyber Attacks, Cyber Crime and Cyber Security
The Hacker News
The Hacker News
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
爱范儿
爱范儿
A
Arctic Wolf
L
LINUX DO - 最新话题
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

博客园 - MOBIN

播面--八股文利器:播客形式讲解八股文,文本题库永久免费! Docker部署Apollo配置中心 Actor模型原理 java并发编程--Runnable Callable及Future Spark Accumulators Hive集成HBase详解 Hive MapJoin Hive2.0函数大全(中文版) 深度剖析JDK动态代理机制 HBase二级索引的设计 通过BulkLoad的方式快速导入海量数据 Phoenix二级索引(Secondary Indexing)的使用 java并发编程--Executor框架 Spark常用函数讲解之Action操作 Java并发编程--Volatile详解 Spark常用函数讲解之键值RDD转换 图解堆排序 Spark函数详解系列之RDD基本转换 深入理解Scala的隐式转换
Spark Yarn-cluster与Yarn-client
MOBIN · 2016-09-09 · via 博客园 - MOBIN

摘要

在Spark中,有Yarn-Client和Yarn-Cluster两种模式可以运行在Yarn上,通常Yarn-Cluster适用于生产环境,而Yarn-Clientr更适用于交互,调试模式,以下是它们的区别

Spark插拨式资源管理

Spark支持Yarn,Mesos,Standalone三种集群部署模式,它们的共同点:Master服务(Yarn ResourceManager,Mesos master,Spark standalone)来决定哪些应用可以运行以及在哪什么时候运行,Slave服务(Yarn NodeManger)运行在每个节点上,节点上实际运行着Executor进程,此外还监控着它们的运行状态以及资源的消耗

Spark On Yarn的优势

1. Spark支持资源动态共享,运行于Yarn的框架都共享一个集中配置好的资源池

2. 可以很方便的利用Yarn的资源调度特性来做分类·,隔离以及优先级控制负载,拥有更灵活的调度策略

3.Yarn可以自由地选择executor数量

4.Yarn是唯一支持Spark安全的集群管理器,使用Yarn,Spark可以运行于Kerberized Hadoop之上,在它们进程之间进行安全认证 

Yarn-cluster VS Yarn-client

当在Spark On Yarn模式下,每个Spark Executor作为一个Yarn container在运行,同时支持多个任务在同一个container中运行,极大地节省了任务的启动时间

Appliaction Master

为了更好的理解这两种模式的区别先了解下Yarn的Application Master概念,在Yarn中,每个application都有一个Application Master进程,它是Appliaction启动的第一个容器,它负责从ResourceManager中申请资源,分配资源,同时通知NodeManager来为Application启动container,Application Master避免了需要一个活动的client来维持,启动Applicatin的client可以随时退出,而由Yarn管理的进程继续在集群中运行

Yarn-cluster

在Yarn-cluster模式下,driver运行在Appliaction Master上,Appliaction Master进程同时负责驱动Application和从Yarn中申请资源,该进程运行在Yarn container内,所以启动Application Master的client可以立即关闭而不必持续到Application的生命周期,下图是yarn-cluster模式

Yarn-cluster模式下作业执行流程:

1. 客户端生成作业信息提交给ResourceManager(RM)

2. RM在某一个NodeManager(由Yarn决定)启动container并将Application Master(AM)分配给该NodeManager(NM)

3. NM接收到RM的分配,启动Application Master并初始化作业,此时这个NM就称为Driver

4. Application向RM申请资源,分配资源同时通知其他NodeManager启动相应的Executor

5. Executor向NM上的Application Master注册汇报并完成相应的任务

Yarn-client

在Yarn-client中,Application Master仅仅从Yarn中申请资源给Executor,之后client会跟container通信进行作业的调度,下图是Yarn-client模式

Yarn-client模式下作业执行流程:

1. 客户端生成作业信息提交给ResourceManager(RM)

2. RM在本地NodeManager启动container并将Application Master(AM)分配给该NodeManager(NM)

3. NM接收到RM的分配,启动Application Master并初始化作业,此时这个NM就称为Driver

4. Application向RM申请资源,分配资源同时通知其他NodeManager启动相应的Executor

5. Executor向本地启动的Application Master注册汇报并完成相应的任务

下表是Spark Standalone与Spark On Yarn模式下的比较