FAILED: HiveException java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHivemetaStoreClient
无论是启动hive后,show databases;还是查看数据:select * from test01;
都是这个错误,说是无法实例化,
搜的大部分都是说初始化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命令最后要加 分号 ; )
搞定!!
老师NB!^_^!
“格式化”凌于众令之上,乃万令之主。
换言之,“格式化”永远的神!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)