0% found this document useful (0 votes)
3 views3 pages

Exp11 1

To install Apache Hive, ensure that Java and Hadoop are already installed on your system. Download the latest version of Hive, extract it, set environment variables, configure Hive settings, and initialize the metastore database. Finally, start Hive and test the installation to begin using it for database and query management.

Uploaded by

Sai Tejaswini
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views3 pages

Exp11 1

To install Apache Hive, ensure that Java and Hadoop are already installed on your system. Download the latest version of Hive, extract it, set environment variables, configure Hive settings, and initialize the metastore database. Finally, start Hive and test the installation to begin using it for database and query management.

Uploaded by

Sai Tejaswini
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

HIVE Installation

To install Apache Hive, you need to have Hadoop already installed because Hive runs on
top of Hadoop. Below are the steps to install Apache Hive:

Prerequisites

1. Install Java: Apache Hive requires Java, so you need to have it installed on your
system.

o To check if Java is installed, run:

o If it's not installed, you can install it:

sudo apt update

sudo apt install openjdk-8-jdk

2. Install Hadoop: Hive works with Hadoop, so you must have Hadoop installed
and configured. Make sure your Hadoop is set up and running.

Step-by-Step Installation of Apache Hive

1. Download Hive:

o Go to the official Apache Hive website (https://hive.apache.org/) and


download the latest stable version of Apache Hive.

o Alternatively, you can use the following command to download the latest
version (for example, Hive 3.1.2):

wget https://downloads.apache.org/hive/hive-3.1.2/apache-hive-3.1.2-bin.tar.gz

2. Extract the Hive Tarball:

o Extract the downloaded tarball:

tar -xvzf apache-hive-3.1.2-bin.tar.gz

3. Move Hive to a Directory:

o Move the extracted files to a directory of your choice (for example


/opt/hive):

sudo mv apache-hive-3.1.2-bin /opt/hive

4. Set Environment Variables:

o Set the HIVE_HOME environment variable to point to the Hive installation


directory.
o Add Hive to the PATH so that you can run Hive commands from anywhere.

Add the following lines to your ~/.bashrc (or ~/.bash_profile on macOS):

export HIVE_HOME=/opt/hive

export PATH=$HIVE_HOME/bin:$PATH

export HADOOP_HOME=/opt/hadoop # Adjust the path to your Hadoop installation

export CLASSPATH=$($HADOOP_HOME/bin/hadoop classpath)

After editing ~/.bashrc, run the following to apply the changes:

source ~/.bashrc

5. Configure Hive:

o In the $HIVE_HOME/conf directory, there are several configuration files.


You need to set up a few key configuration files:

o hive-site.xml: This is the main configuration file for Hive. Copy the
template file and modify it.

cp $HIVE_HOME/conf/hive-default.xml.template $HIVE_HOME/conf/hive-site.xml

o Modify hive-site.xml for your setup (e.g., setting the Metastore URI, HDFS
locations, etc.). Below is an example of the configurations you might need
to change:

<configuration>

<property>

<name>javax.jdo.option.ConnectionURL</name>

<value>jdbc:derby:;databaseName=/tmp/metastore_db;create=true</value>

<description>JDBC connect string for a JDO database</description>

</property>

<property>

<name>hive.metastore.uris</name>

<value>thrift://localhost:9083</value>

<description>URI for the remote metastore server</description>

</property>

<property>
<name>hive.metastore.warehouse.dir</name>

<value>/user/hive/warehouse</value>

<description>Directory for storing tables and partitions</description>

</property>

</configuration>

6. Initialize the Metastore Database:

o Before using Hive, initialize the metastore database. You can do this using
the following command:

schematool -initSchema -dbType derby

7. Start the HiveServer2 (optional, if using Hive in server mode):

o You can start the HiveServer2 to interact with Hive remotely. Run the
following command:

hive --service hiveserver2 &

8. Test Hive Installation:

o Start Hive by running the following:

hive

o If Hive starts successfully, you should be presented with the Hive


command line interface.

9. Start Using Hive:

o Once Hive is installed, you can create databases, tables, and run queries
using the Hive command-line interface.

You might also like