悬赏800人民币求解决hive中遇到的这个问题.docx


立即下载 咿呀哟
2026-02-17
hiveserver true Hive 文件 设置 启动 eline 参考 delta files
615.4 KB

hive ACID compaction问题
使用的是hive2.1.1(换成hive2.0.0也试过)。mysql作为meta storedb。使用的是hiveserver2 (直接hive也试过)
想要达到数据实时流入(写入)Hive的需求(HDFS作为存储),可以开启Hive的ACID功能并且使用ORC文件格式。它每次写入都会产生一些目录/文件(delta files)。这些delta files 满足一定条件就可以触发compaction(压缩),将它合并成一个大的文件,这样就不会对HDFS的NameNode产生压力。
具体原理参考:
https://cwiki.apache.org/confluence/display/Hive/Hive+Transactions
example可参考:
https://community.hortonworks.com/articles/49949/test-7.html
参照上述文档。我在hive-site.xml中对下面属性做了设置
hive.support.concurrency – true
hive.zookeeper.quorum - 192.168.2.233 (自己添加)
hive.enforce.bucketing – true (Hive 2.0之后不需要设置)
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 – 5
启动hiveserver2:
hiveserver2 &
启动 beeline:
beeline
连接hiveserver2:
!connect jdbc:hive2://192.168.2.233:10000 bigdata org.apache.hive.jdbc.HiveDriver
如下图:
然后创建一个表
CREATE TABLE users (
id int,
name string
)
CLUSTERED BY (id) INTO 2 BUCKETS STO


hiveserver/true/Hive/文件/设置/启动/eline/参考/delta/files/ hiveserver/true/Hive/文件/设置/启动/eline/参考/delta/files/
-1 条回复
登录 后才能参与评论
-->