FAILED: SemanticException org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.RuntimeExcepti

2021/11/13 11:40:01

本文主要是介绍FAILED: SemanticException org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.RuntimeExcepti,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

记录下hive数据库启动之后,show databases;报错如下:

hive (default)> show functions;
FAILED: SemanticException org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient

hadoop集群和hive数据库之前我已经配置好的,启动啥的也是好的

原因:

我在hdfs的web管理网页上讲hive的文件数据清理一空,导致集群中的hive数据库中的数据丢失,然而mysql的存储的元数据又存在,故而在输入查询命令的时候会出现报错

解决办法:

  • 1.关闭hive和mysql数据库,在这只是退出来,在hive-site.xml文件末尾添加
<property>
    <name>datanucleus.schema.autoCreateAll</name>
    <value>true</value>
  </property>
  • 2.在mysql数据库中删除数据库hivemetadata 数据库,这是存储hive数据库中的所有元数据的,切记生产误用
drop database hivemetadata;
  • 3.在集群中所有装有hive的虚拟机中的hive根目录下bin目录下执行如下代码
hive --service metastore &

静静看日志,待出现

[root@linux123 bin]# hive --service metastore &
[1] 8523
[root@linux123 bin]# 2021-11-13 10:42:12: Starting Hive Metastore Server
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/lagou/servers/hive-2.3.7/lib/log4j-slf4j-impl-2.6.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/lagou/servers/hadoop-2.9.2/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
^C
[root@linux123 bin]# hive
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/lagou/servers/hive-2.3.7/lib/log4j-slf4j-impl-2.6.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/lagou/servers/hadoop-2.9.2/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]

Logging initialized using configuration in jar:file:/opt/lagou/servers/hive-2.3.7/lib/hive-common-2.3.7.jar!/hive-log4j2.properties Async: true
Hive-on-MR is deprecated in Hive 2 and may not be available in the future versions. Consider using a different execution engine (i.e. spark, tez) or using Hive 1.X releases.
hive (default)> show functions;
OK
tab_name
!
!=

说明metastore服务已开启,然后Ctrl+C,再hive,进去



这篇关于FAILED: SemanticException org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.RuntimeExcepti的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程