6

I am new to Hadoop and Hive world.

I have a strange problem. When I was working on hive prompt. I have created few tables and hive was showing those tables.

After exiting Hive session when I am again starting Hive terminal "show tables;" is not showing any table!. I can see tables in '/user/hive/warehouse' in HDFS.

What is wrong am I doing. Can you please help me on this?

Bhagwant
  • 161
  • 2
  • 9
  • Could you post your metastore configuration? – Nigel Tufnel Jan 20 '14 at 10:10
  • I am new to Hadoop and Hive. Could you please instruct me how to do that or where I can find that? – Bhagwant Jan 20 '14 at 10:35
  • seems you are using default derby as metastore(as you are new if my guess is correct you haven't touched the hive-site.xml i guess), please post the error or exception your getting(i mean status of query show) – vijay kumar Jan 20 '14 at 11:37

2 Answers2

7

BalduZ is right . set this in $HIVE_HOME/conf/hive-site.xml

property name = javax.jdo.option.ConnectionURL

property value = jdbc:derby:;databaseName=/home/youruser/hive_metadata/metastore_db;create=true

Next time onwards you can run hive from any dir location. This will solve your problem.

vijay kumar
  • 2,049
  • 1
  • 15
  • 18
  • Hi,dit you achivev this without installing the derby? – Fengya Li Jul 11 '14 at 10:12
  • default database that comes with hive package is derby only. No need to install it as separate. setting above property tells hive, to use embedded-derby, pointing it to specific location(/home.yourusername/hive_metadata/metastore_db) to store derby-meta files. if not specified - problem mentioned by @Balduz will occur – vijay kumar Jul 11 '14 at 11:00
  • wow,I think I just did very stupid work that I installed derby independently and start the service. – Fengya Li Jul 14 '14 at 08:26
4

I assume you are using the default configuration, so the problem is where you call hive to start working, since you need to call it from the same directory in order to see the tables you created in the previous hive session.

For example, if you call hive when you are in ~/test/hive and create some tables, and the next time you use hive you start it from ~/test you will not see the tables you created earlier. The easiest solution is to always start hive from the same directory.

However, a better solution would be to configure hive so that it uses a database like MySQL as a metastore. You can find how to do this here.

Balduz
  • 3,560
  • 19
  • 35