[root@hadoop100 ~]# cd /software
[root@hadoop100 software]# tar -zxvf hive-1.1.0-cdh5.14.2.tar.gz -C /opt
[root@hadoop100 software]# cd /opt
[root@hadoop100 opt]# mv hive-1.1.0-cdh5.14.2/ hive
[root@hadoop100 opt]# cd hive/
[root@hadoop100 hive]# mkdir warehouse
[root@hadoop100 hive]# vi /etc/profile
export HIVE_PATH=/opt/hive
export PATH=$PATH:$HIVE_PATH/bin
[root@hadoop100 hive]# source /etc/profile
[root@hadoop100 hive]# hive --version
[root@hadoop100 hive]# cd conf/
[root@hadoop100 conf]# mv hive-env.sh.template hive-env.sh
[root@hadoop100 conf]# vi hive-env.sh
HADOOP_HOME=/opt/hadoop
export HIVE_CONF_DIR=/opt/hive/conf
export HIVE_AUX_JARS_PATH=/opt/hive/lib
[root@hadoop100 conf]# vi hive-site.xml
<configuration>
<property>
<name>hive.metastore.warehouse.dir</name>
<value>/opt/hive/warehouse</value>
</property>
<property>
<name>hive.metastore.local</name>
<value>true</value>
</property>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://127.0.0.1:3306/hive?createDatabaseIfNotExist=true</value>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>root</value>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>ok</value>
</property>
</configuration>
[root@hadoop100 conf]# start-all.sh
[root@hadoop100 conf]# hbase-daemon.sh start maseter
或
[root@hadoop100 conf]# start-hbase.sh
[root@hadoop100 conf]# service mysql restart
[root@hadoop100 conf]# schematool -dbType mysql -initSchema
[root@hadoop100 conf]# hive
如果启动hive报错,先进mysql里,把hive数据库删掉,再创建一次
mysql -uroot -pok
show databases;
drop database hive;
create database hive;
这时候再来启动hive
create table aaa(anname varchar(10));
insert into aaa values('bbb'),('ccc');
select * from aaa;
quit;
[root@hadoop100 conf]# hbase-daemon.sh stop maseter
或
[root@hadoop100 conf]# stop-hbase.sh
[root@hadoop100 conf]# stop-all.sh
注意:开启时:先要开启hdfs,再开启hbase,最后开启hive。
关闭时:先要关闭hive,再关闭hbase,最后关闭hbase