正常登录hive数据库 发现其中test表无法操作,连基本的desc test命令都处于卡机状态,查询之后发现,原来是表被锁住了。因此,结合网上查询的一些方法,进行总结如下:
复制代码
1
2
3
4
5// 报错 FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. Current transaction manager does not support explicit lock requests.Transaction manager:org.apache.hadoop.hive.ql.lockmgr.DbTxnManager
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64// 1 查询是否锁表: hive> show locks ; // 2 发现表:test 被锁 // 3 临时解决办法 hive> unlock table test; //亲测这个命令基本没啥用,表依然处于无法操作状态,但是可以试试 hive> unlock table test partition(dt='2019-05-05'); //解锁分区锁命令可以用这个 // 4 关闭锁机制: hive> set hive.support.concurrency=false; // 默认为true /** 注:亲测这条命令暂时有用,运行之后可以对之前锁住的表进行查看、删除、修改等操作,但是 show locks 发现,之前被锁的表依然处于被锁状态 */ // 5 终极解决办法 直接找到 hive-site.xml 配置文件 [hadoop@hadoop01 ~]$ find / -name hive-site.xml [hadoop@hadoop01 conf]$ vi hive-site.xml // 追加 <property> <name>set hive.txn.manager</name> <value>org.apache.hadoop.hive.ql.lockmgr.DummyTxnManager</value> </property> ------------------------------------------------ 注:hive-site.xml中如有下列配置(可以不配置,因为默认为true)一定设置为true,如果设置成false则会报错!!!: <property> <name>set hive.support.concurrency</name> <value>true</value> </property> ------------------------------------------------ // 6 修改完hive-site.xml配置,保存退出。重新登录hive: hive> use test_db; hive> show tables; test test_tb hive> drop table test; hive> show tables; test_tb 可以发现之前被锁的test已经可以实现删除操作。
如果底层元数据放在mysql数据库,也可以参考下列博文:
https://blog.csdn.net/qq_27493503/article/details/80892454
最后
以上就是忐忑时光最近收集整理的关于解决因hive表锁表,导致无法进行查询、删除等操作问题(实测,已解决)的全部内容,更多相关解决因hive表锁表内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复