环境:
服务器: Ubuntu16.04,hadoop2.7.6,hive1.2.1和hive2.3.7
前言
由于之前学习安装的的hive版本是2.3.7,后面学习sqoop时发现由于hive版本太高sqoop不能兼容,出现很多错误所以又安装了hive1.2.1版本。
为了方便使用时能在不同的hive版本间切换于是做了个软连接,这样想要切换hive时只要修改软连接即可。
问题
今天在从hive1.2.1切换到hive2.3.7的时候发现hive元数据不能正常启动了,报错信息如下
MetaException(message:Hive Schema version 2.3.0 does not match metastore's schema version 1.2.0 Metastore is not upgraded or corrupt)
![](https://img.haomeiwen.com/i6116683/c7c2e7352f565785.png)
解决方案
从提示可以看出是hive的Schema version不匹配元数据的schema version
解决方案1:修改mysql数据库中的Schame version
# root身份访问mysql
mysql -u root -p
# 输入密码
Enter password:
# 使用hive数据库
use hive;
# 查看version表中Schema的版本
select * from version;
# 更新version表中schema版本
update VERSION set SCHEMA_VERSION='2.3.0' where VER_ID=1;
由于我还需要在hive间切换这种方法不适合我
解决方案2:在hvie-site.xml中将hive.metastore.schema.verification参数设置为false
<property>
<name>hive.metastore.schema.verification</name>
<value>false</value>
</property>
修改后可以正常运行
网友评论