Friday, April 1, 2016

Hive Installation Guide

Hive Installation Guide

Environment Setup

  • Install latest Apache stable build.
  • Download Hive 0.12 version.

Hive Installation

Download the latest Hive version. In our case it is Hive 01.2.
  • Execute following command to download Hive 01.2
    wget http://apache.osuosl.org/hive/hive-0.12.0/hive-0.12.0.tar.gz
  • Unzip the compressed hive file by executing the following command:
    tar –xvzf hive-0.12.0.tar.gz


  • Login as root and create a directory named “hive”, under /usr/local. Change the ownership of this directory to the hadoop user “hduser” and group “hadoop”. This is done mainly for our convenience, to differentiate each framework, software and application with different users. Execute the following commands
    cd /usr/local
    mkdir hive
    sudo chown -R hduser:hadoop /usr/local/hive
  • Login as hduser and move the uncompressed hive folder to the above created location. Execute the following commands to do the same. 
    mv hive-0.12.0 /usr/local/hive
  • Update the .bashrc file for hduser, so that certain hive parameters are set, every time the hduser logs in. Edit the .bashrc file and add the entries shown below.
    $ vi .bashrc
    export HIVE_HOME='/usr/local/hive/hive-0.12.0'
    export PATH=$HADOOP_HOME/bin:$HIVE_HOME/bin:PATH
  • Compile the .bashrc file by executing the following command.
    ..bashrc
  • Start Hive by executing the following command.
    hive
  • Create a table in hive called “test”.
    create table test (field1 string, field2 string);
    show tables;
  • View the extended details on the table “test”, by executing the following command.
    describe extended test;
  • Hive is now set up and configured for further use.

No comments:

Post a Comment