欢迎使用CSDN-markdown编辑器

HIVE安装遇到的问题

  • 环境信息
    ubuntu 16.04

  • 具体问题

    hive设置mysql为metastore数据库,执行数据库初始化命令

    schematool -initSchema -dbType mysql

出现以下问题:

> root@ubuntu:/home/ac# schematool -initSchema -dbType mysql   SLF4J:
> Class path contains multiple SLF4J bindings. SLF4J: Found binding in
> [jar:file:/usr/hive/lib/log4j-slf4j-impl-2.4.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
> SLF4J: Found binding in
> [jar:file:/usr/hadoop-2.7.4/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] Metastore connection
> URL:  
> jdbc:mysql://192.168.0.109:3306/hive?createDatabaseIfNotExist=true
> Metastore Connection Driver :  com.mysql.jdbc.Driver Metastore
> connection User:   hive
> org.apache.hadoop.hive.metastore.HiveMetaException: Failed to get
> schema version. Underlying cause:
> com.mysql.jdbc.exceptions.jdbc4.CommunicationsException :
> Communications link failure The last packet sent successfully to the
> server was 0 milliseconds ago. The driver has not received any packets
> from the server. SQL Error code: 0

如图:
这里写图片描述

  • 解决办法

    检查mysql数据库运行状态

    systemctl status mysql.service

    如果运行状态为active 则mysql运行状态正常

    使用数据库可视化工具,无法链接数据库,但在ubuntu环境使用命令行登陆mysql,登陆正常

    mysql -u hive -p

问题根因:

mysql的默认配置为了增强安全性,禁止了非本机的访问,在ubuntu中是这样,debian中也是,需要修改
# vi /etc/mysql/my.cnf
修改
bind-address = 127.0.0.1 为 bind-address = 0.0.0.0

修改完成后重启mysql服务
sudo /etc/init.d/mysql restart

再次执行数据库初始化命令

schematool -initSchema -dbType mysql

初始化成功

备注:hive 安装以及设置mysql作为metastore 操作方法参见
http://www.linuxidc.com/Linux/2017-05/143864.htm

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值