Ubuntu部署hive报错HiveMetaException,mysql.CommunicationsException : Communications link failure

Ubuntu使用bin/schematool -initSchema -dbType mysql -verbos命令部署hive报错

org.apache.hadoop.hive.metastore.HiveMetaException: Failed to get schema version.

Underlying cause: com.mysql.cj.jdbc.exceptions.CommunicationsException : Communications link failure

mysql连接失败

根据文章Underlying cause: com.mysql.cj.jdbc.exceptions.CommunicationsException : Communications link failure-CSDN博客mysql8设置局域网访问_mysql8 设置局域网访问-CSDN博客

/etc/mysql/mysql.conf.d/mysqld.cnf修改

bind-address        = 127.0.0.1

改成

#bind-address        = 127.0.0.1

再次使用bin/schematool -initSchema -dbType mysql -verbos

报错

org.apache.hadoop.hive.metastore.HiveMetaException: Failed to get schema version. Underlying cause: java.sql.SQLNonTransientConnectionException : Public Key Retrieval is not allowed

把hive-site.xml里原来的useSSL=false改成useSSL=true后成功部署

  <property>
    <name>javax.jdo.option.ConnectionURL</name>
    <value>jdbc:mysql://node1:3306/hive?createDatabaseIfNotExist=true&amp;useSSL=false&amp;useUnicode=true&amp;characterEncoding=UTF-8</value>
  </property>

改成

  <property>
    <name>javax.jdo.option.ConnectionURL</name>
    <value>jdbc:mysql://node1:3306/hive?createDatabaseIfNotExist=true&amp;useSSL=true&amp;useUnicode=true&amp;characterEncoding=UTF-8</value>
  </property>

顺带一提bin/schematool -initSchema -dbType mysql -verbos显示的LF4J多绑定错误

LF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/export/server/apache-hive-3.1.3-bin/lib/log4j-slf4j-impl-2.17.1.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/export/server/hadoop-3.3.4/share/hadoop/common/lib/slf4j-reload4j-1.7.36.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://node1:3306/hive?createDatabaseIfNotExist=true&useSSL=false&useUnicode=true&characterEncoding=UTF-8

我通过重命名其中一个文件 mv slf4j-reload4j-1.7.36.jar slf4j-reload4j-1.7.36.bak忽略一个文件解决,忘了改的哪个文件了,应该都行

还参考了Hive 3.x的安装部署 - Ubuntu_ubuntu安装hive-CSDN博客文章,使用了下面的指令,但应该不解决这个报错

cd /home/hadoop/apache-hive-3.1.3-bin/lib

wget https://repo1.maven.org/maven2/com/mysql/mysql-connector-j/8.0.32/mysql-connector-j-8.0.32.jar

  • 26
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值