How to configure Hive warehouse path?

2019-06-27 03:51发布

问题:

I modified this part

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

of hive-default.xml.template with my own path. When running hive, if I try to create a table it says it could create file://mypath/etc.. and it is still looking for /user/hive/warehouse. Did I do something wrong? I tried to create hive-site.xml, and it does not seem to work either.

回答1:

Change the warehouse path in hive-site.xml as follows:

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

Give the permission to <Your_Path_HERE> directory if it is on local system

sudo chown -R user <Your_Path_HERE>
sudo chmod -R 777 <Your_Path_HERE>

if given path is on HDFS , then stop and start the hadoop services

stop-all.sh
start-all.sh


回答2:

You have specify the property in hive-site.xml:

<property>
  <name>hive.metastore.warehouse.dir</name>
  <value>/user/hivestore/warehouse </value>
</property>

And once modified try reloading the hive shell by exiting and starting hive-shell.

Also, make sure that everyone using hive have appropriate read/write permissions to the the directory specified in the above property.



标签: hadoop hive hdfs