Hive2.1.1环境部署

一、Hive包的下载 
http://mirror.bit.edu.cn/apache/hive/hive-2.1.1/网址下载 
apache-hive-2.1.1-bin.tar.gz

二、部署需求

Installation and Configuration
You can install a stable release of Hive by downloading a tarball, or you can download the source code and build Hive from that.
Running HiveServer2 and Beeline
Requirements
Java 1.7
Note:  Hive versions 1.2 onward require Java 1.7 or newer. Hive versions 0.14 to 1.1 work with Java 1.6 as well. Users are strongly advised to start moving to Java 1.8 (see HIVE-8607).  
Hadoop 2.x (preferred), 1.x (not supported by Hive 2.0.0 onward).
Hive versions up to 0.13 also supported Hadoop 0.20.x, 0.23.x.
Hive is commonly used in production Linux and Windows environment. Mac is a commonly used development environment. The instructions in this document are applicable to Linux and Mac. Using it on Windows would require slightly different steps
 
 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

从官网这句话我们可以知道部署hive的条件 
1、需要部署一个hadoop集群,而且是hadoop2.X。 
2、需要安装java1.7+

三、开始部署 
我已经部署了hadoop2.8.1的环境,java1.8也已部署完毕。 
具体参照http://blog.youkuaiyun.com/gavin_chun/article/details/77944019

1、将apache-hive-2.1.1-bin.tar.gz上传至/opt/soft目录下解压并重命令为hive

[root@hadoop001 soft]# tar -zxvf apache-hive-2.1.1-bin.tar.gz
[root@hadoop001 soft]# mv  apache-hive-2.1.1-bin hive
 
 
  • 1
  • 2

2、配置hive环境变量

[root@hadoop001 conf]# vim  /etc/profile
export HIVE_HOME=/opt/soft/hive
export PATH=$HIVE_HOME/bin:$PATH
 
 
  • 1
  • 2
  • 3

使环境变量生效source /etc/profile,验证

[root@hadoop001 conf]# hive -help
which: no hbase in (/opt/soft/hive/bin:/opt/soft/hadoop/bin:/opt/soft/hadoop/sbin:/opt/soft/zookeeper/bin:/usr/java/jdk1.7.0_67-cloudera/bin:/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/soft/hive/lib/log4j-slf4j-impl-2.4.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/soft/hadoop/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]
usage: hive
 -d,--define <key=value>          Variable subsitution to apply to hive
                                  commands. e.g. -d A=B or --define A=B
    --database <databasename>     Specify the database to use
 -e <quoted-query-string>         SQL from command line
 -f <filename>                    SQL from files
 -H,--help                        Print help information
    --hiveconf <property=value>   Use value for given property
    --hivevar <key=value>         Variable subsitution to apply to hive
                                  commands. e.g. --hivevar A=B
 -i <filename>                    Initialization SQL file
 -S,--silent                      Silent mode in interactive shell
 -v,--verbose                     Verbose mode (echo executed SQL to the
                                  console)
 
 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21

3、修改hive-env.sh(48行)添加HADOOP_HOME配置

vim hive-env.sh
HADOOP_HOME=/opt/soft/hadoop
 
 
  • 1
  • 2

4、编辑hive-site.xml设置元数据存储使用的数据库类型

<configuration>
<property> 
<!--设置数据库连接的URL -->                      <name>javax.jdo.option.ConnectionURL</name>   
<!--使用本地MySQL数据库(ruoze_hive在启动hive时会自动创建) -->                                     <value>jdbc:mysql://localhost:3306/ruoze_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>root</value>
</property>                                              </configuration>
 
 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16

5、拷贝数据库驱动到hive/lib目录下

[root@hadoop001 soft]# mv mysql-connector-java-5.1.32-bin.jar hive/lib/
 
 
  • 1

四、启动Hive 
1、启动前先初始化

[root@hadoop001 ~]# schematool -dbType mysql -initSchema
 
 
  • 1

2、启动hive

[root@hadoop001 ~]# hive

which: no hbase in (/opt/soft/hive/bin:/opt/soft/hadoop/bin:/opt/soft/hadoop/sbin:/opt/soft/zookeeper/bin:/usr/java/jdk1.7.0_67-cloudera/bin:/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/soft/hive/lib/log4j-slf4j-impl-2.4.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/soft/hadoop/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:/opt/soft/hive/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. tez, spark) or using Hive 1.X releases.
hive>
 
 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12

注:hive是一个客户端组件,在Hadoop集群中选择一台安装即可!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值