Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient

FAILED: HiveException java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
在启动hive后无论是,show databases;还是查看数据:select * from test01;
都是这个错误,说是无法实例化,
搜的大部分都是说在hive目录下初始化MySQL,输入以下命令就能运行

分析得知:hive的数据库MySQL在安装的时候没有初始化 解决办法: 初始化数据库

schematool -dbType mysql -initSchema

但我仍未成功,还是这个错误,
又将hive-site.xml中汉字注释去掉后,还是不行。

之后问了老师
老师说:把元数据删除,重新格式化就好了

1.进入MySQL
删除元数据

drop database metastore;

2.进入hive的bin,输入格式化命令

[root@hadoop101 bin]$ schematool -initSchema -dbType mysql

3.出现主机连接错误

[root@dsj011 hive]# cd bin [root@dsj011 bin]# schematool -initSchema -dbType mysql SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in
[jar:file:/opt/moudle/hive/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in
[jar:file:/opt/moudle/hadoop-3.1.3/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an
explanation. SLF4J: Actual binding is of type
[org.apache.logging.slf4j.Log4jLoggerFactory] Metastore connection
URL:
jdbc:mysql://dsj011:3306/metastore?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
Metastore Connection Driver : com.mysql.cj.jdbc.Driver Metastore
connection User: root
org.apache.hadoop.hive.metastore.HiveMetaException: Failed to get
schema version. Underlying cause: java.sql.SQLException : null,
message from server: “Host ‘192.168.10.83’ is blocked because of many
connection errors; unblock with ‘mysqladmin flush-hosts’” SQL Error
code: 1129 Use --verbose for detailed stacktrace.
*** schemaTool failed *****

根本原因:java.sql.SQLException:null,来自服务器的消息:“由于许多连接错误,主机‘192.168.1xx.xx’被阻塞;使用‘mysqladmin flush-hosts’解除阻塞”

4.mysqladmin flush-hosts 解决方法:
错误:Host is blocked because of many connection errors;unblock with ‘mysqladmin flush-hosts’

进入到数据库中 执行以下的命令

flush hosts;

————————————————
原文链接:mysqladmin flush-hosts 解决方法
请添加图片描述
5.再次格式化

[root@hadoop101 apache-hive-3.1.2-bin]$ schematool -initSchema -dbType mysql

成功的标志:在这里插入图片描述在这里插入图片描述高版本执行成功会有一大段空白,属于正常现象,低版本可能没有,不必担心。

6.再次进入hive,验证完成
(注意hive命令最后要加 分号 ; )
请添加图片描述
搞定!!
<sup>_</sup>

另接:如果初始化中出现以下情况

翻译:根本原因:java.sql.SQLNonTransientConnectionException
不允许公钥检索SQL 错误代码:0
这说明hive的hive-site.xml出错了,应检查路径和主机名。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值