Exp11 1
Exp11 1
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.
2. Install Hadoop: Hive works with Hadoop, so you must have Hadoop installed
and configured. Make sure your Hadoop is set up and running.
1. Download 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
export HIVE_HOME=/opt/hive
export PATH=$HIVE_HOME/bin:$PATH
source ~/.bashrc
5. Configure Hive:
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>
</property>
<property>
<name>hive.metastore.uris</name>
<value>thrift://localhost:9083</value>
</property>
<property>
<name>hive.metastore.warehouse.dir</name>
<value>/user/hive/warehouse</value>
</property>
</configuration>
o Before using Hive, initialize the metastore database. You can do this using
the following command:
o You can start the HiveServer2 to interact with Hive remotely. Run the
following command:
hive
o Once Hive is installed, you can create databases, tables, and run queries
using the Hive command-line interface.