This document provides instructions for installing and configuring Hive to work with a Hadoop environment. It explains that Hive needs to be installed on the same server as the Hadoop client. It then details how to download Hive, install MySQL for the Hive metastore, configure Hive to connect to MySQL by modifying configuration files, and concludes that Hive is now installed and ready for use.
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Â
R hive tutorial supplement 2 - Installing Hive
1. RHive tutorial â Installing Hive
As an add-on to Hadoop, Hive cannot run independent of Hadoop.
This tutorial explains how additionally configure Hive to the Hadoop
environment made in the Hadoop setup tutorial.
Hive does not need to be installed for all servers where Hadoop is installed.
It is just needed for the server where Hadoop client will run.
Here, Hive will be installed in Hadoop namenode for convenience in setup.
Downloading Hive
Because Hive is written in Java just like Hadoop is, downloading the file and
decompressing it alone constitutes the entire setup procedure.
A stable version of Hive can be found in the URL below.
http://www.apache.org/dist//hive/hive-0.7.1/hive-0.7.1-bin.tar.gz
The latest stable version at the point of this tutorialâs creation is 0.7.1; it is
alright to build a separate snapshot version and use that instead.
If version 0.8x is released, itâs okay to use that.
Like the following, connect to the target server for Hive installation and
download the final version of Hive.
ssh
 root@10.1.1.1
Â
mkdir
 hive_stable
Â
cd
 hive_stable
Â
wget
 http://www.apache.org/dist//hive/hive-Ââ0.7.1/hive-Ââ0.7.1-Ââ
bin.tar.gz
Â
tar
 xvfz
 ./hive-Ââ0.7.1-Ââbin.tar.gz
Â
mkdir
 /service
Â
mv
 ./hive-Ââ0.7.1-Ââbin
 /service
Â
Configuring MySQL
We will be choosing and using MySQL for Hiveâs repository.
Hive uses SQLite by default, but if you want to enable multiple users to use
Hive simultaneously, you need to be able to use MySQL or other DBs as
repositories.
Hence this tutorial will be using MySQL.
2. MySQL can be installed in a server apart from the one where Hive will be
installed, but this tutorial will install MySQL along where, Hadoop namenode is
installed (that is, where Hive is installed).
Use yum like the following to install mysql client and server
yum
 install
 mysql
 mysql-Ââserver
Â
After installation, start mysql server.
/etc/init.d/mysqld
 start
Â
Now create a database in MySQL for Hive to use.
This tutorial will use the name âmetastoreâ for that database.
Go into mysql and create a database like shown.
mysql>
 CREATE
 DATABASE
 metastore;
Â
mysql>
 USE
 metastore;
Â
mysql>
 SOURCE
 /service/hive-Ââ
0.7.1/scripts/metastore/upgrade/mysql/hive-Ââschema-Ââ
0.7.0.mysql.sql;
Â
Here, â/service/hive-0.7.1" is Hiveâs HOME directory, and
"$HIVE_HOME/scripts/metastore/upgrade/mysql" contains SQL files that can
set MySQL up for Hive or upgrade Hive database (which exists in MySQL
database). Select and run the ones suited to your version and complete setup.
Now create a MySQL user which Hive will use, and grant it the privilege to
access the database, âmetastoreâ.
mysql>
 CREATE
 USER
 'hiveuser'@'%'
 IDENTIFIED
 BY
 'password';
Â
mysql>
 GRANT
 SELECT,INSERT,UPDATE,DELETE
 ON
 metastore.*
 TO
Â
'hiveuser'@'%';
Â
mysql>
 REVOKE
 ALTER,CREATE
 ON
 metastore.*
 FROM
 'hiveuser'@'%';
Â
Configuring MySQL for Hive use is complete.
Now you need to configure Hive to enable it to connect to MySQL.
JDBC is required for allowing connecting to MySQL from Hive but JDBC is not
included in MySQL.
3. You must manually download it from the MySQL site and copy it into the
installed Hive.
JDBC is available for download from here:
http://dev.mysql.com/downloads/
As shown below, download and decompress it, then copy the jar file to
Hadoopâs lib directory.
$
 curl
 http://dev.mysql.com/get/Downloads/Connector-ÂâJ/mysql-Ââ
connector-Ââjava-Ââ
5.1.18.tar.gz/from/http://mirror.services.wisc.edu/mysql/
Â
$
 tar
 xvfz
 mysql-Ââconnector-Ââjava-Ââ5.1.18.tar.gz
Â
$
 cp
 ./mysql-Ââconnector-Ââjava-Ââ5.1.18/mysql-Ââconnector-Ââjava-Ââ5.1.18-Ââ
bin.jar
 /service/hive-Ââ0.7.1/lib/
Â
Now for modifying Hiveâs configuration.
You need to open $HIVE_HOME/conf/hive-site.xml with a text editor and
appropriately adjust the items pertaining to MySQL.
If you have installed Hive for the first time, then the $HIVE_HOME/conf/hive-
site.xml file probably doesnât exist in the directory.
Copy the hive-default.xml.template file in the same directory and edit it like the
following:
cd
 /service/hive-Ââ0.7.1/conf/hive-Ââsite.xml
Â
cp
 ./hive-Ââdefault.xml.template
 ./hive-Ââsite.xml
Â
Now look for the contents below in ./hive-site.xml and make suitable
adjustments for the MySQL accounts which will be used to connect to the
MySQL server.
<property>
Â
Â
 <name>javax.jdo.option.ConnectionURL</name>
Â
Â
 <value>jdbc:mysql://MYSQL_HOSTNAME/metastore</value>
Â
</property>
Â
Â
Â
<property>
Â
Â
 <name>javax.jdo.option.ConnectionDriverName</name>
Â
Â
 <value>com.mysql.jdbc.Driver</value>
Â
4. </property>
Â
Â
Â
<property>
Â
Â
 <name>javax.jdo.option.ConnectionUserName</name>
Â
Â
 <value>hiveuser</value>
Â
</property>
Â
Â
Â
<property>
Â
Â
 <name>javax.jdo.option.ConnectionPassword</name>
Â
Â
 <value>password</value>
Â
</property>
Â
Â
Â
<property>
Â
Â
 <name>datanucleus.autoCreateSchema</name>
Â
Â
 <value>false</value>
Â
</property>
Â
Â
Â
<property>
Â
Â
 <name>datanucleus.fixedDatastore</name>
Â
Â
 <value>true</value>
Â
</property>
Â
From above, you should replace the âMYSQL_HOSTNAMEâ string to be the
hostname or the IP address of the server where MySQL is installed to. But this
tutorial installed MySQL in the very server where Hive was installed so it is
127.0.0.1.
If, for purposes of safer management or some other reason, you installed
MySQL to some other server then just replace âMYSQL_HOSTNAMEâ string
with its IP address.
Thus concludes the installation and configuration of Hive.
Consult Hiveâs official site documents for a detailed usage guide for Hive.