ubuntu14.04使用MySQL数据库安装配置Hive 1.2.1

ubuntu14.04使用MySQL数据库安装配置Hive 1.2.1
一.准备Mysql已经安装好。本人装的是navicat,图形化界面。
    并在本地用root用户建立了test数据库
 
二.安装Hive
•解压Hive
•tar zxvf  apache-hive-1.2.1-bin.tar.gz
•建立软连接
•sudo ln –s apache-hive-1.2.1 current
•添加环境变量
•export HIVE_HOME=/opt/hive/current
•export PATH=….HIVE_HOME/bin:$PATH:.
修改hive-site.xml
<property>
   <name>javax.jdo.option.ConnectionURL </name>
   <value>jdbc:mysql://localhost:3306/test </value>
</property>
 
<property>
   <name>javax.jdo.option.ConnectionDriverName </name>
   <value>com.mysql.jdbc.Driver </value>
</property>
<property>
   <name>javax.jdo.option.ConnectionPassword </name>
   <value>hive </value>
</property>
 
<property>
   <name>hive.hwi.listen.port </name>
   <value>9999 </value>
   <description>This is the port the Hive Web Interface will listen on </descript ion>
</property>
<property>
   <name>datanucleus.autoCreateSchema </name>
   <value>false </value>
</property>
 
<property>
   <name>datanucleus.fixedDatastore </name>
   <value>true </value>
</property>
<property>
         <name>hive.metastore.local </name>
         <value>true </value>
         <description>controls whether to connect to remove metastore server or open a new metastore server in Hive Client JVM </description>
</property>
三.启动hive
错误:FAILED: Error in metadata: javax.jdo.JDOFatalDataStoreException: Failed to create database 'metastore_db', see the next exception for details.
原因是在同一个目录下面 开启了2个终端。
而你上次在一个目录进入hive 建立了一张表  下次在另外一个目录下面登录。
则上次建立的表 在这次登录中是无法被发现的。
解决办法就是在同一个目录下操作Hive就OK了。
四.再次命令行键入
•hive
Logging initialized using configuration in jar:file:/home/test/Desktop/hive-0.8.1/lib/hive-common-0.8.1.jar!/hive-log4j.properties
Hive history file=/tmp/test/hive_job_log_test_201208260529_167273830.txt
hive>
测试语句
•建立测试表test
•create table test (key string);
•show tables;


安装ok lalala.

原文地址:https://www.cnblogs.com/PursuitOnly/p/5007716.html