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

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

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?><!--
   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for additional information regarding copyright ownership.
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at
​
       http://www.apache.org/licenses/LICENSE-2.0
​
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
--><configuration>
  <!-- WARNING!!! This file is auto generated for documentation purposes ONLY! -->
  <!-- WARNING!!! Any changes you make to this file will be ignored by Hive.   -->
  <!-- WARNING!!! You must make your changes in hive-site.xml instead.         -->
  <!-- Hive Execution Parameters -->
    <property>
        <name>javax.jdo.option.ConnectionUserName</name>
        <value>root</value>
    </property>
    <property>
        <name>javax.jdo.option.ConnectionPassword</name>
        <value>123456</value>
    </property>
   <property>
        <name>javax.jdo.option.ConnectionURL</name>mysql
       <value>jdbc:mysql://192.168.52.100:3306/hive</value>
    </property>
    <property>
        <name>javax.jdo.option.ConnectionDriverName</name>
        <value>com.mysql.jdbc.Driver</value>
    </property>
        <property>
                <name>hive.metastore.schema.verification</name>
                <value>false</value>
        </property>
        <property>
                 <name>hive.cli.print.current.db</name>
                 <value>true</value>
        </property>
        <property>
                 <name>hive.cli.print.header</name>
                 <value>true</value>
        </property>
        <!-- 这是hiveserver2 -->
        <property>
                 <name>hive.server2.thrift.port</name>
                 <value>10000</value>
        </property>
​
        <property>
                <name>hive.server2.thrift.bind.host</name>
                <value>192.168.52.100</value>
        </property>
</configuration>

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的包目录下

 

查看包是否存在

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

 

9.beeline连接新安装的hive

./beeline

稍等片刻后,输入

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

运行成功后显示

 

查询数据库

show databases;

至此安装完毕。

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值