Sunday 6 August 2017

Hive_install_Steps

How to install Hive:

Since it gives results in structured format, u need to install any RDMS database, by defualt DERBY

Download the Hive distribution tar from the official site, 
Link : http://www-eu.apache.org/dist/hive/hive-2.1.1/apache-hive-2.1.1-bin.tar.gz


Step 1: Install MYSQL Database,

sudo apt-get install mysql-server


Note:  You will be prompted to set a password for root.

Step 2: Install the MySQL Java Connector

Connecting to MySQL Using the JDBC DriverManager Interface. When you are using JDBC outside of an application server,
the DriverManager class manages the establishment of connections

sudo apt-get install libmysql-java

Step 3: copy mysql java connector jar to lib folder

cp  /usr/share/java/mysql-connector-java-5.1.38.jar /home/hadoop/lib/mysql-connector-java-5.1.38.jar

Step 4:Create the Initial database schema using the hive-schema-0.14.0.mysql.sql file
( or the file corresponding to your installed version of Hive) located in the $HIVE_HOME/scripts/metastore/upgrade/mysql directory

mysql -u root -p
Enter password:

CREATE DATABASE metastore;
USE metastore;

Step 5: Using SOURCE command ==> Executing SQL Statements from a Text File

SOURCE /home/hadoop/apache-hive-1.1.0-bin/scripts/metastore/upgrade/mysql/hive-schema-0.14.0.mysql.sql;

Step 6: Need a MySQL user account for Hive to use to access the metastore

CREATE USER 'hiveuser'@'%' IDENTIFIED BY 'hivepassword';

It is very important to prevent this user account from creating or altering tables in the metastore database schema.

GRANT all on *.* to 'hiveuser'@localhost identified by 'hivepassword';

flush privileges;

Step 7: On hive /conf folder

rename  hive-en.sh.template to hive-env.sh

copy and paste the env


# Set JAVA_HOME
export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-amd64

# Set HADOOP_HOME to point to a specific hadoop install directory
export HADOOP_HOME=/home/mano/Hadoop_setup/hadoop-2.7.3

# Hive Configuration Directory can be controlled by:
export HIVE_CONF_DIR=/home/mano/Hadoop_setup/apache-hive-2.1.1-bin/conf
Note : –  hiveuser is the ConnectionUserName in hive-site.xml ( As explained next)

Step 8: Create hive-site.xml ( If not already present) in $HIVE_HOME/conf folder with the configuration below –

<configuration>
 <property>
 <name>javax.jdo.option.ConnectionURL</name>
  <value>jdbc:mysql://localhost/metastore?createDatabaseIfNotExist=true</value>
 <description>metadata is stored in a MySQL server</description>
 </property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
 <value>com.mysql.jdbc.Driver</value>
<description>MySQL JDBC driver class</description>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>hiveuser</value>
<description>user name for connecting to mysql server</description>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>hivepassword</value>
<description>password for connecting to mysql server</description>
</property>
</configuration>

Step 9:We are all set now. Start the hive console. by type Hive 

No comments:

Post a Comment

Fundamentals of Python programming

Fundamentals of Python programming: Following below are the fundamental constructs of Python programming: Python Data types Python...