安装需要
java 1.6,java 1.7或更高版本。
Hadoop 2.x或更高, 1.x. Hive 0.13 版本也支持 0.20.x, 0.23.x
Linux,mac,windows操作系统。以下内容适用于linux系统。
安装打包好的hive
需要先到apache下载已打包好的hive镜像,然后解压开该文件
$ tar -xzvf hive-x.y.z.tar.gz
设置hive环境变量
$ cd hive-x.y.z$ export HIVE_HOME={{pwd}}
设置hive运行路径
$ export PATH=$HIVE_HOME/bin:$PATH
编译Hive源码
下载hive源码
此处使用maven编译,需要下载安装maven。
以Hive 0.13版为例
编译hive 0.13源码基于hadoop 0.23或更高版本
$cdhive$mvncleaninstall-Phadoop-2,dist$cdpackaging/target/apache-hive-{version}-SNAPSHOT-bin/apache-hive-{version}-SNAPSHOT-bin$lsLICENSENOTICEREADME.txtRELEASE_NOTES.txtbin/(alltheshellscripts)lib/(requiredjarfiles)conf/(configurationfiles)examples/(sampleinputandqueryfiles)hcatalog/(hcataloginstallation)scripts/(upgradescriptsforhive-metastore)
编译hive 基于hadoop 0.20
$cdhive$antcleanpackage$cdbuild/dist#lsLICENSENOTICEREADME.txtRELEASE_NOTES.txtbin/(alltheshellscripts)lib/(requiredjarfiles)conf/(configurationfiles)examples/(sampleinputandqueryfiles)hcatalog/(hcataloginstallation)scripts/(upgradescriptsforhive-metastore)
运行hive
Hive运行依赖于hadoop,在运行hadoop之前必需先配置好hadoopHome。
export HADOOP_HOME=
在hdfs上为hive创建\tmp目录和/user/hive/warehouse(akahive.metastore.warehouse.dir) 目录,然后你才可以运行hive。
在运行hive之前设置HiveHome。
$ export HIVE_HOME=
在命令行窗口启动hive
$ $HIVE_HOME/bin/hive
若执行成功,将看到类似内容如图所示
如果想运行,可以装个虚拟机像VirtualBox啥的。