google-site-verification: googleb67531d106507af5.html Hive Install Guide
7330907991 Online | 7330907992 Classroom info@rcptec.com
HIVE Configuration:--
******************

1. Download "hive-0.11.0.tar.gz"
2. Extract gz file
	$ sudo tar -xvf hive-0.11.0.tar.gz
3. sudo mv hive-0.11 /usr/local/hive
4. sudo chmod 750 /usr/local/hive
5. sudo chown -R <user>:<user> /usr/local/hive
6. cd /usr/local/hive/conf
	$ copy hive-default.xml.template and paste, rename to hive-site.xml
7. create one folder name myMetaStore under /usr/local/hive/
8. $ gksudo gedit /usr/local/hive/conf/hive-site.xml
	i. chnaged the property value of "javax.jdo.option.ConnectionURL"
		OLD Value: jdbc:derby:;databaseName=metastore_db;create=true 
				to 
		NEW Value: jdbc:derby:;databaseName=/usr/local/hive/myMetaStore/metastore_db;create=true
9. Rename hive-env.sh.templete to hive-env.sh and set the HADOOP_HOME & PATH
    $ gksudo gedit /usr/local/hive/conf/hive-env.sh
	export HADOOP_HOME=/usr/local/hadoop
	export PATH=$PATH:$HADOOP_HOME/bin

10. $ hadoop fs -mkdir /user/hive/warehouse
11. $ hadoop fs -chmod 750 /user/hive/warehouse
12. $ hadoop fs -mkdir /tmp
13. $ hadoop fs -chmod 750 /tmp
14. Alt+F2 --> gksudo gedit .bashrc
	export HIVE_HOME=/usr/local/hive
	export PATH=$PATH:$HIVE_HOME/bin

$ hive
Creating Managed Table:--
**********************
Synx:--
hive> create table <tableName> <schema>
    > row format delimited
    > fileds terminated by '<del>'
    > stored as textfile;
Example:--

hive> create table emp (eid int, ename string, esal int)
    > row format delimited
    > fields terminated by '|'
    > stored as textfile;

Creating External Table:--
***********************

hive> create external table <tableName> <schema>
    > row format delimited
    > fileds terminated by '<del>'
    > stored as textfile
    > location '<hdfsPath>';
Example:--

hive> create external table emp (eid int, ename string, esal int)
    > row format delimited
    > fields terminated by '|'
    > stored as textfile
    > location '/Praveen/HIVE/extTable';


Insert data into hive tables (managed and external):--
*****************************************************

We can insert data in two way into hive tables
	1. from Local
	2. from HDFS
1. Loading data from Local path
Synx:--
hive> load data local inpath '<localFilePath>' into table <tableName>;
Ex:--
hive> load data local inpath 'empDetails.txt' into table emp;

2. Loading data from HDFS path

Synx:--
hive> load data inpath '<hdfsFilePath>' into table <tableName>;
Ex:--
hive> load data inpath 'empDetails.txt' into table emp;