Hive 安装
步骤 1.启动MySQL,并进入MySQL
2.创建hive用户
mysql>create user 'hive' identified by 'hive';
3.进行授权
mysql>GRANT ALL PRIVILEGES ON *.* TO 'hive'@'%' IDENTIFIED BY 'hive' WITH GRANT OPTION;
mysql>grant all on *.* to hive@'master' identified by 'hive';
mysql>grant all on *.* to hive@'localhost' identified by 'hive';
mysql>grant all on *.* to hive@'%' identified by 'hive';
4.刷新
mysql>flush privileges;
5.使用hive用户登录,并创建hive数据库
mysql -uhive -phive
mysql>create database hive character set utf8;
mysql>flush privileges;
mysql>show databases;
6.在Hadoop上安装Hive
(1)解压 apache-hive-1.2.1-bin.tar.gz压缩包
(2)cd /usr/local/src/ 下将apache-hive-1.2.1-bin移动到 hive-1.2.1
(3)将mysql-connector-java-5.1.25.jar 拷贝到hive-1.2.1/lib/下
7.配置环境变量
(1) sudo vi /etc/profile 打开文件
(2)设置参数
export HIVE_HOME=/usr/local/src/hive-1.2.1
export PATH=
P
A
T
H
:
PATH:
PATH:HIVE_HOME/bin
export CLASSPATH=
C
L
A
S
S
P
A
T
H
:
CLASSPATH:
CLASSPATH:HIVE_HOME/bin
(3)使环境变量生效:source /etc/profile
8.修改配置文件
(1) cd /usr/local/src/hive-1.2.1/conf/ 下
(2)cp hive-env.sh.template hive-env.sh
cp hive-default.xml.template hive-site.xml
(3)修改文件 vi hive-site.xml
(4)start-all.sh
(5)启动hive hive
到此hive安装完毕,进入hive库中
9.use hive;
show tables;显示表