mapred.max.split.size=256000000; // 决定每个map处理的最大的文件大小,单位为B
mapred.min.split.size.per.node=1; // 节点中可以处理的最小的文件大小
mapred.min.split.size.per.rack=1; // 机架中可以处理的最小的文件大小
mapred.reduce.tasks=10; -- 设置reduce的数量
hive.exec.reducers.bytes.per.reducer=1073741824 // 每个reduce处理的数据量,默认1GB
hive.merge.mapredfiles=false //reduce输出是否合并
hive.merge.mapfiles=true //map输出是否合并
hive.merge.smallfiles.avgsize=16000000 // 小文件大小
hive.mapred.mode=nonstrict //分为nonstrict,strict,默认是nonstrict;如果设置为strict,会对三种情况的语句在compile环节做过滤:笛卡尔积、order by 不加 limit、分区表不指定 partition predicate
hive.map.aggr=true // map端聚合,相当于combiner
hive.map.aggr.hash.force.flush.memory.threshold=0.9
hive.map.aggr.hash.min.reduction=0.5
hive.map.aggr.hash.percentmemory=0.5
hive.exec.reducers.max=200;
hive.groupby.mapaggr.checkinterval=100000 ; //group的键对应的记录条数超过这个值则会进行分拆,值根据具体数据量设置
hive.skewjoin.key=100000; //join的键对应的记录条数超过这个值则会进行分拆,值根据具体数据量设置
hive.optimize.skewjoin=true;--如果是join 过程出现倾斜 应该设置为true
hive.groupby.skewindata=true //数据倾斜优化,为true时,查询计划生产两个mapreduce,第一个mr随机处理,第二个按照业务主键聚合;如果是group by过程出现倾斜 应该设置为true
hive.exec.dynamic.partition=true //是否允许动态分区
hive.exec.max.dynamic.partitions=1000 //可以创建的最大动态分区数
hive.exec.max.dynamic.partitions.pernode=100 //each mapper or reducer可以创建的最大动态分区数
hive.exec.dynamic.partition.mode=nonstrict //strict是避免全分区字段是动态的,必须有至少一个分区字段是指定有值的 .另一个值为 nonstrict
//以下是配置阀值
hive.exec.max.created.files=100000 //可以创建的HDFS文件数
hive.error.on.empty.partition=false // 分区为空时是否抛出异常
hive.exec.parallel=true; //打开任务并行执行
hive.exec.parallel.thread.number=16; //同一个sql允许最大并行度,默认为8。
hive.exec.mode.local.auto=true; //使用本地模式运行,搭配下面参数优化简单查询效率
hive.exec.mode.local.auto.tasks.max=4;
hive.exec.mode.local.auto.inputbytes.max=33554432;(默认128MB)
hive.exec.compress.output=true
mapred.output.compression.codec=org.apache.hadoop.io.compress.SnappyCodec //对最终生成的Hive表的数据进行压缩
本文介绍了Hive的参数调优,包括mapred.max.split.size、mapred.reduce.tasks、hive.exec.reducers.bytes.per.reducer等关键参数,旨在优化map和reduce任务的分配,减少小文件数量,提高数据处理效率。此外,还涉及到map端聚合、动态分区和数据倾斜优化的配置策略。

1万+

被折叠的 条评论
为什么被折叠?



