数据仓库 Hive安装配置

本文档详细介绍了Hive的安装过程,包括从官方地址下载、Linux环境下的解压与配置,以及Hadoop集群的配置。在配置完成后,演示了Hive的基本操作,如查看数据库、创建表、插入数据等,并提供了一个将本地文件导入Hive的完整案例。在案例中,通过创建数据文件并加载到Hive表中,展示了数据导入的步骤。最后提醒,运行多个Hive服务需要安装MySQL服务。
摘要由CSDN通过智能技术生成

1、Hive安装地址

Hive官网地址:http://hive.apache.org/
文档查看地址:https://cwiki.apache.org/confluence/display/Hive/GettingStarted
下载地址:http://archive.apache.org/dist/hive/
github地址: https://github.com/apache/hive

2、Hive安装部署

2-1、Hive安装及配置

(1)把apache-hive-1.2.1-bin.tar.gz上传到linux的/opt/software目录下

在这里插入图片描述
(2)解压apache-hive-1.2.1-bin.tar.gz到/opt/module/目录下面

[root@hadoop100 software]# tar -zxvf apache-hive-1.2.1-bin.tar.gz -C /opt/software/module/

(3)修改apache-hive-1.2.1-bin.tar.gz的名称为hive

[root@hadoop100 software]# mv apache-hive-1.2.1-bin.tar.gz hive

(4)配置/etc/profile文件

[root@hadoop100 software]# vim /etc/profile

 #HIVE_HONE
export HIVE_HOME=/opt/software/module/hive-1.2.1
export PATH=$JAVA_HOME/bin:$PATH:$HIVE_HOME/bin

[root@hadoop100 software]# source /etc/profile

2-2、Hadoop集群配置

(1)必须启动hdfs和yarn

[root@hadoop100 hadoop-2.7.2]# sbin/start-dfs.sh
[root@hadoop100 hadoop-2.7.2]# sbin/start-yarn.sh

(2)拷贝复制hive-env.sh.template文件重名hive-env.sh

[root@hadoop100 conf]# cp hive-env.sh.template  hive-env.sh

在这里插入图片描述
编辑进入

HADOOP_HOME=/opt/hadoop/module/hadoop-2.7.2

需要把图片注释部分打开,并添加hadoop安装目录
在这里插入图片描述
继续编辑

 export HIVE_CONF_DIR=/opt/software/module/hive-1.2.1/conf

下方图片中注释也要打开,指定配置信息文件夹路径
在这里插入图片描述
(3)启动hive

[root@hadoop100 bin]# hive
Logging initialized using configuration in jar:file:/opt/software/module/hive-1.2.1/lib/hive-common-1.2.1.jar!/hive-log4j.properties

2-3、Hive基本操作

(1)查看数据库

hive> show databases;
OK
default
Time taken: 1.053 seconds, Fetched: 1 row(s)

(2)打开默认数据库

hive> use default;
OK
Time taken: 0.04 seconds

(3)显示default数据库中的表

hive> show tables;
OK
Time taken: 0.057 seconds

(4)创建一张表

hive> create table student(id int, name string);
OK
Time taken: 0.735 seconds

(5)显示数据库中有几张表

hive> show tables;
OK
student
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值