irpas技术客

FAILED: HiveException java.lang.RuntimeException: Unable to instantiate org.apac

未知 5777

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命令最后要加 分号 ; ) 搞定!! ^_^!

另接:如果初始化中出现以下情况 翻译:根本原因:java.sql.SQLNonTransientConnectionException: 不允许公钥检索SQL 错误代码:0 这说明hive的hive-site.xml出错了,应检查路径和主机名


1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,会注明原创字样,如未注明都非原创,如有侵权请联系删除!;3.作者投稿可能会经我们编辑修改或补充;4.本站不提供任何储存功能只提供收集或者投稿人的网盘链接。

标签: #failed #HiveException #Unable #To #instantiate #orgapac