java.sql.SQLException:无法启动数据库“metastore_db"错误,同时使用 hive 初始化数据库 [英] java.sql.SQLException: Failed to start database 'metastore_db' ERROR, while initializing database using hive

查看:25
本文介绍了java.sql.SQLException:无法启动数据库“metastore_db"错误,同时使用 hive 初始化数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 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 Logging 使用配置初始化jar:file:/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>

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>

但是当我尝试在我的集群节点上运行一些 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 错误 security.UserGroupInformation: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',见下一个例外详情.

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.

我尝试了两件事.

1.授予权限 cd/var/lib/hive/metastore/metastore_db

1 . Giving permission to cd /var/lib/hive/metastore/metastore_db

  1. 删除 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:在home上创建一个目录说它的:hive-metastore-dir

step-1: create a directory on home say its: hive-metastore-dir

第 2 步:作为超级用户编辑 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 初始化数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆