java.sql.SQLException:在使用配置单元初始化数据库时,无法启动数据库'metastore_db'错误 [英] java.sql.SQLException: Failed to start database 'metastore_db' ERROR, while initializing database using hive
问题描述
我在3个群集上安装了Hadoop和Hive。我能够从HIVE运行的集群节点登录到配置单元。
root @ NODE_3 hive]#hive使用
中的配置初始化日志记录jar:file:/ usr / lib / hive / lib /hive-common-0.10.0-cdh4.2.0.jar!/hive-log4j.properties
Hive历史记录
file = / tmp / root / hive_job_log_root_201304020248_306369127.txt hive> show
tables;确保所花费的时间:1.459秒配置单元>
但是,当我尝试在群集节点上运行一些配置单元测试时,下面的错误。
这里它试图启动数据库为用户= ashsshar {我的用户名}
3/04/02 02:32:44信息mapred.JobClient:清理临时区域
hdfs://scaj-ns/user/ashsshar/.staging/job_201304020010_0080 13/04 / 02
02:32:44错误security.UserGroupInformation:
PriviledgedActionException as:ashsshar(auth:SIMPLE)
cause:java.io.IOException:javax.jdo.JDOFatalDataStoreException:
无法创建数据库'/ var / lib / hive / metastore / metastore_db',请参阅
以获取详细信息。 NestedThrowables:
java.sql.SQLException:无法创建数据库
'/ var / lib / hive / metastore / metastore_db',请参阅下一个例外情况,以了解
的详细信息。 java.io.IOException:javax.jdo.JDOFatalDataStoreException:
无法创建数据库'/ var / lib / hive / metastore / metastore_db',请参阅
以获取详细信息。 NestedThrowables:
java.sql.SQLException:无法创建数据库
'/ var / lib / hive / metastore / metastore_db',请参阅下一个针对
详细信息的例外。
我尝试了两件事。
1。授予cd / var / lib / hive / metastore / metastore_db权限
$ b
- 删除rm / var / lib / hive / metastore / metastore_db / * lck
但是我仍然得到相同的错误
这似乎是创建Metastore的问题。我通过创建目录并将值设置为该目录来解决此问题,如下所示:
step-1:在home上创建一个目录,例如:hive-metastore-dir
第二步:超级用户编辑hive-site.xml(它的in:/ usr / lib / hive / conf),如下所示:
< name> javax.jdo.option.ConnectionURL< / name>
< value> jdbc:derby:; databaseName = / var / lib / hive / metastore / metastore_db; create = true< / value>
至
<名称>&javax.jdo.option.ConnectionURL LT; /名称>
< value> jdbc:derby:; databaseName = / home / hive-metastore-dir / metastore / metastore_db; create = true< / value>
第3步:以 sudo hive 启动CLI并执行您的查询。
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 Logging initialized using configuration in jar:file:/usr/lib/hive/lib/hive-common-0.10.0-cdh4.2.0.jar!/hive-log4j.properties Hive history file=/tmp/root/hive_job_log_root_201304020248_306369127.txt hive> show tables ; OK Time taken: 1.459 seconds hive>
But when i try to run some hive test on my cluster nodes , I am getting following given below error.
Here it is trying to initilize data base as user =ashsshar{my username}
3/04/02 02:32:44 INFO mapred.JobClient: Cleaning up the staging area hdfs://scaj-ns/user/ashsshar/.staging/job_201304020010_0080 13/04/02 02:32:44 ERROR security.UserGroupInformation: PriviledgedActionException as:ashsshar (auth:SIMPLE) cause:java.io.IOException: javax.jdo.JDOFatalDataStoreException: Failed to create database '/var/lib/hive/metastore/metastore_db', see the next exception for details. NestedThrowables: java.sql.SQLException: Failed to create database '/var/lib/hive/metastore/metastore_db', see the next exception for details. java.io.IOException: javax.jdo.JDOFatalDataStoreException: Failed to create database '/var/lib/hive/metastore/metastore_db', see the next exception for details. NestedThrowables: java.sql.SQLException: Failed to create database '/var/lib/hive/metastore/metastore_db', see the next exception for details.
I have tried two things .
1 . Giving permission to cd /var/lib/hive/metastore/metastore_db
- Removing 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:
step-1: create a directory on home say its: hive-metastore-dir
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>
to
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:derby:;databaseName=/home/hive-metastore-dir/metastore/metastore_db;create=true</value>
step-3: start the CLI as sudo hive and perform your queries.
这篇关于java.sql.SQLException:在使用配置单元初始化数据库时,无法启动数据库'metastore_db'错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!