apache-spark - HIVE:插入查询失败并出现错误“java.lang.OutOfMemoryError:超出 GC 开销限制”
问题描述
我的 Hive 插入查询因以下错误而失败:java.lang.OutOfMemoryError:超出 GC 开销限制
table2 中的数据 = 1.7tb 查询:
set hive.exec.dynamic.partition.mode= nonstrict;set hive.exec.dynamic.partition=true;set mapreduce.map.memory.mb=15000;set mapreduce.map.java.opts=-Xmx9000m;set mapreduce.reduce.memory.mb=15000;set mapreduce.reduce.java.opts=-Xmx9000m;set hive.rpc.query.plan=true;
insert into database1.table1 PARTITION(trans_date) select * from database1.table2;
错误信息:在 1 中启动作业 1 由于没有 reduce 运算符,因此减少任务的数量设置为 0 失败:执行错误,从 org.apache.hadoop.hive.ql.exec.mr.MapRedTask 返回代码 -101。超出 GC 开销限制
集群信息:总内存:1.2TB 总 vcores:288 个节点总数:8 个节点版本:2.7.0-mapr-1808
请注意:我正在尝试将镶木地板格式的表 2 中的数据插入 ORC 格式的表 1。数据大小总共为 1.8TB。
解决方案
通过分区键添加分发应该可以解决问题:
insert into database1.table1 PARTITION(trans_date) select * from database1.table2
distribute by trans_date;
distribute by trans_date
会触发reducer step,每个reducer都会处理单个partition,这样可以减少内存压力。当每个进程写入许多分区时,它会在内存中为 ORC 保留过多的缓冲区。
还可以考虑添加此设置来控制每个 reducer 将处理多少数据:
set hive.exec.reducers.bytes.per.reducer=67108864; --this is example only, reduce the figure to increase parallelism
推荐阅读
- javascript - TypeError statusText:Django 中使用 Ajax 的简单帖子“LIKE”功能的“内部服务器错误”
- python - 为什么使用 Series 设置 MultiIndex 数据框会给出一列 NaN?
- tfs - 如何在扩展的对话框中显示 TFS 工作项?
- javascript - 将 JSON.parse 与 Node.js 一起使用时获得更详细的错误消息
- javascript - Chrome 扩展程序在选项卡中接收消息。chrome.tabs.sendMessage
- php - 限制评论 wordpress
- php - 内连接-Laravel
- java - 无法在Java中连接两个句子
- r - 如何在 R 中列出多个计算的结果
- loops - Pascal 中的“for i:=0 to i”循环 - 为什么它会起作用?