版权声明:个人原创,转载请标注! https://blog.csdn.net/Z_Date/article/details/83929051
安装包准备
将hive安装包 apache-hive-1.2.1-bin.tar.gz 上传到虚拟机/bigdata/下
-
JDK安装包 jdk-8u151-x64.gz
集群的准备(min1,min2,min3)
-
hive的解压安装
将上传的hive解压缩至虚拟机/app目录下
tar -zxvf /app/apache-hive-1.2.1-bin.tar.gz -C /app
mv /app/apache-hive-1.2.1-bin/ /app/hive-1.2.1
配置hive的配置文件
查看配置文件内容
拷贝配置文件hive-env.sh.template为hive-env.sh
cp /app/hive-1.2.1/conf/hive-env.sh.template /app/hive-1.2.1/conf/hive-env.sh
vim /app/hive-1.2.1/conf/hive-env.sh
配置hive的环境变量
vim /etc/profile
source /etc/profile
which hive
启动hadoop集群
启动hive服务
hive
查看数据库
show databases;
创建数据库
create database myhive;
show databases;
创建表
create table student(id int,chinese string,math string,English string);
加载数据并查询
load data local inpath '/root/student.txt' into table student;
select * from student;