Monday, January 27, 2014

Apache Hive Installation on Ubuntu

Hive Installation on Ubuntu:
Please follow the below steps to install Apache Hive on Ubuntu:
Step 1:  Download Hive tar.
Command: wget -c http://archive.apache.org/dist/hive/hive-0.9.0/hive-0.9.0-bin.tar.gz
Hive installation on ubuntu - 1
Step 2:  Extract the tar file.
Command: tar -xzvf hive-0.9.0-bin.tar.gz
Hive installation on ubuntu - 2
Step 3: Edit the “.bashrc” file to update the environment variables for user.

  • hadoop fs -mkdir /user/hive/warehouse
  • hadoop fs -mkdir /temp
  • hadoop fs -chmodg+w /user/hive/warehouse
  • hadoop fs -chmodg+w /temp



Command:  sudo gedit .bashrc
Hive installation on ubuntu - 3
Add the following at the end of the file:
export HADOOP_HOME=/home/user/hadoop-1.2.0
export HIVE_HOME=/home/user/hive-0.9.0-bin
export PATH=$PATH:$HIVE_HOME/bin
export PATH=$PATH:$HADOOP_HOME/bin
Hive installation on ubuntu - 4
Step 4:  Create Hive directories within HDFS.
Command:
The directory ‘warehouse’ is the location to store the table or data related to hive.
Hive installation on ubuntu - 5
The temporary directory ‘temp’is the temporary location to store the intermediate result of processing.
Hive installation on ubuntu - 6
Step 5: Set read/write permissions for table.
Command:
In this command we are giving written permission to the group:
Hive installation on ubuntu - 7
Hive installation on ubuntu - 8
Step 6:  Set Hadoop path in Hive config.sh.
Command: sudo gedit hive-config.sh
Hive installation on ubuntu - 9
Hive installation on ubuntu - 10
Step 7: Launch Hive.
Command: hive
Hive installation on ubuntu - 11
Step 8: Create sample tables.
Command:  hive> CREATE TABLE shakespeare (freq INT, word STRING) ROW FORMAT DELIMITED                FIELDS TERMINATED BY ‘\t’ STORED AS TEXTFILE;
 Create sample tables:
Hive installation on ubuntu - 12
Step 9: To exit from Hive:
Command: hive> exit;

1 comment: