异常 1: SemanticException org.apache.hadoop.hive.ql.metadata.HiveException
首次安装, Hive 启动之后, 操作 hive 客户端抛出异常:
 [root@node1 hive238]# hivewhich: no hbase in (:/opt/bigdata/hive238/bin:/opt/bigdata/zookeeper358/bin:/opt/bigdata/hadoop210/bin:/opt/bigdata/hadoop210/sbin:/opt/findbugs-1.3.9/bin:/opt/maven3/bin:/opt/jdk8/bin::/opt/bigdata/zookeeper358/bin:/opt/bigdata/hadoop210/bin:/opt/bigdata/hadoop210/sbin:/opt/findbugs-1.3.9/bin:/opt/maven3/bin:/opt/jdk8/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin)
Logging initialized using configuration in jar:file:/opt/bigdata/hive238/lib/hive-common-2.3.8.jar!/hive-log4j2.properties Async: trueHive-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> show databases;FAILED: SemanticException org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
   复制代码
 
登录没有问题, 但是执行和元数据相关的操作会抛出错误, 由于是安装之后首次执行, 推测元数据有问题, 于是做下面操作, 但还是抛出异常:
 [root@node1 hive238]# schematool -dbType mysql -initSchemaMetastore connection URL:	 jdbc:mysql://node1:3306/hive?createDatabaseIfNotExist=true&useSSL=falseMetastore Connection Driver :	 com.mysql.jdbc.DriverMetastore connection User:	 rootorg.apache.hadoop.hive.metastore.HiveMetaException: Failed to get schema version.Underlying cause: java.sql.SQLException : The connection property 'createDatabaseIfNotExist' only accepts values ofSQL Error code: 0Use --verbose for detailed stacktrace.*** schemaTool failed ***
   复制代码
 
解决:  看异常提示, 是元数据的问题:不能实例化元数据存储客户端, 推测是存储元数据的 mysql 有问题, 经过检查, 是 hive 在读取 mysql 数据库的权限不够,于是, 重新给 mysql 数据库设置权限:
 mysql> grant all PRIVILEGES on *.* to 数据库用户名@hive主机名 identified by '数据库密码' with grant option;Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;Query OK, 0 rows affected (0.00 sec)
   复制代码
 
修改之后, hive 操作没有问题.
评论