1.derby版hive
1.解压hive
2.进入bin目录直接启动
cd ../servers/
cd hive-1.1.0-cdh5.14.0/
bin/hive
hive> create database mytest;
2.Mysql版hive
1.安装mysql相关的软件包
yum -y install mysql mysql-server mysql-devel
2.启动mysql的服务
service mysqld start
chkconfig mysqld on
3.进入mysql的客户端然后进行授权
mysql -u用户名 -p密码
use mysql
4.配置远程连接
grant all privileges on *.* to 'root'@'%' identified by '密码' with grant option;
flush privileges;
5.设置root用户连接mysql的密码
update user set password=password('密码') where user='root';
flush privileges;
6.解压hive
7.进入conf目录下
1. cp hive-env.sh.template hive-env.sh
2. vim hive-env.sh
3.vim hive-site.sh
添加如下代码:(节点自行更换成hive所在节点)
javax.jdo.option.ConnectionURL
jdbc:mysql://node01:3306/hive?createDatabaseIfNotExist=true
javax.jdo.option.ConnectionDriverName
com.mysql.jdbc.Driver
javax.jdo.option.ConnectionUserName
root
javax.jdo.option.ConnectionPassword
hadoop
hive.cli.print.current.db
true
hive.cli.print.header
true
hive.server2.thrift.bind.host
node01
hive.metastore.uris
thrift://node01:9083
8.将 驱动包 mysql-connector-java-5.1.38.jar 放在lib目录下
9.配置HIVE环境变量
vim /etc/profile.d/hive.sh
export HIVE_HOME=/export/servers/hive-1.1.0-cdh5.14.0
export PATH=$PATH:$HIVE_HOME/bin
source /etc/profile
10.分发Hive和Hive环境变量
scp -r hive-1.1.0-cdh5.14.0 node02:`pwd`
scp -r hive-1.1.0-cdh5.14.0 node03:`pwd`
scp hive.sh node02:`pwd`
scp hive.sh node03:`pwd`
source /etc/profile
11.启动集群!!!
start-all.sh
12.启动HIve!!!
hive
查看所有的数据库
show databases;
创建一个数据库
create database myhive;
13.Hive安装成功!!!