Shades88
Shades88

Reputation: 8360

Hive tables went missing

I had created a couple of tables in hive. I hit a few queries on them. Then exited hive, closed hadoop mapred and dfs after that. Then came back the next day only to see that tables went missing !!

My hive uses local metastore. After a lot of searching I saw only one such issue posted by someone. It was suggested in the answer that local if metastore is used then hive should be started from that same location. And I had done the same. I ran the hive from the master only, never even had logged into slave. Metastore folder is still there. So what must have gone wrong? I checked datanode logs of hadoop and hive metastore logs. But found nothing. Where can I found what went wrong? Please help me with this. Also what can be done to avoid such things?

Upvotes: 1

Views: 2875

Answers (2)

raj5045
raj5045

Reputation: 31

If you use local metastore, Hive creates metastore_db in the directory from where hiveserver2 is started. So if you start the hiveserver2 from a different directory location next time, then a new metastore_db will be created at that location and this metastore_db will not have metadata about your earlier tables.

Upvotes: 2

Dan Ciborowski - MSFT
Dan Ciborowski - MSFT

Reputation: 7207

Where you using a database the first day? Where you using it the second day?

Meaning

hive> show databases;  
OK
default
test
Time taken: 1.575 seconds
hive> use database test;
hive> show tables;
OK
blah
Time taken: 0.141 seconds
hive use table blah;

If you forgot to use a database or create one things could get messy.

Also what does the following command return?

sudo -u hdfs hadoop fs -ls -R \

Upvotes: 0

Related Questions