老大让启动一下hive,结果报错了,想办法解决,经过不懈努力,终于搞定了
hive> show databases;
FAILED: HiveException java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
hive>
出现这个问题的原因:
在 hive-site.xml
文件中配置了三个参数所引起的
hive.txn.manager、hive.support.concurrency、hive.metastore.uris
1
2
3
4
5
6
7
8
9
10<property> <name>hive.txn.manager</name> <value>org.apache.hadoop.hive.ql.lockmgr.DbTxnManager</value> </property> <property> <name>hive.support.concurrency</name> <value>true</value> </property>
经过不断测试(依次分别注释掉每个参数)注释掉下面这个参数,重启hive,问题就解决了
1
2
3
4
5
6
7<!-- <property> <name>hive.metastore.uris</name> <value>thrift:/hadoop139:9083</value> </property> -->
然后 hive启动后 show databases;
就没报错了,
并且创建表正常无报错
1
2create table kafkatable(id int,name string) clustered by(id) into 2 buckets stored as orc tblproperties('transactional'='true');```
之后,老大又让配了3个参数,参照 华为云官方文档
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15<property> <name>hive.exec.dynamic.partition.mode</name> <value>nonstrict</value> </property> <property> <name>hive.compactor.initiator.on</name> <value>true</value> </property> <property> <name>hive.compactor.worker.threads</name> <value>1</value> </property>
配完以后重启hive,依然可以正常使用
这还没完,老大说搞技术一定要严谨,让我去搜,把这些参数都查出来搞明白啥意思
参数 | 含义 |
---|---|
hive.support.concurrency | 0.7.0版本新增,一致性。默认关闭false,支持增、删、改事务才开启true;关闭并发可解决lock报错 FAILED: Error in acquiring locks: Locks on the underlying objects cannot be acquired. retry after some time |
hive.exec.dynamic.partition.mode | 0.6.0版本新增,动态分区 ,默认为strict ,设置为strict,向分区表装在数据时,为了防止用户意外覆盖所有分区,必须指定至少一个静态分区。若设置成nonstrict,则所有分区都允许动态生成,该值需要设置为true |
hive.txn.manager | hive锁管理器 |
hive.compactor.initiator.on | 是否在metastore实例上运行initiator和cleaner进程 |
hive.compactor.worker.threads | 设置有多少工作线程在Thrift metastore实例上运行 |
还有一个参数很特别,是 hive.metastore.uris
前面注释掉这个参数,解决了hive报错
1
2FAILED: HiveException java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
在hive服务端才能开启hive metastore服务
hive --service metastore -p 9083 &
这种方式去启动
Hive服务和metastore在不同的进程内
可能是不同的机器
将hive.metastore.uris
设置为metastore服务器URL
如果有多个metastore服务器,将URL之间用逗号分隔,metastore服务器URL的格式为thrift://127.0.0.1:9083
再介绍3个参数:
hive.exec.max.dynamic.partitions.pernode
(缺省值100):每一个mapreduce job允许创建的分区的最大数量,如果超过了这个数量就会报错hive.exec.max.dynamic.partitions
(缺省值1000):一个dml语句允许创建的所有分区的最大数量hive.exec.max.created.files
(缺省值100000):所有的mapreduce job允许创建的文件的最大数量
最后
以上就是飞快超短裙最近收集整理的关于解决Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient的全部内容,更多相关解决Unable内容请搜索靠谱客的其他文章。
发表评论 取消回复