hive0.13.1安装-mysql server作为hive的metastore
hive0.13.1在hadoop2.4.1伪分布式部署上安装过程
环境:redhat enterprice 6.5 +hadoop2.4.1+hive0.13.1+mysql单节点伪分布式部署
相关网址:
hive之metastore的三种保存方式:https://cwiki.apache.org/confluence/display/Hive/AdminManual+MetastoreAdmin
为分布式hadoop2.2.0+hive1.2.0配置:http://www.kankanews.com/ICkengine/archives/72851.shtml
***remote metastore config :http://www.cnblogs.com/ggjucheng/archive/2012/04/26/2471341.html
step1 安装mysql
step2 在mysql数据库中创建数据库hive用来存储metastore数据,同时创建能够进入hive的用户
mysql> create database hive; mysql> create user hadoop 'hadoop'@'localhost' identified by '123456'; mysql> grant all privileges on hive.* to 'hadoop'@'localhost' with grant option;
mysql> flush privileges;
step3 下载编译好的hive包:http://mirrors.cnnic.cn/apache/hive/stable/apache-hive-0.13.1-bin.tar.gz
step4 解压apache-hive-0.13.1-bin.tar.gz包
tar -zxvf apache-hive-0.13.1-bin.tar.gz -C /opt/
step5 配置hive相关文件
a.配置hive/conf中的hive-site.xml 文件(默认的没有这个文件,我们复制hive-default.xml.template,然后改名为hive-site.xml. 把其中的配置信息替换成下面这些)
<property>
<name>hive.metastore.uris</name>
<value></value>
<description>此处value值为空,表示hive.metastore.local为true</description>
</property>
<property> <name>javax.jdo.option.ConnectionURL</name> <value>jdbc:mysql://localhost: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>hadoop</value> </property> <property> <name>javax.jdo.option.ConnectionPassword</name> <value>123456</value> </property>
b.把MySQL的JDBC驱动包复制到hive/lib目录下(如果没有lib目录自己建一个)。
下载地址:http://dev.mysql.com/downloads/connector/j/
step6.测试:进入到/opt/apache-hive-0.13.1-bin/bin/目录执行 hive进入hive然后执行show tables;查看结果如下:
# cd /opt/apache-hive-0.13.1-bin/bin # ./hive f14/08/09 20:09:50 WARN conf.hiveconf:DEPRECATED:hive.metastore.ds.retry.* no longer has any effect.use hive.hmshandler.retry.* instead logging initialized using configuration in jar:file:/opt/apache-hive-0.13.1-bin/lib/hive-common-0.13.1.jar!/hive-log4j.properties hive> show tables;
OK
Time taken: 1.61 seconds, Fetched:1 row(s)
hive>
如果不报错,表明基于独立元数据库的Hive已经安装成功了。