MetaException(message:Hive Schema version 2.3.0 does not match metastore's schema version 1.2.0

环境
spark 2.2.0 hive 2.3.3
问题
用spark应用创建一张hive表后,在通过hive shell来操作hive时报如下错;

MetaException(message:Hive Schema version 2.3.0 does not match metastore's schema version 1.2.0

原因
spark应用创建表时,指定的schema版本为1.2.0,而hive的schema版本为2.3.0,版本不兼容导致
解决办法
临时解决:
在mysql(假定metastore的数据库为mysql)中,切换到hive库,执行如下命令

    UPDATE VERSION SET SCHEMA_VERSION='2.3.0', VERSION_COMMENT='fix conflict' where VER_ID=1;

这样解决后,当通过spark应用再创建新表时仍会报错。
更好的解决:
1. metastore模式使用remote方式
2. 通过cdh来解决版本问题

猜你喜欢

转载自blog.csdn.net/struggling_rong/article/details/82598277