Hive package comes with derby as default embeded metastore. Follow below mentioned steps to install Hive with embedded metastore:

1. Download the latest version of Hive from here.
2. Uncompress the package on linux:

tar –xzvf apache-hive-0.13.1-bin.tar.gz

3. Add following to ~/.bash_profile

sudo nano ~/.bash_profile

export HIVE_HOME=/home/hduser/hive-0.13.1
export PATH=$PATH:$HIVE_HOME/bin

Where hduser is the user name and hive-0.13.1 is the hive directory extracted from tar.

4. Run hive from terminal:

hive

5. Make sure that the Hive node has connection to hadoop cluster.

6. This installation use embedded Derby database and store the data on local filesystem. Only one hive session could be open on the node.

7. If different users try to run the hive shell, the second would get: “Failed to start database ‘metastore_db’” error.

8. Run hive queries for datastore to test for the installation.

hive> SHOW TABLES;
hive> CREATE TABLE sales(id INT, product String) ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t';

9. Logs are generated per user bases in /tmp/<usrename> folder.

Share this:

Leave a Reply

Your email address will not be published. Required fields are marked *