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 Answers
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.