Pages

Sunday, November 4, 2012

Hive Installation


Hive Installation

Pre-requistes: Hadoop should have been installed on your system. Also, check if hadoop is in the path and HADOOP_HOME environment variable is set.
Hive requires a metastore for storing metadata information. This installation of hive will use embedded derby database.
Download hive from apache website. I have downloaded hive-0.8.0-bin.tar.gz. 
Explode it /opt folder.
Create tmp folder in hdfs and set permissions (if one does not already exists):
hadoop fs -mkdir  /tmp
hadoop fs -chmod g+w   /tmp
Create a /user/hive/warehouse folder and set permission as follows:
hadoop fs -mkdir /user/hive/warehouse
hadoop fs -chmod g+w /user/hive/warehouse
To start hive, go to /opt/hive-0.8.0-bin/bin directory and run ./hive. This will show a hive prompt.
Here are some simple hive operations to verify if your instance of Hive is working correctly :
create table customer(id INT, name STRING, address STRING);
-> This creates a table by name customer with id, name and address fields.
show tables;
-> This lists all the tables that were created.
alter table customer add columns(zipcode INT);
--> This adds a column zipcode to the customer table.
describe customer;
--> shows details about customer table including fields and their types.

No comments:

Post a Comment