美文网首页工作生活
Hive | 环境部署

Hive | 环境部署

作者: icebreakeros | 来源:发表于2019-07-04 07:56 被阅读0次

    环境部署

    环境准备

    java环境

    主机名 IP 服务
    ubuntu01 192.168.0.151 mysql
    ubuntu02 192.168.0.152 zookeeper、namenode、resourcemanager、jobhistoryserver、hregionserver
    ubuntu03 192.168.0.153 zookeeper、datanode、nodemanager、hregionserver
    ubuntu04 192.168.0.154 zookeeper、datanode、nodemanager、hregionserver
    ubuntu05 192.168.0.155 secondarynamenode、datanode、nodemanager、hmaster、hive

    mysql环境部署

    # centos7
    wget -c https://repo.mysql.com//mysql80-community-release-el7-1.noarch.rpm
    rpm -ivh mysql80-community-release-el7-1.noarch.rpm
    
    yum update -y && yum upgrade -y
    yum install mysql-community-server mysql-community-client -y
    
    # ubuntu18
    wget -c https://repo.mysql.com//mysql-apt-config_0.8.13-1_all.deb
    dpkg -i mysql-apt-config_0.8.13-1_all.deb
    
    apt-get update -y && apt-get upgrade -y
    apt-get install mysql-community-server mysql-community-client -y
    
    systemctl start mysqld
    
    cat /var/log/mysqld.log | grep "password"
    mysql -uroot -p
    > alter user 'root'@'localhost' identified by '*******';
    > flush privileges;
    > create database hive default character set utf8;
    > create user 'hive'@'%' identified by '*******';
    > grant all privileges on hive.* to 'hive'@'%';
    > flush privileges;
    
    mysql -uhive -p
    > show databases;
    cp /opt/mysql-connector-java-8.0.12.jar /usr/local/hive/lib/
    

    hive环境部署

    wget -c http://mirrors.shu.edu.cn/apache/hive/hive-2.3.3/apache-hive-2.3.3-bin.tar.gz
    tar -zxvf apache-hive-2.3.3-bin.tar.gz
    mv apache-hive-2.3.3-bin /usr/local/apache-hive-2.3.3
    
    cd /usr/local && ln -s apache-hive-2.3.3/ hive
    cat >> /etc/profile << EOF
    
    # for hive
    export HIVE_HOME=/usr/local/hive
    export PATH=\$HIVE_HOME/bin:\$PATH
    EOF
    
    source /etc/profile
    

    服务端配置

    cp mysql-connection.jar lib/
    cp conf/hive-log4j2.properties.template conf/hive-log4j2.properties
    cp conf/hive-env.sh.template conf/hive-env.sh
    
    vim conf/hive-env.sh
    HADOOP_HOME=/usr/local/hadoop
    export HIVE_CONF_DIR=/usr/local/hive/conf
    export HIVE_AUX_JARS_PATH=/usr/local/hive/lib
    
    cp conf/hive-default.xml.template conf/hive-site.xml
    echo "" >  conf/hive-site.xml
    vim conf/hive-site.xml
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
    <configuration>
        <property>
            <name>javax.jdo.option.ConnectionURL</name>
            <value>jdbc:mysql://192.168.0.151:3306/hive?useSSL=false&</value>
        </property>
        <property>
            <name>javax.jdo.option.ConnectionDriverName</name>
            <value>com.mysql.cj.jdbc.Driver</value>
        </property>
        <property>
            <name>javax.jdo.option.ConnectionUserName</name>
            <value>hive</value>
        </property>
        <property>
            <name>javax.jdo.option.ConnectionPassword</name>
            <value>******</value>
        </property>
        <property>
            <name>hive.metastore.warehouse.dir</name>
            <value>/user/hive/warehouse</value>
        </property>
        <property>
            <name>hive.server2.thrift.bind.host</name>
            <value>0.0.0.0</value>
        </property>
        <property>
            <name>hive.server2.thrift.port</name>
            <value>10000</value>
        </property>
        <property>
            <name>hive.server2.webui.host</name>
            <value>0.0.0.0</value>
        </property>
        <property>
            <name>hive.server2.webui.port</name>
            <value>10002</value>
        </property>
    </configuration>
    
    schematool -dbType mysql -initSchema --verbose
    hive    
    
    tail -f /tmp/root/hive.log
    mkdir -p /log/hive/
    
    # nohup hive --service hiveserver2 > /log/hive/hiveserver2.log 2>&1 &
    

    客户端配置

    beeline    # 对应hiveserver2服务
    > !connect jdbc:hive2://192.168.0.155:10000
    
    错误:User: root is not allowed to impersonate anonymous
    vim etc/hadoop/core-site.xml
    <property>
        <name>hadoop.proxyuser.root.hosts</name>
        <value>*</value>
    </property>
    <property>
        <name>hadoop.proxyuser.root.groups</name>
        <value>*</value>
    </property>
    
    错误:Permission denied
    hdfs dfs -chmod -R 777 /tmp
    错误:Public Key Retrieval is not allowed
    <property>
          <name>javax.jdo.option.ConnectionURL</name>
          <value>jdbc:mysql://192.168.219.51:3306/hive?useSSL=falsei</value>
    </property>
    

    相关文章

      网友评论

        本文标题:Hive | 环境部署

        本文链接:https://www.haomeiwen.com/subject/yiepcctx.html