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&useSSL=false&useUnicode=true&characterEncoding=UTF-8</value>
</property>
改成
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://node1:3306/hive?createDatabaseIfNotExist=true&useSSL=true&useUnicode=true&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