标签:
一、环境依赖
Hive必须运行在Hadoop之上,则需要先安装Hadoop环境
http://my.oschina.net/u/204498/blog/519789
二、安装Hive
1.下载Hive
http://apache.mirrors.ionfish.org/hive/
我安装的是apache-hive-1.2.1-bin.tar.gz
[hadoop@hftclclw0001 ~]$ pwd /home/hadoop [hadoop@hftclclw0001 ~]$ wget http://apache.mirrors.ionfish.org/hive/hive-1.2.1/apache-hive-1.2.1-bin.tar.gz [hadoop@hftclclw0001 ~]$ ll total 637256 drwx------ 10 hadoop root 4096 Oct 27 02:22 apache-hive-1.2.1-bin -rw------- 1 hadoop root 92834839 Jun 26 18:34 apache-hive-1.2.1-bin.tar.gz drwx------ 3 hadoop root 4096 Oct 27 09:05 data drwx------ 11 hadoop root 4096 Oct 21 03:20 hadoop-2.7.1 -rw------- 1 hadoop root 210606807 Oct 20 09:00 hadoop-2.7.1.tar.gz drwx------ 2 hadoop root 4096 Oct 23 02:08 install-sqoop drwx------ 13 hadoop root 4096 Oct 20 09:22 spark-1.5.1-bin-hadoop2.6 -rw------- 1 hadoop root 280901736 Oct 20 09:19 spark-1.5.1-bin-hadoop2.6.tgz drwx------ 22 hadoop root 4096 Oct 23 02:08 sqoop-1.99.6-bin-hadoop200 -rw------- 1 hadoop root 68177818 May 5 22:34 sqoop-1.99.6-bin-hadoop200.tar.gz [hadoop@hftclclw0001 ~]$ cd apache-hive-1.2.1-bin/conf/ [hadoop@hftclclw0001 conf]$ pwd /home/hadoop/apache-hive-1.2.1-bin/conf [hadoop@hftclclw0001 conf]$ vi hive-env.sh ... ... HADOOP_HOME=/home/hadoop/hadoop-2.7.1 =>配置Hadoop_Home export HIVE_CONF_DIR=/home/hadoop/apache-hive-1.2.1-bin/conf =>配置HIVE_conf_home export HIVE_AUX_JARS_PATH=/home/hadoop/apache-hive-1.2.1-bin/lib/ #我使用了mysql作为metastore ,则需要在lib目录下添加mysql的驱动 [hadoop@hftclclw0001 lib]$ pwd /home/hadoop/apache-hive-1.2.1-bin/lib [hadoop@hftclclw0001 lib]$ ll | grep mysql -rw------- 1 hadoop root 848401 Oct 27 01:48 mysql-connector-java-5.1.25-bin.jar [hadoop@hftclclw0001 conf]$ vi hive-site.xml [hadoop@hftclclw0001 conf]$ cat hive-site.xml <?xml version="1.0"?> <configuration> <property> <name>hive.metastore.local</name> <value>false</value> =>metastore我的mysql不是在该server上 </property> <property> <name>javax.jdo.option.ConnectionURL</name> <value>jdbc:mysql://{ip:port}/{databases}</value> </property> <property> <name>javax.jdo.option.ConnectionDriveName</name> <value>com.mysql.jdbc.Driver</value> </property> <property> <name>javax.jdo.option.ConnectionUserName</name> <value>{username}</value> </property> <property> <name>javax.jdo.option.ConnectionPassword</name> <value>{password}</value> </property> <property> <name>hive.metastore.warehouse.dir</name> <value>/hive/warehouse</value> =>hive的仓库目录,需要在HDFS上创建,并修改权限 </property> </configuration> [hadoop@hftclclw0001 conf]$ vi hive-log4j.properties => Log4j的配置,可以修改日志目录 ...
2.启动metastore
[hadoop@hftclclw0001 bin]$ pwd /home/hadoop/apache-hive-1.2.1-bin/bin [hadoop@hftclclw0001 bin]$ ./hive --service metastore & [hadoop@hftclclw0001 bin]$ ps ax|grep metastore ... ...
3.启动HiveServer2
[hadoop@hftclclw0001 bin]$ pwd /home/hadoop/apache-hive-1.2.1-bin/bin [hadoop@hftclclw0001 bin]$ ./hive --service hiveserver2 & [hadoop@hftclclw0001 bin]$ ps ax|grep HiveServer2 ... ...
4.启动shell 或是 beeline
[hadoop@hftclclw0001 bin]$ ./hive shell ... ...
标签:
原文地址:http://my.oschina.net/u/204498/blog/522772