Hive embedded mode installation (based on Hadoop)

Download and extract to the specified directory

(1) Configure environment variable / etc/profile

export HIVE_HOME=/usr/local/hive/

export PATH=$PATH:$HIVE_HOME/bin

(2) Modify hive configuration file hive-env.sh

Add hadoop path, hive path, lib path of hive

#HADOOP_HOME=${bin}/../../hadoop

HADOOP_HOME=/usr/local/hadoop


# HiveConfiguration Directory can be controlled by:
 export HIVE_CONF_DIR=/usr/local/hive/conf


# Foldercontaining extra ibraries required for hive compilation/execution can becontrolled by:
exportHIVE_AUX_JARS_PATH=/usr/local/hive/lib

(3) Modify Hive configuration file hive-site.xml

<property>
   <name>hive.exec.local.scratchdir</name>
   <value>/usr/local/hive/iotmp</value>
    <description>Local scratch space forHive jobs</description>
</property>

<property>
   <name>hive.downloaded.resources.dir</name>
   <value>/usr/local/hive/iotmp/${hive.session.id}_resources</value>
   <description>Temporary localdirectory for added resources in the remote file system.</description>
</property>

<property>
   <name>hive.querylog.location</name>
   <value>/usr/local/hive/iotmp</value>
   <description>Location of Hive runtime structured log file</description>

</property>


<property>
    <name>hive.server2.logging.operation.log.location</name>
    <value>/usr/local/hive/iotmp/operation_logs</value>
    <description>Top level directorywhere operation logs are stored if logging functionality isenabled</description>
</property>

<property>
  <name>javax.jdo.option.ConnectionURL</name>
  <value>jdbc:derby:;databaseName=metastore_db;create=true</value>
  <description>JDBC connect string for aJDBC metastore</description>
</property>



<property>
 <name>javax.jdo.option.ConnectionDriverName</name>
 <value>org.apache.derby.jdbc.EmbeddedDriver</value>
 <description>Driver class name for aJDBC metastore</description>
</property>

(4) Modify the hive configuration file in the directory hive-config.sh bin

export JAVA_HOME=

export HADOOP_HOME=

export HIVE_HOME=

(5) Look at the hive-site.xml search keyword HDFS to see which directories need to be created on HDFS and create them

(6) Initialize hive (start hadoop first)

schematool -dbType derby -initSchema

The possible pit here

The reason is that there is already a Metastore dB in the root directory. Delete the folder and execute the initialization command again

If Metastore? DB is also available in the conf directory, delete it

(7) Enter hive in the terminal to run the command line of hive

Judge whether the installation is successful by running the create table and insert statement in mysql

create table student(varchar(10));
insert into student values(1);

Tags: hive Hadoop JDBC xml

Posted on Thu, 09 Jan 2020 12:33:59 -0500 by ksimpkins