• centos7安装hive


    安装前准备

    1.安装Mysql

    tar -xvf MySQL-5.6.26-1.linux_glibc2.5.x86_64.rpm-bundle.tar

    MySQL-server-5.6.26-1.linux_glibc2.5.x86_64.rpm
    MySQL-shared-5.6.26-1.linux_glibc2.5.x86_64.rpm
    MySQL-devel-5.6.26-1.linux_glibc2.5.x86_64.rpm
    MySQL-client-5.6.26-1.linux_glibc2.5.x86_64.rpm
    MySQL-shared-compat-5.6.26-1.linux_glibc2.5.x86_64.rpm
    MySQL-embedded-5.6.26-1.linux_glibc2.5.x86_64.rpm
    MySQL-test-5.6.26-1.linux_glibc2.5.x86_64.rpm

    安装服务端:

    rpm -ivh MySQL-server-5.6.26-1.linux_glibc2.5.x86_64.rpm

    警告:MySQL-server-5.6.26-1.linux_glibc2.5.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
    错误:依赖检测失败:
        /usr/bin/perl 被 MySQL-server-5.6.26-1.linux_glibc2.5.x86_64 需要

    缺少依赖perl 

    yum list |grep perl

    yum install -y perl.x86_64

    mariadb-libs-1:5.5.56-2.el7.x86_64包冲突

    rpm -e mariadb-libs-1:5.5.56-2.el7.x86_64 --nodeps

    报错:

    FATAL ERROR: please install the following Perl modules before executing /usr/bin/mysql_install_db:

    解决方法:yum -y install autoconf

    /usr/bin/mysql_install_db --user=mysql

    安装client

    rpm -ivh MySQL-client-5.6.26-1.linux_glibc2.5.x86_64.rp

    mysql> use mysql
    mysql> update user set password=PASSWORD('123456') where User='root';
    #给所有主机授权
    mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;

    安装成功!

    2.安装hive-1.2.1

    tar -zvxf apache-hive-1.2.1-bin.tar.gz

    在conf目录下

    新增hive-site.xml

    <configuration>
    <property>
    <name>javax.jdo.option.ConnectionURL</name>
    <value>jdbc:mysql://localhost:3306/hive?createDatabaseIfNotExist=true</value>
    <description>JDBC connect string for a JDBC metastore</description>
    </property>
    
    <property>
    <name>javax.jdo.option.ConnectionDriverName</name>
    <value>com.mysql.jdbc.Driver</value>
    <description>Driver class name for a JDBC metastore</description>
    </property>
    
    <property>
    <name>javax.jdo.option.ConnectionUserName</name>
    <value>root</value>
    <description>username to use against metastore database</description>
    </property>
    
    <property>
    <name>javax.jdo.option.ConnectionPassword</name>
    <value>123456</value>
    <description>password to use against metastore database</description>
    </property>
    </configuration>

    注意:HADOOP_HOME环境变量需要配置

    启动:bin/hive

    报错:

    Caused by: java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:963)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3966)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3902)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:875)
    at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1712)
    at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1228)
    at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2253)
    at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2284)
    at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2083)
    at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:806)
    at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)
    at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:410)
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:328)
    at java.sql.DriverManager.getConnection(DriverManager.java:664)
    at java.sql.DriverManager.getConnection(DriverManager.java:208)
    at com.jolbox.bonecp.BoneCP.obtainRawInternalConnection(BoneCP.java:361)
    at com.jolbox.bonecp.BoneCP.<init>(BoneCP.java:416)

    原因:没有将MySQL中的mysql库下的user表的权限修改,后来修改后没有对权限进行刷新造成权限没有生效。

    解决方法:

    再次修改root权限的密码;

    mysql> SET PASSWORD=PASSWORD('新的密码');

    修改完成后刷新权限;

    mysql> flush privileges;

    这样操作完成后退出mysql,然后重新执行 bin/hive 命令即可。

  • 相关阅读:
    基于《Hadoop权威指南 第三版》在Windows搭建Hadoop环境及运行第一个例子
    使用java发送HTTP请求
    关于centOS7的一些笔记
    关于netty的多个handler链式模式
    关于netty的简单实现
    EF---延迟加载技术
    Restful Api 最佳实践
    FlaskWeb开发
    python多线程/多进程
    Python网络编程
  • 原文地址:https://www.cnblogs.com/mufeng07/p/12701765.html
Copyright © 2020-2023  润新知