You can have running instance of Hive on your local box by following 3 steps.
A)- Install Java :
B)- Hadoop Installation :
C)- Hive Installation :
A : For Java Installation you can refer below link.
http://pathakamit783.blogspot.in/2015/10/oracle-java-installation-on-ubuntu.html
B)- Hadoop Installation :
for hadoop installation you can refer below link, you just need to follow each and every step as mention in link.
you can skip user creation part(creation of hduser) and also you can add data of ~/.bashrc in /etc/profile.
http://www.bogotobogo.com/Hadoop/BigData_hadoop_Install_on_ubuntu_single_node_cluster.php
C)- Hive Installation :
So now we are on the topic , hive installation is so easy ,you just need follow below simple steps (I will also show how you how to use mysql for metastore).
1)- Download Apache hive from Apache site.
http://www.us.apache.org/dist/hive/hive-1.2.1/
2)- move it from download directory to standard location, I have created hive folder under /usr/local
a)- cd /usr/local
b)- sudo mkdir hive
c)- sudo cp /media/amit.pathak/download/apache-hive-1.2.1-bin.tar.gz /usr/local/hive
3)- Extract same using below command.
a)- cd /usr/local/hive
b)- sudo tar xvzf apache-hive-1.2.1-bin.tar.gz
4)- Change owner ship
a)- cd /usr/local/
b)- sudo chown amit.pathak:amit.pathak -R hive
5)- Setting Environment Path
a)- Open /etc/profile and paste below lines
HIVE_HOME=/usr/local/hive/apache-hive-1.2.1-bin
PATH=$PATH:$HIVE_HOME/bin
export HIVE_HOME
export PATH
6)- Configure Hive
a)- cd /usr/local/hive/apache-hive-1.2.1-bin/conf
b)- cp hive-env.sh.template hive-env.sh
c)- sudo nano hive-env.sh
d)- add or update below line and save your file
export HADOOP_HOME=/usr/local/hadoop
7)- Before changing Default metastore derby of Hive to MySQL, Need to verify is hive shell working fine or not.
a)- First of all start your hadoop instance(It is a compulsory step)
b)- type hive --> hit Enter button
initially you will see one error on console stating that
java.lang.IncompatibleClassChangeError: Found class jline.Terminal, but interface was expected
to fix this issue
a)- Open profile file -> sudo nano /etc/profile
b)- add line at bottom of file -> export HADOOP_USER_CLASSPATH_FIRST=true
c)- execute command -> source /etc/profile
d)- type hive and hit Enter.
Now it should working fine and you able to see hive pointer. like
hive>
you can enjoy your Hive installation but if you want to switch to mysql from derby , please follow below steps.
Changing Default metastore derby of Hive to MySQL
1)- Update configuration file, as initially you don't have any hive-site.xml in your conf folder
a)- execute command -> cd /usr/local/hive/apache-hive-1.2.1-bin/conf
b)- execute command -> cp hive-default.xml.template hive-site.xml
c)- create directory to save hive data
1)- execute command -> cd /usr/local
2)- execute command -> sudo mkdir hive_data
3)- execute command -> sudo chown amit.pathak:amit.pathak -R hive_data/
d)- Now next step to update hive-site.xml to save your self from below error
Exception in thread "main" java.lang.RuntimeException: java.lang.IllegalArgumentException: java.net.URISyntaxException: Relative path in absolute URI: ${system:java.io.tmpdir%7D/$%7Bsystem:user.name%7D
1)- execute command -> sudo nano hive-site.xml
2)- update below highlighted 3 property value with your created directory
<property>
<name>hive.exec.scratchdir</name>
<value>/usr/local/hive_data</value>
<description>HDFS root scratch dir for Hive jobs which gets created with write all (733) permission. For each connecting user, an HDFS scratch dir: ${hive.exec.scratchdir}/<username> is created,$
</property>
<property>
<name>hive.exec.local.scratchdir</name>
<value>/usr/local/hive_data</value>
<description>Local scratch space for Hive jobs</description>
</property>
<property>
<name>hive.downloaded.resources.dir</name>
<value>/usr/local/hive_data/${hive.session.id}_resources</value>
<description>Temporary local directory for added resources in the remote file system.</description>
</property>
this will solve your above exception,
Don't close the console we will update connection config in line, Search for below 4 properties and update value from below.
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://localhost/metastore_db?
createDatabaseIfNotExist=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>hiveAdmin</value>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>hiveAdminPassword</value>
</property>
Remember above username and password as we will use same below to configure mysql.
2)- MySql Configuration
Open your mysql command propmt
a)- Execute below commands one by one.
mysql -u root
Enter password:
mysql> CREATE DATABASE metastore_db;
mysql> CREATE USER 'hiveAdmin'@'%' IDENTIFIED BY 'hiveAdminPassword';
mysql> GRANT all on *.* to 'hiveAdmin'@localhost identified by 'hiveAdminPassword';
mysql> flush privileges;
3)- Download mysql-connector-java-5.0.5.jar file and copy it to $HIVE_HOME/lib directory.
So now you are done with mysql configuration with Hive.
just start your hive shell and enjoy :)
PrimeFaces vs RichFaces vs IceFaces in JSF
ReplyDeleteMultiple File Upload Using Struts 2
Best 20 Features of Andriod Marshmallow
Common 10 Mistakes by Android Developer
Amazon Appstore Features for Android Developers
Android Paypal Gateway Example
Frankly say you just explain every step so well. I didn't find any issue while hive installation.
ReplyDeletethanks for such a nice post.
thanks for this motivational words
DeleteGreat.. !! Simple & straightforward way for Hive Installation.. Good Job.. :)
ReplyDeletethanks for such motivational words.
Delete