配置Hive支持update

配置

  1. hive-site.xml配置参数(CDH的配置参考如下图)

    《配置Hive支持update》

    hive.support.concurrency=true
    hive.enforce.bucketing=true
    hive.exec.dynamic.partition.mode=nonstrict
    hive.txn.manager=org.apache.hadoop.hive.ql.lockmgr.DbTxnManager
    hive.compactor.initiator.on=true
    hive.compactor.worker.threads=1
    hive.in.test=true

  2. 数据分桶并制定存储格式这个必须指定,要不会报错
    2.1 因为load导入数据的时候,只能分区不能分桶,所以先先将数据导入一个没有分桶的临时表,然后insert into有分桶的表中。

    create table test_tmp(
    id string,
    name string
    )row format delimited fields terminated by '\t';
    
    create table test(key string,
    id string,
    name string,
    device_id string)clustered by (name) into 2 buckets stored as orc TBLPROPERTIES('transactional'='true');
    

ORC压缩率和查询

  1. 压缩率

    《配置Hive支持update》 image.png

  2. 查询和更新效率
    更新效率没有明明显变化,查询count,1.2亿数据3分钟,orc存储的5分钟,具体的mapper和reducer的个数不同。

更多配置大家请参考

    原文作者:忘净空
    原文地址: https://www.jianshu.com/p/d28bb884a9bb
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞