Hadoop 大容量倾斜数据集上的配置单元排序操作

Hadoop 大容量倾斜数据集上的配置单元排序操作,hadoop,hive,mapreduce,hortonworks-data-platform,skew,Hadoop,Hive,Mapreduce,Hortonworks Data Platform,Skew,我正在Hortonworks 2.6.5上开发一个大小约为3 TB的大型数据集,数据集的布局非常简单 数据的继承权如下- -Country -Warehouse -Product -Product Type -Product Serial Id 我们有30个国家的上述层次结构中的交易数据,每个国家有200多个仓库,单个国家的美国贡献了整个数据集的75%左右 问题: 1对于每个仓库的上述数据集,我们有带有trans_dt列的事务数

我正在Hortonworks 2.6.5上开发一个大小约为3 TB的大型数据集,数据集的布局非常简单

数据的继承权如下-

-Country
   -Warehouse
      -Product
          -Product Type
              -Product Serial Id
我们有30个国家的上述层次结构中的交易数据,每个国家有200多个仓库,单个国家的美国贡献了整个数据集的75%左右

问题:

1对于每个仓库的上述数据集,我们有带有trans_dt列的事务数据,我需要使用Hive 1.1.2版本MapReduce在每个仓库内按升序对trans_dt进行排序。我已经在国家级创建了一个分区,然后通过trans_dt ASC应用了按仓库排序分发;分拣大约需要8小时才能完成,最后6小时用于99%阶段的减速器。我在这个阶段看到了很多混乱

我们在这个组合上做了大量的分组-国家、仓库、产品、产品类型、产品序列号。任何优化此操作的建议都将非常有用

3如何处理美国国家的倾斜数据集

我们正在使用以下配置单元属性

SET hive.exec.compress.intermediate=true;
SET hive.intermediate.compression.codec=org.apache.hadoop.io.compress.SnappyCodec;
SET hive.intermediate.compression.type=BLOCK;
SET hive.exec.compress.output=true;
SET mapreduce.output.fileoutputformat.compress=true;
SET mapreduce.output.fileoutputformat.compress.codec=org.apache.hadoop.io.compress.SnappyCodec;
SET mapreduce.output.fileoutputformat.compress.type=BLOCK;
SET hive.auto.convert.join=true;
SET hive.auto.convert.join.noconditionaltask=true;
SET hive.auto.convert.join.noconditionaltask.size=10000000;
SET hive.groupby.skewindata=true;
SET hive.optimize.skewjoin.compiletime=true;
SET hive.optimize.skewjoin=true;
SET hive.optimize.bucketmapjoin=true;
SET hive.exec.parallel=true;
SET hive.cbo.enable=true;
SET hive.stats.autogather=true;
SET hive.compute.query.using.stats=true;
SET hive.stats.fetch.column.stats=true;
SET hive.stats.fetch.partition.stats=true;
SET hive.vectorized.execution.enabled=true;
SET hive.vectorized.execution.reduce.enabled=true;
SET hive.optimize.index.filter=true;
SET hive.optimize.ppd=true;
SET hive.mapjoin.smalltable.filesize=25000000;
SET hive.exec.dynamic.partition=true;
SET hive.exec.dynamic.partition.mode=nonstrict;
SET hive.exec.max.dynamic.partitions.pernode=1000;
SET mapreduce.reduce.memory.mb=10240;
SET mapreduce.reduce.java.opts=-Xmx9216m;
SET mapreduce.map.memory.mb=10240;
SET mapreduce.map.java.opts=-Xmx9216m;
SET mapreduce.task.io.sort.mb=1536;
SET hive.optimize.groupby=true;
SET hive.groupby.orderby.position.alias=true;
SET hive.multigroupby.singlereducer=true;
SET hive.merge.mapfiles=true;
SET hive.merge.smallfiles.avgsize=128000000;
SET hive.merge.size.per.task=268435456;
SET hive.map.aggr=true;
SET hive.optimize.distinct.rewrite=true;
SET mapreduce.map.speculative=false;
set hive.fetch.task.conversion = more;
set hive.fetch.task.aggr=true;
set hive.fetch.task.conversion.threshold=1024000000;

对于我们和非我们,使用相同的查询,但独立处理它们

Select * from Table where Country = 'US'
UNION
Select * from Table where Country <> 'US'

您可以使用一个脚本来处理它们,在该脚本中,一次查询一个国家,从而减少需要在一个实例中处理的数据量

INSERT INTO TABLE <AggregateTable>
SELECT * FROM <SourceTable>
  WHERE Country in ('${hiveconf:ProcessCountry}')

是交易日期还是时间戳?按国家划分是个坏主意。按日期划分更合适。trans_dt是string,但最终结果是扁平表,对吗?一个大的扁平表?您没有处理您提到的5个表层次结构吗?在这种情况下,按国家划分似乎是不好的选择,我会按仓库划分。另外-它是3 TB-我会切换到spark,它会为你节省很多时间。。。