1.vm安装(略)
2.jdk安装(略)
3.hive安装
a.下载hive
http://mirrors.cnnic.cn/apache/hive/hive-2.1.1/
cd hive/
tar -zxvf apache-hive-2.1.1-bin.tar.gz
[root@namenode hive]# cd apache-hive-2.1.1-bin/
[root@namenode apache-hive-2.1.1-bin]# ll
b.修改环境变量
[root@namenode ~]# vi /etc/profile
#HIVE
export HIVE_HOME=/root/hive/apache-hive-2.1.1-bin
export PATH=$PATH:$HIVE_HOME/bin
"/etc/profile" 90L, 2123C written
wq!
[root@namenode ~]# source /etc/profile
3.修改配置文件
[root@namenode apache-hive-2.1.1-bin]# cd conf/
[root@namenode conf]# vi hive-site.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>hive.metastore.warehouse.dir</name>
<value>/root/hive/apache-hive-2.1.1-bin/warehouse</value>
<description>location of default database for the warehouse</description>
</property>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:derby:/root/hive/apache-hive-2.1.1-bin/metastore_db;create=true</value>
<description>JDBC connect string for a JDBC metastore</description>
</property>
</configuration>
4.初始化数据库
[root@namenode conf]# schematool -initSchema -dbType derby
which: no hbase in (.:/root/hadoop/hadoop-2.7.2/bin:/root/java/jdk1.8.0_77/bin:.:/root/hadoop/hadoop-2.7.2/bin:/root/java/jdk1.8.0_77/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/java/jdk1.8.0_77/bin:/root/bin:/root/java/jdk1.8.0_77/bin:/root/hive/apache-hive-2.1.1-bin/bin)
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/root/hive/apache-hive-2.1.1-bin/lib/log4j-slf4j-impl-2.4.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/root/hadoop/hadoop-2.7.2/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Metastore connection URL: jdbc:derby:/root/hive/apache-hive-2.1.1-bin/metastore_db;create=true
Metastore Connection Driver : org.apache.derby.jdbc.EmbeddedDriver
Metastore connection User: APP
Starting metastore schema initialization to 2.1.0
Initialization script hive-schema-2.1.0.derby.sql
Initialization script completed
5.启动程序
[root@namenode conf]# mkdir -p /opt/hive-2.0.0/warehouse
[root@namenode conf]# chmod a+rwx /opt/hive-2.0.0/warehouse
[root@namenode conf]# hive
which: no hbase in (.:/root/hadoop/hadoop-2.7.2/bin:/root/java/jdk1.8.0_77/bin:.:/root/hadoop/hadoop-2.7.2/bin:/root/java/jdk1.8.0_77/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/java/jdk1.8.0_77/bin:/root/bin:/root/java/jdk1.8.0_77/bin:/root/hive/apache-hive-2.1.1-bin/bin)
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/root/hive/apache-hive-2.1.1-bin/lib/log4j-slf4j-impl-2.4.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/root/hadoop/hadoop-2.7.2/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Logging initialized using configuration in jar:file:/root/hive/apache-hive-2.1.1-bin/lib/hive-common-2.1.1.jar!/hive-log4j2.properties Async: true
Hive-on-MR is deprecated in Hive 2 and may not be available in the future versions. Consider using a different execution engine (i.e. spark, tez) or using Hive 1.X releases.
hive>
>
>
>
>
> show databases;
OK
default
Time taken: 6.81 seconds, Fetched: 1 row(s)