hadoop生态--Hive(5)--Hive事务

支持事务的hive 表需要满足的条件:

1、必须是桶表

2、文件类型为orc格式(优化列模式文件)

3、在建表的最后添加 tblproperties('transactional'='true'); 

4、在建表之后添加一些属性配置(或配置到hive-site.xml中去)

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

示例:

create table zxz_data(name string,nid int,phone string,ntime date)
clustered by(nid) into 5 buckets
row format delimited
fields terminated by "\t"
lines terminated by "\n"
stored as orc
tblproperties('transactional'='true');

 

上一篇:阿里云Mysql导入大数据文件


下一篇:*** stack smashing detected ***: ./server terminated