Linux单节点安装hive

1.下载安装包

hive:3.1.2 :http://archive.apache.org/dist/hive/hive-3.1.2/apache-hive-3.1.2-bin.tar.gz

2.解压安装包

tar -zxvf apache-hive-3.1.2-bin.tar.gz
mv apache-hive-3.1.2-bin /opt/hive

3.配置环境变量

vi /etc/profile

添加以下内容

export HIVE_HOME=/etc/hive/hive
export PATH=$PATH:$HIVE_HOME/bin

重新加载配置文件

source /etc/profile

4.配置hive-site.xml

cd /opt/hive/conf

创建文件,修改文件权限,并打开文件

#创建
touch hive-site.xml
#修改文件权限为731
chmod 731 hive-site.xml
#打开
vim hive-site.xml

添加以下内容,修改配置信息


  
  
  
  
    
        javax.jdo.option.ConnectionUserName
        root
    
    
        javax.jdo.option.ConnectionPassword
        123456
    
   
        javax.jdo.option.ConnectionURLmysql
       jdbc:mysql://192.168.52.100:3306/hive
    
    
        javax.jdo.option.ConnectionDriverName
        com.mysql.jdbc.Driver
    
        
                hive.metastore.schema.verification
                false
        
        
                 hive.cli.print.current.db
                 true
        
        
                 hive.cli.print.header
                 true
        
        
        
                 hive.server2.thrift.port
                 10000
        
​
        
                hive.server2.thrift.bind.host
                192.168.52.100
        

5.配置hive-env.sh

从hive配置中自带的模板中复制一份

cp /opt/hive/conf/hive-env.sh.template /opt/hive/conf/hive-env.sh
​
#修改文件权限
chmod 731 /opt/hive/conf/hive-env.sh

修改下列配置的信息

export HIVE_CONF_DIR=/opt/hive/conf
export HIVE_AUX_JARS_PATH=/opt/hive/lib

6.下载MySQL驱动

访问网站:MySQL :: Download MySQL Connector/J (Archived Versions)

下载驱动包,并上传到hive的包目录下

Linux单节点安装hive_第1张图片 

查看包是否存在

cd /opt/hive/lib
​
ll | grep mysql-

 

7.初始化数据库

cd /opt/hive/bin
​
./schematool -initSchema -dbType mysql

8.后台启动hiveserver2

nohup ./hive --service hivserver2 > hiveserver2.log 2>&1 &

检查进程是否存在

ps -ef | grep HiveServer

Linux单节点安装hive_第2张图片 

9.beeline连接新安装的hive

./beeline

稍等片刻后,输入

!connect jdbc:hive2://192.168.52.100:10000 root 123456

运行成功后显示

 

查询数据库

show databases;

Linux单节点安装hive_第3张图片

至此安装完毕。

参考文章:【Linux】【hive】基于Hadoop安装hive单机版 - xiaostudy - 博客园

你可能感兴趣的:(初学大数据,hive,linux,hadoop)