CDH之HIVE-ON-SPARK、Spark配置

Spark读写Hive 环境:CDH5.8,Spark:1.6.0;Hadoop:2.6.0,Intellij IDEA14 ,jdk1.8,sdk:2.10.6 ,maven:3.3.3;工程下载地址:1. Spark读取HiveSpark读取Hive,使用的是HiveContext,第一步使用sc生成一个HiveContext,然后其他操作就是在HiveContext里面操作了;比如使用HiveContext的tab 阅读详情

HIVE ON SPARK配置

CDH6.3.2的HIVE版本为:2.1.1+cdh6.3.2

HIVE默认引擎

hive.execution.engine

Driver配置

spark.driver

配置名称说明建议
spark.driver.memory用于Driver进程的内存YARN可分配总内存的10%
spark.driver.memoryOverhead集群模式下每个Driver进程的堆外内存 D r i v e r 内存 × 0.1 Driver内存 \times 0.1 Driver内存×0.1
spark.yarn.driver.memoryOverhead和spark.driver.memoryOverhead差不多,YARN场景专用 A M 内存 × 0.1 AM内存 \times 0.1 AM内存×0.1
spark.driver.cores集群模式下,用于Driver进程的核心数

Executor配置

spark.executor

配置名称说明建议
spark.executor.cores单个Executor的CPU核数4
spark.executor.memoryExecutor进程的堆内存大小,用于数据的计算和存储
spark.executor.memoryOverheadExecutor进程的堆外内存,用于JVM的额外开销,操作系统开销等spark.executor.memoryOverhead=
spark.executor.memory × \times × 0.1
spark.executor.instances静态分配executor数量不使用静态分配

Spark on YARN的内存模型

Executor数量动态分配

spark.dynamicAllocation

配置名称说明建议
spark.dynamicAllocation.enabled是否启用 Executor个数动态调配启用
spark.dynamicAllocation.initialExecutors初始Executor个数
spark.dynamicAllocation.minExecutors最少Executor个数1
spark.dynamicAllocation.maxExecutors最多Executor个数
spark.dynamicAllocation.executorIdleTimeoutExecutor闲置超时就会被移除默认60秒
spark.dynamicAllocation.schedulerBacklogTimeout待处理的任务积压超时就会申请启动新的Executor默认1秒
  • 假设某节点 NM 有16个核可供Executor使用
    若spark.executor.core配置为4,则该节点最多可启动4个Executor
    若spark.executor.core配置为5,则该节点最多可启动3个Executor,会剩余1个核未使用
  • Executor个数的指定方式有两种:静态分配和动态分配
    • 动态分配可根据一个Spark应用的工作负载,动态地调整Executor数量
      资源不够时增加Executor,Executor不工作时将被移除
      启用方式是spark.dynamicAllocation.enabled设为true

Spark配置

CDH6.3.2的Spark版本为:2.4.0+cdh6.3.2

shuffle服务

  • 启用了动态分配Executor数量的情况下,shuffle服务允许删除Executor时保留其编写的shuffle文件
    每个工作节点上都要设置外部shuffle服务

spark.shuffle.service

Property Name说明版本始于建议
spark.shuffle.service.enabled启用额外shuffle服务,可保存Executor写的shuffle文件,从而可以安全移除工作完的Executor,或者在Executor失败的情况下继续获取shuffle文件1.2.0开启
spark.shuffle.service.port外部shuffle服务的端口1.2.0默认

配置建议

  • 大数据集群分为管理节点和工作节点,建议:
    管理节点的逻辑核数:内存(G)=1:2或1:4
    工作节点的逻辑核数:内存(G)=1:4或1:8

  • 建议给到 NM 约80%服务器资源,例如服务器有128G和32核,则:
    yarn.nodemanager.resource.memory-mb可给100G
    yarn.nodemanager.resource.cpu-vcores可给25

工作节点p101p102p103p104总max
内存(G)128128128128512128
逻辑CPU个数(虚拟核心数)3232323212832
NM 可分配内存(G)yarn.nodemanager.resource.memory-mb100100100100400100
NM 可分配虚拟核心数yarn.nodemanager.resource.cpu-vcores2525252510025
  • MapReduce
    AM内存:12G
    AM虚拟核心数:3
    Map内存:20G(单节点yarn.nodemanager.resource.memory-mb的约数)
    Map虚拟核心数:5(单节点yarn.nodemanager.resource.cpu-vcores的约数)
    Reduce内存:20G
    Reduce虚拟核心数:5
  • Spark
    spark.driver.memory:10.8G
    spark.driver.memoryOverhead:1.2G
    spark.executor.memory:18G
    spark.executor.memoryOverhead:2G
    spark.executor.cores:5

Spark On YARN Cluster,Driver在ApplicationMaster中启动,Driver内存应小于AM内存

yarn.nodemanager.resource.memory-mb>50G,此时建议Driver内存为12G

附录

英🔉中
idleˈaɪd(ə)ladj. 无事可做的;闲置的;v. 无所事事;(发动机、车辆)空转
overheadˌoʊvərˈhedadv. 在头顶上方;adj. 头顶上的;n. 营运费用;日常管理费;间接费用
backlogˈbæklɔːɡn. 积压的工作
pendingˈpendɪŋadj. 待定的,待处理的;即将发生的;prep. 直到……为止:v. 等候判定或决定
pendpendv. 等候判定;悬挂

原文地址:spark.apache.org/docs/latest=>Configuration

Application PropertiesDefault MeaningSinceVersion
spark.executor.memory1gAmount of memory to use per executor process, in the same format as JVM memory strings with a size unit suffix (“k”, “m”, “g” or “t”) (e.g. 512m, 2g).0.7.0
spark.executor.memoryOverheadexecutorMemory * 0.10, with minimum of 384Amount of additional memory to be allocated per executor process, in MiB unless otherwise specified. This is memory that accounts for things like VM overheads, interned strings, other native overheads, etc. This tends to grow with the executor size (typically 6-10%). This option is currently supported on YARN and Kubernetes.

Note: Additional memory includes PySpark executor memory (when spark.executor.pyspark.memory is not configured) and memory used by other non-executor processes running in the same container. The maximum memory size of container to running executor is determined by the sum of spark.executor.memoryOverhead, spark.executor.memory, spark.memory.offHeap.size and spark.executor.pyspark.memory.
2.3.0
Dynamic AllocationDefault MeaningSinceVersion
spark.dynamicAllocation.enabledfalseWhether to use dynamic resource allocation, which scales the number of executors registered with this application up and down based on the workload.
This requires spark.shuffle.service.enabled or spark.dynamicAllocation.shuffleTracking.enabled to be set. The following configurations are also relevant: spark.dynamicAllocation.minExecutors, spark.dynamicAllocation.maxExecutors, and spark.dynamicAllocation.initialExecutors spark.dynamicAllocation.executorAllocationRatio
1.2.0
spark.dynamicAllocation.executorIdleTimeout60sIf dynamic allocation is enabled and an executor has been idle for more than this duration, the executor will be removed. For more detail, see this description.1.2.0
spark.dynamicAllocation.cachedExecutorIdleTimeoutinfinityIf dynamic allocation is enabled and an executor which has cached data blocks has been idle for more than this duration, the executor will be removed.1.4.0
spark.dynamicAllocation.initialExecutorsspark.dynamicAllocation.minExecutorsInitial number of executors to run if dynamic allocation is enabled.
If --num-executors (or spark.executor.instances) is set and larger than this value, it will be used as the initial number of executors.
1.3.0
spark.dynamicAllocation.maxExecutorsinfinityUpper bound for the number of executors if dynamic allocation is enabled.1.2.0
spark.dynamicAllocation.minExecutors0Lower bound for the number of executors if dynamic allocation is enabled.1.2.0
spark.dynamicAllocation.executorAllocationRatio1By default, the dynamic allocation will request enough executors to maximize the parallelism according to the number of tasks to process. While this minimizes the latency of the job, with small tasks this setting can waste a lot of resources due to executor allocation overhead, as some executor might not even do any work. This setting allows to set a ratio that will be used to reduce the number of executors w.r.t. full parallelism. Defaults to 1.0 to give maximum parallelism. 0.5 will divide the target number of executors by 2 The target number of executors computed by the dynamicAllocation can still be overridden by the spark.dynamicAllocation.minExecutors and spark.dynamicAllocation.maxExecutors settings2.4.0
spark.dynamicAllocation.schedulerBacklogTimeout1sIf dynamic allocation is enabled and there have been pending tasks backlogged for more than this duration, new executors will be requested.1.2.0
spark.dynamicAllocation.sustainedSchedulerBacklogTimeoutschedulerBacklogTimeoutSame as spark.dynamicAllocation.schedulerBacklogTimeout, but used only for subsequent executor requests.1.2.0
spark.dynamicAllocation.shuffleTracking.enabledfalseExperimental. Enables shuffle file tracking for executors, which allows dynamic allocation without the need for an external shuffle service. This option will try to keep alive executors that are storing shuffle data for active jobs.3.0.0
spark.dynamicAllocation.shuffleTracking.timeoutinfinityWhen shuffle tracking is enabled, controls the timeout for executors that are holding shuffle data. The default value means that Spark will rely on the shuffles being garbage collected to be able to release executors. If for some reason garbage collection is not cleaning up shuffles quickly enough, this option can be used to control when to time out executors even when they are storing shuffle data.3.0.0
基于CDH 6.3.0 搭建 Hive on Spark 及相关配置和调优 CDH6针对hive on spark的调优文档,这个是生产的实战经验 立即下载

相关推荐

西门子精致面板TP1200 历史数据(历史数据、审计追踪) 移存到网络路径

TP1200 审计追踪

zhang080602的博客 5777

Hive On Spark搭建(cdh)

hive 和 spark版本之前有强对应关系 apache hive 和 spark 对应关系表 master 2.3.0 3.0.x 2.3.0 2.3.x 2.0.0 2.2.x 1.6.0 2.1.x 1.6.0 2.0.x 1.5.0 1.2.x 1.3.1 1.1.x 1.2.0 ...

xw514124202的博客 2851

提示词工程的几个参数

低 temperature + 低 top-p:输出最稳定、最可靠,适合需要准确性和一致性的场景。高 temperature + 高 top-p:输出最多样化、最富有创意,适合需要灵感和探索的场景。Max Length:您可以通过调整max length来控制大模型生成的 token 数。指定 Max Length 有助于防止大模型生成冗长或不相关的响应并控制成本。是一个字符串,可以阻止模型生成 token,指定是控制大模型响应长度和结构的另一种方法。例如,您可以通过添加 “11” 作为。

weixin_44212787的博客 1829

cdh6.3.2配置Hive on Spark

环境:戴尔xps15(32G内存、1T固态、外接雷电3接口的三星1T移动固态、WD Elements的4T外接机械硬盘)win10三台Centos7虚拟机用于测试cdh6.3.2集群(免费的社区版的最高版本)以及自编译phoenix5.1.0、flink1.10.0、elasticsearch6.6.0等各源码。 首先,该集群试用企业版功能到期后,无法启动Reports Manager角色(见...

benpaodexiaowoniu的博客 6442

(秋招复习)一些SLAM基础

秋招复习--SLAM基础知识篇

weixin_45432823的博客 769

Android实战——白天黑夜模式设置

白天黑夜模式是一种动态的UI模式,根据当前时间或用户设置的偏好,在白天和黑夜之间进行切换。它通过调整应用程序的颜色、亮度和其他可视化元素来提供更加舒适和易读的用户界面。

小旭的专栏 5230

cdh6.2.1下hive on spark配置使用,hue使用,beeline使用,hive-jdbc使用及日志进度获取

CDH6.2.1 环境 1、开启hive on spark配置: 在hive配置中搜索 spark ,更改一下配置: YARN 服务上的 Spark 选择spark 默认执行引擎 hive.execution.engine :spark 执行程序初始数 spark.dynamicAllocation.initialExecutors :2 ,启动sparksession时,默认初始启动的executor个数,如果配置了 set spark.executor.instances=3 (启动的e

weixin_43455443的博客 2901

数据库小技能:数据导入脚本

背景:版本大升级,从2.0升级到3.0 ,服务端开发语言从c#换到java语言。数据库类型从microsalft sql server 换到mysql。数据来源于微信,用于查询卡bin。

专注于计算机研发知识和资讯分享 774

Hive on Spark系列一:CDH5.5配置支持hive on spark

CDH 5.4以后引入了Hive on Spark,但是在CDH5.5.x中是不被推荐使用的。为了尝试这一特性,请使用测试环境直到Cloudera解决了当前存在的问题和局限性来确保它能用于生产环境。

雪地车的博客 8887

Vue+Echarts监控大屏实例四:智慧农业监控模板实例

本实例通过Vue-Echarts实现了智慧农业监控模板实例界面,学习并使用了vue-echarts的使用,接入高德地图并展示,添加了全屏切换、加载动画小鼓、站点切换及退出等相关功能,提供源码下载。

Java、前端、小程序学习笔记、问题汇总、项目实例分享,有需要请联系。 7671

从苏宁电器到卡巴斯基第02篇:我的本科时光(中)

怎么还分班了呢? 大概是在大二第二学期的时候吧,学院突然通知我们要分班。因为我们目前所有学生都是属于工商管理专业的,而从下个学期开始,就要分为会计、市场营销以及工商管理这三个方向。这还真是打了我一个措手不及,我都不知道还有分班这一回事。不过也没关系,我继续选择我的工商管理就好了。不过,在实际的选择结果上,像会计和工商管理这种学科,选的人自然是占了绝大多数,而选择市场营销的,大概也就是十

Gleam的专栏 9608

CDH 6.3.0 环境下 Hive on Spark 的搭建、配置与调优指南

CDH 6.3.0 环境下 Hive on Spark 的搭建、配置与调优指南 【下载地址】CDH6.3.0环境下HiveonSpark的搭建配置与调优指南 在CDH 6.3.0环境下,Hive on Spark的搭建、配置与调优指南为您提供了一站式解决方案。本文档基于实际生产经验,详细指导如何在CDH平台上高效部署Hi...

gitblog_06758的博客 726

多任务统一框架:基于YOLO26实现检测+分割+姿态估计的一站式落地

工业视觉落地最头疼的就是多任务场景:比如快递智能分拣线,要同时检测快递类别、实例分割快递包装区域、检测快递面单的关键点用来扫码;再比如汽车零部件检测,要同时检测缺陷类别、分割缺陷区域、检测安装孔的关键点。原来的方案是部署三个独立的模型,不仅硬件成本高,多模型的结果同步也麻烦,延迟还高。上个月我给某快递分拣中心做升级,用YOLO26的多任务统一框架,一个模型同时完成检测、实例分割、关键点检测三个任务,硬件成本直接降了一半,端到端延迟从120ms降到45ms,三个任务的精度还都比原来的单任务模型高了1-2%

专注于Python爬虫开发,分享爬虫技巧、项目实战与反爬经验,使用Scrapy、BeautifulSoup等工具,解决数据抓取难题。 826

CDH6.3.0环境下Hive on Spark的搭建配置与调优指南:让大数据处理更高效

CDH6.3.0环境下Hive on Spark的搭建配置与调优指南:让大数据处理更高效 【下载地址】CDH6.3.0环境下HiveonSpark的搭建配置与调优指南 在CDH 6.3.0环境下,Hive on Spark的搭建、配置与调优指南为您提供了一站式解决方案。本文档基于实际生产经验,详细指导如何在CDH平台上高...

gitblog_06723的博客 436

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

STM32F407中文手册

STM32f407中文手册 本参考手册面向应用开发人员,提供有关使用 STM32F405xx/07xx、STM32F415xx/17xx、 STM32F42xxx 和 STM32F43xxx 微控制器存储器与外设的完整信息。STM32F405xx/07xx、STM32F415xx/17xx、STM32F42xxx 和 STM32F43xxx 构成一个微 控制器系列,各产品具有不同的存储器大小、封装和外设。有关订购信息以及器件的机械与电气特性,请参见数据手册。有关 ARM Cortex™-M4F 内核的信息,请参见《Cortex™-M4F 技术参考手册》。

CDH-hive的引擎换为spark:hive on spark

CDH-hive的引擎换为spark:hive on spark

DCHAO的博客 4207

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

CDH6.0、6.1篇:8、CDH的 hive on spark配置及解析、优化

分三个章节 1、版本展示 2、CDH安装spark 3、优化配置信息 ----------------------分割线---------------------------------------- 1、版本展示 1.所有版本:https://www.scala-lang.org/download/all.html 2.11.8版本:https://www.scala-lang.org/dow...

laughing1997的博客 8317

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

CDH 5.14x 配置hive on spark

cdh版本为5.14 网上搜hive on spark大都5.9之前或更早,看着挺麻烦的 话不多说 首先在CDH界面,hive配置搜索execution 默认时MR,选spark就ok了 然后提示过期配置重启服务,重启的话重启失败,报如下错误 还需要配置服务依赖,找到下面这个 默认时none,选择spark,重启就ok了。 进hive cli,随便执行一个sql语句 ...

zhaolq1024的博客 2456

CDH5上离线安装Spark2.3并配置hive on spark2

2019独角兽企业重金招聘Python工程师标准>>> ...

weixin_34153893的博客 1422

zeppelin on CDH及配置spark查询hive表

2019独角兽企业重金招聘Python工程师标准>>> ...

weixin_33727510的博客 2248

基于CDH 5.9.1 搭建 Hive on Spark 及相关配置和调优

  Hive默认使用的计算框架是MapReduce,在我们使用Hive的时候通过写SQL语句,Hive会自动将SQL语句转化成MapReduce作业去执行,但是MapReduce的执行速度远差与Spark。通过搭建一个Hive On Spark可以修改Hive底层的计算引擎,将MapReduce替换成Spark,从而大幅度提升计算速度。接下来就如何搭建Hive On Spark展开描述。 ...

weixin_30954607的博客 127

Hive on Spark操作

https://www.cloudera.com/documentation/enterprise/latest/topics/admin_hos_oview.html Configuring the Hive Dependency on a Spark Service By default, if a Spark service is available, the Hive dependen...

争当鲲鹏飞万里 不做燕雀恋子巢 2372

【hive和spark】hive on spark和spark读取hive metastore配置

hive on spark和spark读取hive metastore配置

lisacumt的专栏 1597

如何在spark-shell命令行执行spark hql

前面已经有篇文章介绍如何编译包含hive的spark-assembly.jar了,不清楚的可以翻看一下前面的文章。 cloudera manager装好的spark,直接执行spark-shell进入命令行后,写入如下语句: val hiveContext = new org.apache.spark.sql.hive.HiveContext(sc)   你会发现没法执行通过,因为c

xiao_jun_0820的专栏 1万+
上一篇: 甜心教主:王心凌
下一篇: CDH6之Sqoop添加数据库驱动
小基基o_O
博客等级 码龄9年 4414粉丝 467原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

小基基o_O

您的鼓励是我创作的巨大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值