Hive | 环境部署

环境部署

环境准备

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



    
        javax.jdo.option.ConnectionURL
        jdbc:mysql://192.168.0.151:3306/hive?useSSL=false&
    
    
        javax.jdo.option.ConnectionDriverName
        com.mysql.cj.jdbc.Driver
    
    
        javax.jdo.option.ConnectionUserName
        hive
    
    
        javax.jdo.option.ConnectionPassword
        ******
    
    
        hive.metastore.warehouse.dir
        /user/hive/warehouse
    
    
        hive.server2.thrift.bind.host
        0.0.0.0
    
    
        hive.server2.thrift.port
        10000
    
    
        hive.server2.webui.host
        0.0.0.0
    
    
        hive.server2.webui.port
        10002
    


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

    hadoop.proxyuser.root.hosts
    *


    hadoop.proxyuser.root.groups
    *


错误:Permission denied
hdfs dfs -chmod -R 777 /tmp
错误:Public Key Retrieval is not allowed

      javax.jdo.option.ConnectionURL
      jdbc:mysql://192.168.219.51:3306/hive?useSSL=falsei

你可能感兴趣的:(Hive | 环境部署)