hive归档分区

归档hive历史分区不会减少hdfs存储空间,但是可以有效减轻hadoop namenode的压力,尤其在于小文件比较多的情况下。

$mkdir $HIVE_HOME/auxlib

$ cp /opt/cdh-5.3.6/hadoop-2.5.0/share/hadoop/tools/lib/hadoop-archives-2.5.0-cdh5.3.6.jar /opt/cdh-5.3.6/hive-0.13.1/auxlib/hadoop-archives-2.5.0-cdh5.3.6.jar

 

hive (chavin)>  set hive.archive.enabled=true;                                    
hive (chavin)> alter table emp archive partition(country='china',state='beijing');
intermediate.archived is hdfs://db01:8020/user/hive/warehouse/chavin.db/emp/country=china/state=beijing_INTERMEDIATE_ARCHIVED
intermediate.original is hdfs://db01:8020/user/hive/warehouse/chavin.db/emp/country=china/state=beijing_INTERMEDIATE_ORIGINAL
Creating data.har for hdfs://db01:8020/user/hive/warehouse/chavin.db/emp/country=china/state=beijing
in hdfs://db01:8020/user/hive/warehouse/chavin.db/emp/country=china/state=beijing/.hive-staging_hive_2017-05-24_13-23-51_914_3548751700804069937-1/-ext-10000/partlevel
Please wait... (this may take a while)
Moving hdfs://db01:8020/user/hive/warehouse/chavin.db/emp/country=china/state=beijing/.hive-staging_hive_2017-05-24_13-23-51_914_3548751700804069937-1/-ext-10000/partlevel to hdfs://db01:8020/user/hive/warehouse/chavin.db/emp/country=china/state=beijing_INTERMEDIATE_ARCHIVED
Moving hdfs://db01:8020/user/hive/warehouse/chavin.db/emp/country=china/state=beijing to hdfs://db01:8020/user/hive/warehouse/chavin.db/emp/country=china/state=beijing_INTERMEDIATE_ORIGINAL
Moving hdfs://db01:8020/user/hive/warehouse/chavin.db/emp/country=china/state=beijing_INTERMEDIATE_ARCHIVED to hdfs://db01:8020/user/hive/warehouse/chavin.db/emp/country=china/state=beijing
Moved: 'hdfs://db01:8020/user/hive/warehouse/chavin.db/emp/country=china/state=beijing_INTERMEDIATE_ORIGINAL' to trash at: hdfs://db01:8020/user/hadoop/.Trash/Current
OK
Time taken: 2.17 seconds

 

可以看到,emp表下分区文件已经被打包成data.har文件了。

 

image

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值