Hadoop安装hive

本文详细记录了在Hadoop集群上安装Hive的步骤,包括从官网下载Hive,上传并解压,配置环境变量,解决Hadoop与Hive版本冲突问题,初始化Hive元数据库至MySQL,以及解决报错并成功启动Hive的过程。
摘要由CSDN通过智能技术生成


前言

Hadoop安装hive的过程以及遇到的问题加解决办法

一、下载

我是从官网下载的

https://mirror.bit.edu.cn/apache/hive/hive-3.1.2/

在这里插入图片描述

二、上传到Hadoop

1.上传

在这里插入图片描述

2.解压

在这里插入图片描述
改名
在这里插入图片描述

3.配置环境变量

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述使变量生效

此时查看hive的版本会报错

在这里插入图片描述
原因是hive和Hadoop的guava的版本一个太低一个太高,所以把低版本删掉,将 hive/lib/guava-19.0-jre.jar删除;将hadoop/share/hadoop/commons/lib/guava-27.0guava-27.0-jre.jar 复制到lib下


hive的lib下

在这里插入图片描述
到你自己的Hadoop的lib下
在这里插入图片描述
将guava-27.0guava-27.0-jre.jar 复制到hive的lib下
在这里插入图片描述
查看
在这里插入图片描述

4.开启集群查看版本

在这里插入图片描述其实应该一开始打开集群的

5.修改配置文件

切换到hive/conf目录下拷贝 hive-default.xml.template 为 hive-site.xml
修改hive-site.xml 文件以下需要指定数据连接信息(jdbc:mysql://192.168.2.115:3306/hive //hive数据库事先必须创建好)不知咋建也可以在hive-site.xml中写行代码
可以用notepad++打开Hadoop01,创建一个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>Root1234567890!</value>#这是你自己的密码
    </property>
   <property>
        <name>javax.jdo.option.ConnectionURL</name>
        <value>jdbc:mysql://localhost:3306/hive?createDatabaseIfNotExist=true</value>
    </property>
    <property>
        <name>javax.jdo.option.ConnectionDriverName</name>
        <value>com.mysql.jdbc.Driver</value>
    </property>
        <!-- 到此结束代码 -->


  <property>
    <name>hive.exec.script.wrapper</name>
    <value/>
    <description/>
  </property>
  </configuration>

6.将MySQL的驱动程序弄到hive/lib下

我不知道这个程序在哪,我就下了一个
这是官网https://dev.mysql.com/downloads/file/?id=476197
在这里插入图片描述
我下到了自己电脑中解压好,把jar包上传到了hive/lib下

7.初始化hive的元数据库

我是在官网下载的
https://mirror.bit.edu.cn/apache/hive/hive-3.1.2/
上传到
在这里插入图片描述
schematool -dbType mysql –initSchema
如果会报错
在这里插入图片描述
这是因为数据库没有创建hive的数据库,但是上面的hive-site.xml中我已经加了一行代码,如果不存在就创建。
在这里插入图片描述
成功后输入 ./hive

成功进入
推出的话quit;

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值