4

I have a 3 nodes cluster and I am getting following error while running some HIVE query

FAILED: Error in metadata: MetaException(message:Unable to create database path file:/user/hive/warehouse/db_dut.db, failed to create database db_dut) FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask

My hive-site.xml contains following property

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

<property>
  <name>hive.metastore.warehouse.dir</name>
  <value>/user/hive/warehouse</value>
  <description>location of default database for the warehouse</description>
</property>

>jdbc:derby:;databaseName=/var/lib/hive/metastore/metastore_db;create=true< is correctly present at my local machine.

When i gave hadoop fs -ls /user/hive ..following output came

[root@scaj02bda01 metastore]# hadoop fs -ls /user/hive
Found 1 items
drwxrwxrwx   - hive hive          0 2013-04-09 01:40 /user/hive/warehouse
[root@scaj02bda01 metastore]# 

The default database location for warehouse is correctly mentioned in HDFS with all read write execute permission, but still i am getting the same error.

1
  • What is the value of fs.default.name property in your hadoop core-site.xml. Also. have you set the HADOOP_HOME env variable? Also, post which hive version are you using ? Commented Apr 10, 2013 at 6:53

4 Answers 4

3

It says it is unable to open database /var/lib/hive/metastore/metastore_db,this error normally comes when you dnt have permission to access the database. Use below commond then reply me:

1)SUDO chmod -R 777 /VAR/LIB/HIVE/METASTORE/METASTORE_DB

2)chmod -R a+rwx /var/lib/hive/metastore/metastore_db

3) rm /var/lib/hive/metastore/metastore_db/*.lck

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

Comments

0

I had the same issue, the problem was that the namenode not started in hadoop. Go to hadoop file and execute the following command:

.sbin/start-all.sh

after that check if the namenode started using

jsp

if not, I can refer to the following answer that helped me Hadoop "Permission denied (publickey,password,keyboard-interactive)" warning

Once you make the namenode starts, your issue will disappear.

Comments

0

I was facing the same error. I couldn't change the permissions because of the certain policies set. So, I created a new my own folder like /hdp/myapp/warehouse and specified that path in hive-site.xml as follows. This helped me to solve the issue.

<configuration>
  <property>
     <name>javax.jdo.option.ConnectionURL</name>
     <value>jdbc:derby:;databaseName=/hdp/myapp/warehouse/metastore_db;create=true</value>
  </property>
  <property>
    <name>hive.metastore.warehouse.dir</name>
    <value>/hdp/myapp/warehouse/</value>
  </property>
</configuration>

Comments

0

In your hive-site.xml for the property hive.metastore.warehouse.dir. Point to the hdfs directory not local filesystem directory. So something like localhost:8020/user/hive/warehouse. That did it for me.

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.