2
votes

i have installed Hive, but when i write command to create table "CREATE TABLE foo(id int, msg STRING);". I throws Exception "Cleanup action completed FAILED: Error in metadata: javax.jdo.JDOFatalDataStoreException: Failed to create database 'metastore_db', see the next exception for details.NestedThrowables:java.sql.SQLException: Failed to create database 'metastore_db', see the next exception for details.FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask". Why this exception is occur, either it is configuration problem or something else.

1
I think that means you have a problem with the installation. did you work with it before without getting that exception?eyossi
make sure you have hadoop working before you try hive, and that the user has the permissions for hadoop as welleyossi
no i didn't work on it before. first time i am using it. yes hadoop is working.user1099871
when you say that hadoop is working it means you can copy files to HDFS and run mapred?eyossi
Are you able to run "hadoop fs -ls /". If so, it means Hadoop is up and running. It seems like a problem with your embedded derby metastore. Can you ensure this is the only Hive client running at that time? Also, what version of hadooop and Hive are you using?Mark Grover

1 Answers

7
votes

I had the same problem:

voicestreams@voicestreams:~/testbed/eclipseprojects/workspace/mapreducesort/java$ hive

Hive history file=/tmp/root/hive_job_log_root_201210282200_1123208966.txt

hive> show tables

FAILED: Error in metadata: 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. FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask

I had installed Hive using apt-get install hadoop-hive. It worked after i moved the metastore from /var/lib/hive/. I did that by editing: /etc/hive/conf.dist/hive-site.xml

from:

<property>
  <name>javax.jdo.option.ConnectionURL</name>
  <value>jdbc:derby:;databaseName=/var/lib/hive/metastore/metastore_db;create=true</value>
  <description>JDBC connect string for a JDBC metastore</description>
</property>

to:

<property>  
<name>javax.jdo.option.ConnectionURL</name>
  <value>jdbc:derby:;databaseName=/home/voicestreams/hive/metastore/metastore_db;create=true</value>
  <description>JDBC connect string for a JDBC metastore</description>
</property>

`

Basically, i changed the databaseName= to a writable directory (/home/voicestreams/hive/) and it worked. Of course, i had to create /home/voicestreams/hive/ before running hive again.Hope this helps.