Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Big Data Hadoop & Spark by (11.4k points)

I tried to install hive on a raspberry pi 2. I installed Hive by uncompress zipped Hive package and configure $HADOOP_HOME and $HIVE_HOME manually under hduser user-group I created. When running hive, I got the following error message: hive

ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console.

Exception in thread "main" java.lang.RuntimeException: Hive metastore database is not initialized. Please use schematool (e.g. ./schematool -initSchema -dbType ...) to create the schema. If needed, don't forget to include the option to auto-create the underlying database in your JDBC connection string (e.g. ?createDatabaseIfNotExist=true for mysql)

So I ran the command suggested in the above error message: schematool -dbType derby -initSchema I got the error message:

Error: FUNCTION 'NUCLEUS_ASCII' already exists. (state=X0Y68,code=30000) org.apache.hadoop.hive.metastore.HiveMetaException: Schema initialization FAILED! Metastore state would be inconsistent !! * schemaTool failed *

It seems there aren't any helpful information when I try to google this error online. Any help or any explanation on how Hive works with Derby would be appreciated!

1 Answer

0 votes
by (32.3k points)
edited by

If the first thing you did after installing hive was run it, hive attempted to create/initialize the metastore_db, but apparently might not get it right. On that initial run, maybe that is why you saw the error:

Exception in thread "main" java.lang.RuntimeException: Hive metastore database is not initialized. Please use schematool (e.g. ./schematool -initSchema -dbType ...) to create the schema. If needed, don't forget to include the option to auto-create the underlying database in your JDBC connection string (e.g. ?createDatabaseIfNotExist=true for mysql)

Running hive, even though it fails, creates a metastore_db directory in the directory from which you execute hive:

ubuntu15-laptop: ~ $>ls -l |grep meta

drwxrwxr-x 5 testuser testuser 4096 Apr 14 12:44 metastore_db

So after that when you tried running:

ubuntu15-laptop: ~ $>schematool -initSchema -dbType derby

The metastore already existed, but not in complete form.

So, before you run hive for the first time, run

schematool -initSchema -dbType derby

If you have already executed hive and then you try running init Schema and it's failing, 

I would suggest you to try this approach:

mv metastore_db metastore_db.tmp

Then,  re-run:

schematool -initSchema -dbType derby

Finally, execute the hive again and it will work.

If you want more knowledge regarding Hive, then refer the following video tutorial:

Related questions

Browse Categories

...