使用sqoop抽取一批数据进入集群:
MR抽取进来的大小是187.6 M 数据量 1516513
测试一: 用impala把批数据进行插入 ,结果同样数据用户impala形成的文件占用磁盘59M,相比MR减少3倍;
测试二:
使用如下参数:
set hive.exec.dynamic.partition=true;
set hive.exec.dynamic.partition.mode=nonstrict;
set hive.exec.compress.output=true
set mapred.output.compression.codec=org.apache.hadoop.io.compress.SnappyCodec
或者
set hive.exec.dynamic.partition=true;
set hive.exec.dynamic.partition.mode=nonstrict;
set mapred.output.compress=true
set mapred.output.compression.codec=org.apache.hadoop.io.compress.LzopCodec
或者
set mapred.output.compress=true
set mapred.output.compression.codec= org.apache.hadoop.io.compress.GzipCodec
查询impala生成的结果数据,用hive方式插入使用hive执行压缩参数进行;
查询hive生成的结果数据,用hive方式插入使用hive执行压缩参数进行;
测试结果:无压缩效果;不管是查询hive的结果还是查询impala的结果最终用hive插入新的表中;最终大小都是187.6 M
测试三: 用新的hive参数
测试结果:有压缩的效果。而且hive插入跟源数据大小没有关系,不管impala的结果还是hive操作的结果。最终用hiv插入的结果都是一样。压缩大小为34.8 M
set hive.exec.compress.output=true;
set mapred.output.compress=true;
set mapred.output.compression.codec=org.apache.hadoop.io.compress.GzipCodec;
set io.compression.codec=org.apache.hadoop.io.compress.GzipCodec;
set mapred.output.compression.type=BLOCK;