Create table exception in hive?

独自空忆成欢 提交于 2019-12-24 00:10:16

问题


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



来源:https://stackoverflow.com/questions/10735843/create-table-exception-in-hive

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!