【分布式数据仓库Hive】Hive的安装配置及测试

目录

一、数据库MySQL安装

1. 检查操作系统是否有MySQL安装残留

2. 删除残留的MySQL安装(使用yum)

3. 安装MySQL依赖包、客户端和服务器

4. MySQL登录账户root设置密码

5. 启动MySQL服务

6. 登录MySQL,进入数据库操作提示符

7. 授权Hive远程登录账户

8. 创建Hive元数据数据库hive_1

二、Hive安装配置(使用hadoop用户)

1. 上传压缩包apache-hive-3.1.2-bin.tar.gz到hadoop01(或者其他虚拟机)

2. 在安装目标文件夹内解压缩安装包

3. 编辑hive配置文件hive-site.xml

4. 解压并导入MySQL依赖包

5. 手动初始化元数据库(Hive2以上版本需要)

6. 配置hive启动的环境变量


引言

        本文有博主手敲代码,可以直接复制!(怕水印挡住截图大家看不清)文章也有贴上传到虚拟机所需的资源,是免费下载的!!如果对正在阅读博客的你有帮助,可以动动小手帮我点个赞或者收藏主页还有其他文章欢迎访问,你的关注将会是我更新的动力~谢谢!

一、数据库MySQL安装

使用root账户

1. 检查操作系统是否有MySQL安装残留

rpm -qa | grep -i mysql

 rpm -qa | grep -i mariadb

2. 删除残留的MySQL安装(使用yum)

yum -y remove mariadb*

3. 安装MySQL依赖包、客户端和服务器

在我上传的资源可以免费下载

https://download.csdn.net/download/m0_67830223/89512921?spm=1001.2014.3001.5503

rpm -ivh MySQL-server-community-5.1.73-1.rhel5.x86_64.rpm

 

rpm -ivh MySQL-client-community-5.1.73-1.rhel5.x86_64.rpm

 

rpm -ivh MySQL-devel-community-5.1.73-1.rhel5.x86_64.rpm

4. MySQL登录账户root设置密码

密码值自定义,这里设为‘abc1234
 

cd /usr/bin

mysqladmin -u root password 'abc1234'

5. 启动MySQL服务

systemctl start mysql.service  //启动mysql

systemctl status mysql.service //查看状态

6. 登录MySQL,进入数据库操作提示符

​​​​​​​mysql -u root -p

7. 授权Hive远程登录账户

grant all on *.* to 'ryx'@'%' identified by 'ryx123'; //“账户”和“密码”自定义

flush privileges; 

8. 创建Hive元数据数据库hive_1

可自命名,符合命名规则即可

create database hive_1;

二、Hive安装配置(使用hadoop用户

1. 上传压缩包apache-hive-3.1.2-bin.tar.gz到hadoop01(或者其他虚拟机)

在本文最上方资源可以免费下载!!

2. 在安装目标文件夹内解压缩安装包

tar -zxvf apache-hive-3.1.0-bin.tar.gz

3. 编辑hive配置文件hive-site.xml

(路径在hive安装目录的conf下)

cp hive-default.xml.template hive-site.xml

vi hive-site.xml

第1步,先删除hive-site.xml中的大部分内容,删除后的内容如下图所示:

第2步:在<configuration>标签对中添加以下内容

注意填写的value值根据自己的数据库名、账号密码修改!!!

<?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>hive.metastore.warehouse.dir</name>
        <value>/usr/hive/warehouse</value>
    </property>
    <property>
        <name>javax.jdo.option.ConnectionURL</name>
        <value>jdbc:mysql://192.168.9.10:3306/hive_1?characterEncoding=UTF-8</value>
        </description>
    </property>
    <property>
        <name>javax.jdo.option.ConnectionUserName</name>
        <value>ryx</value>
    <property>
        <name>javax.jdo.option.ConnectionDriverName</name>
        <value>com.mysql.jdbc.Driver</value>
    </property>
    <property>
        <name>javax.jdo.option.ConnectionPassword</name>
        <value>ryx123</value>
    </property>
</configuration>

4. 解压并导入MySQL依赖包

 在我上传的资源可以免费下载

https://download.csdn.net/download/m0_67830223/89512921?spm=1001.2014.3001.5503

tar -zxcf mysql-connector-java-5.1.27.tar.gz 

cd mysql-connector-java-5.1.27/  //进入解压的文件目录

sudo cp mysql-connector-java-5.1.27-bin.jar ~/apache-hive-3.1.0-bin/lib/ //将mysql的jar包复制到hive的lib目录下

5. 手动初始化元数据库(Hive2以上版本需要)

schematool -dbType mysql -initSchema

script completed

6. 配置hive启动的环境变量

export HIVE_HOME=/home/2130502441ryx/apache-hive-3.1.0-bin

export PATH=$HADOOP_HOME/sbin:$PATH:$HIVE_HOME/bin

7. 启动hive

​​​​​​​hive

  • 13
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值