Installing Hive 2.2.0 With Derby
Installing Hive 2.2.0 with derby
Download hive 2.2.0
Click the download a release now
Select the hive version 2.2.0 or other
“Extracting Hive “
$ tar zxvf apache-hive-2.2.0-bin.tar.gz
“Copying files to /usr/local/hive directory”
# cd /home/user/Download
# mv apache-hive-2.2.0-bin /usr/local/hive
Setting up environment for Hive
Syntax :- nano ~/.bashrc
Add the below line
export HIVE_HOME=/usr/local/hive
export PATH=$PATH:$HIVE_HOME/bin
export CLASSPATH=$CLASSPATH:/usr/local/Hadoop/lib/*:.
export CLASSPATH=$CLASSPATH:/usr/local/hive/lib/*:.
$ source ~/.bashrc
“Configuring Hive”
To configure Hive with Hadoop, you need to edit the hive-env.sh file, which is placed in the $HIVE_HOME/conf directory. The following commands redirect to Hive config folder and copy the template file:
$ cd $HIVE_HOME/conf
$ cp hive-env.sh.template hive-env.sh
Edit the hive-env.sh
Syntax: - nano hive-env.sh
Add the below line
export HADOOP_HOME=/usr/local/hadoop
“Downloading & Installing Apache Derby”
$ wget http://archive.apache.org/dist/db/derby/db-derby-10.4.2.0/db-derby-10.4.2.0-bin.tar.gz
“Extracting Derby “
$ tar zxvf db-derby-10.4.2.0-bin.tar.gz
“Copying files to /usr/local/derby directory “
We need to copy from the super user “su -”. The following commands are used to copy the files from the extracted directory to the /usr/local/derby directory:
cd /home/user
# mv db-derby-10.4.2.0-bin /usr/local/derby
“Setting up environment for Derby”
Syntax :- nano~/.bashrc
Add the below line
export DERBY_HOME=/usr/local/derby
export PATH=$PATH:$DERBY_HOME/bin
export CLASSPATH=$CLASSPATH:$DERBY_HOME/lib/derby.jar:$DERBY_HOME/lib/derbytools.jar
$ source ~/.bashrc
“Configuring Metastore of Hive”
Configuring Metastore means specifying to Hive where the database is stored. You can do this by editing the hive-site.xml file, which is in the $HIVE_HOME/conf directory. First of all, copy the template file using the following command:
$ cd $HIVE_HOME/conf
$ cp hive-default.xml.template hive-site.xml
Edit hive-site.xml
Synatax:- nano hive-site.xml
Add the below line
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:derby://localhost: port number/metastore_db;create=true </value>
<description>JDBC connect string for a JDBC metastore </description>
</property>
Now set them in HDFS
$ hadoop fs -mkdir /tmp
$ hadoop fs -mkdir /user/hive/warehouse
$ hadoop fs -chmod g+w /tmp
$ hadoop fs -chmod g+w /user/hive/warehouse
Command to verify Hive installation.
$ hive
Command to display all the tables.
hive> show tables;
OK
Time taken: 2.798 seconds
hive>