微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Hadoop安装hive

文章目录


前言

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 @R_674_4045@ion 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.
–>

    <!-- 插入一下代码 -->
<property>
    <name>javax.jdo.option.ConnectionUserName</name>
    <value>root</value>
</property>
<property>
    <name>javax.jdo.option.ConnectionPassword</name>
    <value>Root1234567890!</value>#这是你自己的MysqL密码
</property>
javax.jdo.option.ConnectionURL jdbc:MysqL://localhost:3306/hive?createDatabaseIfNotExist=true javax.jdo.option.ConnectionDriverName com.MysqL.jdbc.Driver hive.exec.script.wrapper

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;

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐