hive在大容量倾斜数据集上的排序操作

inkz8wg9  于 2021-05-29  发布在  Hadoop
关注(0)|答案(1)|浏览(335)

我正在HortonWorks2.6.5上开发一个大约3TB大小的大数据集,数据集的布局非常简单。
数据的继承权如下-

-Country
   -Warehouse
      -Product
          -Product Type
              -Product Serial Id

我们在上面的层次结构中有30个国家的交易数据,每个国家有200多个仓库,单个国家美国占整个数据集的75%左右。
问题:
1) 我们有交易数据和交易日期列( trans_dt )对于每个仓库的上述数据集,我需要使用hive(1.1.2版本)mapreduce在每个仓库内按升序对事务进行排序。我已经在国家级创建了一个分区,然后应用了DistributedByWarehouseSortBy trans_dt asc公司;分拣大约需要8小时才能完成,最后6小时用于99%阶段的减速机。我在这个阶段看到了很多混乱。
2) 我们在这个组合上做了很多分组- Country,Warehouse,Product,Product Type,Product Serial Id 任何优化此操作的建议都将非常有用。
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;
w9apscun

w9apscun1#

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

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}')

相关问题