Last Updated: February 25, 2016
·
608
· vidyasagar

Hive CDH 4.4.0 Installation

Hive will be installed only on one machine, which preferably will also be having the following components on it – although not necessarily
Namenode and Job tracker
MySQL Metastore DB
In order to install Hive, go to the path

Step 1: cd /usr/local/hadoop

Step2: Download the TAR file from the archive.cloudera.com

sudo wget  http://archive.cloudera.com/cdh4/cdh/4/hive-0.10.0-cdh4.4.0.tar.gz

Step 3: Extract the tar file

tar -zxvf hive-0.10.0-cdh4.4.0.tar.gz

Step 4: Downloaded file should be in this path

cd /usr/local/hadoop/hive-0.10.0-cdh4.4.0

Step 5: Set the etc environment

sudo nano /etc/environment. Click enter and add the path files & jar files.

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lib/jvm/java-6-openjdk-amd64/bin:/usr/local/hadoop/hadoop-2.0.0-cdh4.4.0/bin: /usr/local/hadoop/hadoop-2.0.0-cdh4.4.0/sbin:/usr/local/hadoop/hive-0.10.0-cdh4.4.0/bin"
HADOOP_HOME="/usr/local/hadoop/hadoop-2.0.0-cdh4.4.0"
HIVE_HOME="/usr/local/hadoop/hive-0.10.0-cdh4.4.0"
HIVE_AUX_JARS_PATH="/usr/local/hadoop/hive-0.10.0-cdh4.4.0/lib/mysql-connector-java-5.1.18-bin.jar"
HADOOP_CONF_DIR="/usr/local/hadoop/hadoop-2.0.0-cdh4.4.0/etc/hadoop"

Step 6: Set the source environment

source /etc/environment

Step 7: Set up Metastore DB for Hive
Metastore DB stores the schema information of Hive
By default it is set to derby database
We need to move it to mysql or postgresql in order to allow multiple Hive querying sessions

sudo apt-get install mysql-server
sudo apt-get install mysql-client

Create the root user and password when prompted to do so

mysql –u root –p

enter password:

Configuring HIVE:
Go to Hive Home : cd $HIVE_HOME
Copy the file from hive-default.xml.template to hive-site.xml
sudo nano hive-site.xml & change the following properties

    <property>
            <name>javax.jdo.option.ConnectionURL</name>
                    <value>jdbc:mysql://localhost:3306/hadoop?createDatabaseIfNotExists=true</value>
           </property>
     <property>
     <name>javax.jdo.option.ConnectionDriverName</name>
     <value>com.mysql.jdbc.Driver</value>
     </property>  
<property>
  <name>javax.jdo.option.ConnectionUserName</name>
  <value>root</value>
  <description>username to use against metastore database</description>
</property>
<property>
  <name>javax.jdo.option.ConnectionPassword</name>
  <value>root</value>
  <description>password to use against metastore database</description>
</property>