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
javax.jdo.option.ConnectionURL
jdbc:mysql://localhost:3306/test
javax.jdo.option.ConnectionDriverName
com.mysql.jdbc.Driver
javax.jdo.option.ConnectionPassword
hive
hive.hwi.listen.port
9999
This is the port the Hive Web Interface will listen on
datanucleus.autoCreateSchema
false
datanucleus.fixedDatastore
true
hive.metastore.local
true
controls whether to connect to remove metastore server or open a new metastore server in Hive Client JVM
三.启动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.
原文:http://www.cnblogs.com/PursuitOnly/p/5007716.html