问题描述
我在 3 个集群上安装了 Hadoop 和 Hive.我可以从运行 HIVE 的集群节点登录到 hive.
I installed Hadoop and Hive on 3 cluster. I have able to login to hive from my cluster node where HIVE is running.
root@NODE_3 hive]# hive 使用配置初始化日志记录jar:文件:/usr/lib/hive/lib/hive-common-0.10.0-cdh4.2.0.jar!/hive-log4j.properties蜂巢历史文件=/tmp/root/hive_job_log_root_201304020248_306369127.txt 配置单元> 显示表;OK 耗时:1.459 秒 hive>
但是当我尝试在我的集群节点上运行一些 hive 测试时,我收到以下错误.
But when i try to run some hive test on my cluster nodes , I am getting following given below error.
这里尝试以用户 =ashsshar{my username} 身份初始化数据库
Here it is trying to initilize data base as user =ashsshar{my username}
3/04/02 02:32:44 INFO mapred.JobClient:清理暂存区hdfs://scaj-ns/user/ashsshar/.staging/job_201304020010_0080 13/04/0202:32:44 错误安全.用户组信息:PriviledgedActionException as:ashsshar (auth:SIMPLE)原因:java.io.IOException:javax.jdo.JDOFatalDataStoreException:无法创建数据库/var/lib/hive/metastore/metastore_db",请参阅下一个例外的细节.嵌套的Throwables:java.sql.SQLException:创建数据库失败'/var/lib/hive/metastore/metastore_db',请参阅下一个异常细节.java.io.IOException:javax.jdo.JDOFatalDataStoreException:无法创建数据库/var/lib/hive/metastore/metastore_db",请参阅下一个例外的细节.嵌套的Throwables:java.sql.SQLException:创建数据库失败'/var/lib/hive/metastore/metastore_db',请参阅下一个异常详情.
我尝试了两件事.
1 .授予权限 cd/var/lib/hive/metastore/metastore_db
1 . Giving permission to cd /var/lib/hive/metastore/metastore_db
- 删除 rm/var/lib/hive/metastore/metastore_db/*lck
但我仍然遇到同样的错误
But still i am getting the same error
推荐答案
似乎是创建元存储的问题.我通过创建一个目录并将值设置为该目录来解决这个问题,如下所示:
It seems to be an issue with creating the metastore. I solved this by creating a directory and setting the value to that directory as follows:
第 1 步:在 home 上创建一个目录,说它:hive-metastore-dir
step-1: create a directory on home say its: hive-metastore-dir
第二步:作为超级用户编辑 hive-site.xml(其在:/usr/lib/hive/conf)如下:
step-2: being super user edit the hive-site.xml (its in: /usr/lib/hive/conf) as follows:
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:derby:;databaseName=/var/lib/hive/metastore/metastore_db;create=true</value>
到
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:derby:;databaseName=/home/hive-metastore-dir/metastore/metastore_db;create=true</value>
第 3 步:以 sudo hive 身份启动 CLI 并执行查询.
step-3: start the CLI as sudo hive and perform your queries.
这篇关于java.sql.SQLException: 无法启动数据库 'metastore_db' 错误,同时使用 hive 初始化数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!