1.Exception thrown when executing query : SELECT DISTINCT ‘org.apache.hadoop.hive.metastore.model.MTable’ AS NUCLEUS_TYPE
,A0
.CREATE_TIME
,A0
.LAST_ACCESS_TIME
,A0
.OWNER
,A0
.RETENTION
,A0
.IS_REWRITE_ENABLED
,A0
.TBL_NAME
,A0
.TBL_TYPE
,A0
.TBL_ID
FROM TBLS
A0
LEFT OUTER JOIN DBS
B0
ON A0
.DB_ID
= B0
.DB_ID
WHERE A0
.TBL_NAME
= ? AND B0
.NAME
= ?;
网上搜到关于这个问题报错的很少,而且确实要看具体情况。
我的情况如下:在idea中加入了hive-site.xml,启动了hadoop,操作代码如下
控制台报如上错误。
各种修改hive-site.xml文件
遇到错误2.Caused by: MetaException(message:Hive Schema version 2.3.0 does not match metastore’s schema version 1.2.0 Metastore is not upgraded or corrupt)_2
解决:
`登陆mysql,修改hive metastore版本:
1.mysql:mysql -uroot -p (123456)
2.use metastore;
3.select * from version;
4.update VERSION set SCHEMA_VERSION='2.3.0' where VER_ID=1;`
最后,问题1的解决
在hive的目录下
启动hive元数据服务
bin/hive --service metastore
启动之后,再运行报错
Caused by: MetaException(message:Got exception: org.apache.hadoop.security.AccessControlException Permission denied: user=hws, access=WRITE, inode="/user/hive/warehouse/atguigu.db/bb":root:supergroup:drwxr-xr-x
这里是远程操作用户报的错
解决再代码首行添加如下代码
System.setProperty("HADOOP_USER_NAME", "root")
root为虚拟机用户。