1

I am a starter to hive. When I try to execute any hive commands:

hive>SHOW TABLES;

it's showing the below error:

FAILED: Error in metadata: javax.jdo.JDOFatalDataStoreException: Failed to start database '/var/lib/hive/metastore/metastore_db', see the next exception for details.
NestedThrowables:
java.sql.SQLException: Failed to start database '/var/lib/hive/metastore/metastore_db', see the next exception for details.
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask
2

4 Answers 4

5

It looks like derby locking issue. you can temporarily fix this issue by deleting the lock file inside the directory /var/lib/hive/metastore/metastore_db. But this issue will also occur in future also

sudo rm -rf /var/lib/hive/metastore/metastore_db/*.lck

With default hive metastore embedded derby, it is not possible to start multiple instance of hive at the same time. By changing hive metastore to mysql or postgres server this issue can be solved.

See the following cloudera documentation for changing hive metastore

http://www.cloudera.com/content/cloudera-content/cloudera-docs/CDH4/4.2.0/CDH4-Installation-Guide/cdh4ig_topic_18_4.html

Sign up to request clarification or add additional context in comments.

Comments

2

I've encountered similar error when I forgot about another instance of spark-shell running on same node.

Comments

1

update hive-site.xml under ~/hive/conf folder as below name/value and try this:

 <name>javax.jdo.option.ConnectionURL</name>
 <value>jdbc:derby:;databaseName=/var/lib/hive/metastore/metastore_db;create=true</value>

Comments

0

In my case I needed to create a directory and grant proper permissions:

$ sudo mkdir /var/lib/hive/metastore/
$ sudo chown hdfs:hdfs /var/lib/hive/metastore/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.