Hive提示警告SSL

本文解析了Hive启动时出现的警告信息,包括SLF4J绑定问题及SSL连接验证建议,并提供了具体的解决方案。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Hive启动后报警告:

$ ./hive
which: no hbase in (/usr/java/jdk1.8.0_171/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/sysopt/.local/bin:/home/sysopt/bin:/home/hadoop/hadoop-2.8.1/bin:/home/hadoop/hive/apache-hive-2.1.1-bin/bin)
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/hadoop/hive/apache-hive-2.1.1-bin/lib/log4j-slf4j-impl-2.4.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/hadoop/hadoop-2.8.1/share/hadoop/common/lib/slf4j-log4j12-1.7.10.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]


Logging initialized using configuration in jar:file:/home/hadoop/hive/apache-hive-2.1.1-bin/lib/hive-common-2.1.1.jar!/hive-log4j2.properties Async: true
Tue Jun 05 04:38:58 CST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Tue Jun 05 04:39:02 CST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Tue Jun 05 04:39:03 CST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Tue Jun 05 04:39:03 CST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Tue Jun 05 04:39:15 CST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Tue Jun 05 04:39:15 CST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Tue Jun 05 04:39:15 CST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
Tue Jun 05 04:39:15 CST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.


Hive-on-MR is deprecated in Hive 2 and may not be available in the future versions. Consider using a different execution engine (i.e. spark, tez) or using Hive 1.X releases.


1.设置useSSL=false 
这里有个坑就是hive的配置文件是.XML格式,而在xml文件中&才表示&,所以正确的做法是在Hive的配置文件中,如hive-site.xml进行如下设置

解决方案:

<property>
    <name>javax.jdo.option.ConnectionURL</name>
    <value>jdbc:mysql://192.168.1.11:3306/hive?createDatabaseIfNotExist=true&amp;useSSL=false</value>
    <description>
      JDBC connect string for a JDBC metastore.
      To use SSL to encrypt/authenticate the connection, provide database-specific SSL flag in the connection URL.
      For example, jdbc:postgresql://myhost/db?ssl=true for postgres database.
    </description>
  </property>

<think>嗯,用户问的是Hive 3.1.2适配的MySQL。首先,我得确认Hive版本和MySQL的兼容性。Hive通常用MySQL作为元数据存储,所以需要知道支持的MySQL版本。 查Hive官方文档,Hive 3.1.2的元数据存储支持哪些数据库?可能包括MySQL、PostgreSQL、Derby等。需要具体版本号。例如,Hive 3.1.2可能要求MySQL 5.7或更高,或者兼容8.0?但得注意MySQL 8.0的驱动是否有变化,比如JDBC驱动类名从com.mysql.jdbc.Driver改为com.mysql.cj.jdbc.Driver,还有时区问题。 然后,用户可能想配置Hive使用MySQL,所以需要配置步骤。比如,把MySQL的JDBC驱动jar包放到Hive的lib目录下,修改hive-site.xml里的连接URL、驱动类、用户名密码等。 另外,可能遇到问题,比如SSL错误,需要在连接URL里加上useSSL=false。或者时区问题,设置serverTimezone参数。还有权限问题,确保MySQL用户有权限访问和操作Hive的元数据库。 用户可能对具体配置步骤和注意事项感兴趣,所以需要分步骤说明,包括驱动下载、配置文件修改、数据库初始化等。还要提醒测试连接,验证是否成功。 另外,可能需要注意Hive版本和MySQL驱动的兼容性,比如使用较新的MySQL驱动是否会导致问题,建议使用官方推荐的版本,比如MySQL Connector/J 5.1.x或8.0.x,但具体要看Hive 3.1.2的支持情况。 总结一下,回答需要涵盖支持的MySQL版本,配置步骤,常见问题及解决方法,确保用户能顺利适配。</think>Hive 3.1.2 与 MySQL 的适配主要涉及元数据存储的兼容性。以下是分步说明: ### 一、支持的 MySQL 版本 Hive 3.1.2 官方文档明确支持的 MySQL 版本为: - **MySQL 5.7** - **MySQL 8.0**(需注意额外配置) > 注:MySQL 5.6 已过时且存在兼容性风险,不推荐使用。 --- ### 二、关键配置步骤 #### 1. 安装 MySQL JDBC 驱动 - 下载对应驱动:选择 **MySQL Connector/J 8.0.x**(兼容 MySQL 5.7 和 8.0) - 将 JAR 文件(如 `mysql-connector-java-8.0.xx.jar`)放入 Hive 的 `lib` 目录 #### 2. 修改 `hive-site.xml` 配置以下参数(示例): ```xml <property> <name>javax.jdo.option.ConnectionURL</name> <value>jdbc:mysql://[主机]:[端口]/hive_metastore?createDatabaseIfNotExist=true</value> </property> <property> <name>javax.jdo.option.ConnectionDriverName</name> <value>com.mysql.cj.jdbc.Driver</value> <!-- MySQL 8.0+ 驱动类名 --> </property> <property> <name>javax.jdo.option.ConnectionUserName</name> <value>[用户名]</value> </property> <property> <name>javax.jdo.option.ConnectionPassword</name> <value>[密码]</value> </property> ``` #### 3. 解决 MySQL 8.0 的常见问题 - **时区配置**:在连接 URL 后追加 `&serverTimezone=UTC` - **SSL 警告**:添加 `&useSSL=false`(生产环境需启用有效证书) - **身份验证插件**:确保 MySQL 用户使用 `mysql_native_password`(旧版驱动可能不兼容 `caching_sha2_password`) --- ### 三、初始化元数据库 执行 Hive 元数据初始化命令: ```bash $ schematool -dbType mysql -initSchema ``` --- ### 四、验证适配性 1. 启动 Hive CLI 或 Beeline 2. 执行简单查询(如 `SHOW DATABASES;`) 3. 检查 MySQL 中 `hive_metastore` 表是否生成 --- ### 五、已知兼容性问题 | 场景 | 解决方案 | |-----------------------|-----------------------------------------| | 驱动类 `ClassNotFound` | 检查 JAR 文件路径和权限 | | 时区冲突 | 在 URL 中指定 `serverTimezone=Asia/Shanghai` | | 身份验证失败 | 在 MySQL 中重置用户密码为旧版加密方式 | --- ### 六、推荐版本组合 | 组件 | 稳定版本 | |-------------|-----------------------| | Hive | 3.1.2 | | MySQL | 5.7.37 或 8.0.28 | | Connector/J | 8.0.28 | > 提示:生产环境建议先在测试集群验证兼容性。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值