Reputation: 1635
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.
Upvotes: 4
Views: 13727
Reputation: 1212
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.
Upvotes: 0
Reputation: 2239
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>
Upvotes: 0
Reputation: 964
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.
Upvotes: 0
Reputation: 31
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
Upvotes: 3