HIVE Installation
Step 1: The JAVA and Hadoop must be preinstalled on your system.
Step 2: For Hive Download Hive from http://apache.petsads.us/hive/hive-0.14.0/.
It gets downloaded in /user/download folder.
Check for the files
If the download is successful you will find the below file by typing ls command.
- $ ls
- apache-hive-0.14.0-bin.tar.gz
Unzip it
- $ tar zxvf apache-hive-0.14.0-bin.tar.gz
Copy File
Copy the file to /usr/local/hive directory with root user
- $ su -
- passwd:
- Copying files to /usr/local/hive directory
- $ mv /user/download/apache-hive-0.14.0-bin /usr/local/hive
Environment for Hive
Add the below line in ./bashrc file
- export HIVE_HOME=/usr/local/hive</br>
- export PATH=$PATH:$HIVE_HOME/bin</br>
- export CLASSPATH=$CLASSPATH:/usr/local/Hadoop/lib/*:.</br>
- export CLASSPATH=$CLASSPATH:/usr/local/hive/lib/*:.</br></br>
Now run the ./bashrc file to reflect those changes.
Configuring Hive
For Configuring Hive hive-env.sh is edited. This file is present in HIVE_HOME/conf.
- $ cd $HIVE_HOME/conf
- $ cp hive-env.sh.template hive-env.sh
Add the below line to hive-env.sh.
- export HADOOP_HOME=/usr/local/hadoop
Step 3:Derby Database
Hive uses external Database server to configure Metastore.
Now Download and install Apache Derby
Follow the steps given below to download and install Apache Derby.
Downloading Apache Derby:
The following command is used to download Apache Derby. It takes some time to download.
- $ cd ~
- $ wget http://archive.apache.org/dist/db/derby/db-derby-10.4.2.0/db-derby-10.4.2.0-bin.tar.gz</br>
Unzip it:
- $tar zxvf db-derby-10.4.2.0-bin.tar.gz
Copy File:
Move file to /usr/local/derby directory
- $mv /user/download/db-derby-10.4.2.0-bin /usr/local/derby</br>
Set up the enironment
Add the below line to ./bashrc file
- export DERBY_HOME=/usr/local/derby
- export PATH=$PATH:$DERBY_HOME/bin
- Apache Hive
- 18
- export CLASSPATH=$CLASSPATH:$DERBY_HOME/lib/derby.jar:$DERBY_HOME/lib/derbytools.jar
To reflect the changes type
Create a directory to store Metastore
Create a directory named data in $DERBY_HOME directory to store Metastore data.
- $ mkdir $DERBY_HOME/data</br>
Step 4:Configuring Metastore of Hive
Edit hive-site.xml and append the following lines between the <configuration> and </configuration> tags:
- <property>
- <name>javax.jdo.option.ConnectionURL</name>
- <value>jdbc:derby://localhost:1527/metastore_db;create=true </value>
- <description>JDBC connect string for a JDBC metastore</description>
- </property>
Create a file named jpox.properties and add the following lines into it:
- javax.jdo.PersistenceManagerFactoryClass =
- org.jpox.PersistenceManagerFactoryImpl
- org.jpox.autoCreateSchema = false
- org.jpox.validateTables = false
- org.jpox.validateColumns = false
- org.jpox.validateConstraints = false
- org.jpox.storeManagerType = rdbms
- org.jpox.autoCreateSchema = true
- org.jpox.autoStartMechanismMode = checked
- org.jpox.transactionIsolation = read_committed
- javax.jdo.option.DetachAllOnCommit = true
- javax.jdo.option.NontransactionalRead = true
- javax.jdo.option.ConnectionDriverName = org.apache.derby.jdbc.ClientDriver
- javax.jdo.option.ConnectionURL = jdbc:derby://hadoop1:1527/metastore_db;create = true
- javax.jdo.option.ConnectionUserName = APP
- javax.jdo.option.ConnectionPassword = mine
Step 5:Verify Hive Installation
Create the /tmp folder and a separate Hive folder in HDFS. Here, we use the /user/hive/warehouse folder. You need to set write permission for these newly created folders as shown below:
Set them in HDFS using the following commands:
- $ $HADOOP_HOME/bin/hadoop fs -mkdir /tmp
- $ $HADOOP_HOME/bin/hadoop fs -mkdir /user/hive/warehouse
- $ $HADOOP_HOME/bin/hadoop fs -chmodg+w /tmp
- $ $HADOOP_HOME/bin/hadoop fs -chmodg+w /user/hive/warehouse
The following commands are used to verify Hive installation:
- $ cd $HIVE_HOME
- $ bin/hive
- hive
Comments
Post a Comment