【已解决】org.apache.hadoop.hive.metastore.hivemetaexception: failed to get schema version.

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/Handoking/article/details/81388143

在stackoverflow上查阅大量相关的问题后我发现,这个问题并不是各个中文博客上所说的版本太新的问题,归根结底是hive没有连上数据库。与ERROR:”Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient”这个错误解决方法一致。
解决办法:
首先要确保你hive,mysql配置文件已经正确配置。正确的配置文件请看我的另一篇文章。安装与配置过程参考我的这篇文章https://blog.csdn.net/handoking/article/details/81227210

在命令行运行:

1.source /usr/local/hive/scripts/metastore/upgrade/mysql/hive-schema-3.0.0.mysql.sql//使这个版本的配置文件有用!注意更换文件路径
2.schematool -dbType mysql -initSchema进行初始化.运行显示成功就可以正常通信了。

如果情况这么简单那是万福了,往往情况是你运行上面第二句时产生错误:

Error: Duplicate entry 'org.apache.hadoop.hive.metastore.model.MNotificationLog' for key 'PRIMARY'(state=23000,code=1062)org.apache.hadoop.hive.metastore.HiveMetaException: Schema initialization FAILED! Metastore state would be inconsistent !!

或者这样的错误:

underlying cause: java.io.ioexception : schema script failed

这个的解决方法请参考我的博文https://blog.csdn.net/handoking/article/details/81387944

猜你喜欢

转载自blog.csdn.net/Handoking/article/details/81388143