Hive stand-alone installation

1. Environmental preparation

  1. Centos7
  2. Hadoop
  3. Java
  4. MySQL

Version description of the tools used:

 centos版本:CentOS-7.4-x86_64-DVD-1708.iso
 JDK版本:jdk-8u231-linux-x64.tar.gz
 Hadoop版本:hadoop-2.7.3.tar.gz
 Hive:apache-hive-2.3.7-bin.tar.gz
 MySQL:5.7

The installation of centos7, jdk, and hadoop will not be discussed here. If you are not sure, you can check my previous blogs.
Install jdk Hadoop2.7.3 on Centos server and
install and deploy stand-alone version on centos7

2. Before installing hive, jdk, hadoop, mysql have been installed, and start hdfs, yarn at the same time

My mysql is not installed on centos7. My mysql is connected to my machine.
The ip of my machine is 172.20.10.3, and the ip of centos7 is 172.20.10.4.

# 启动hdfs 
./sbin/start-dfs.sh

# 启动yarn
./sbin/start-yarn.sh

3. Install Hive

3.1 Create a new hive directory under the /usr/ directory, upload the hive installation package apache-hive-2.3.7-bin.tar.gz to the hive directory, and decompress it

Insert picture description here

3.2 In the /usr/hive/apache-hive-2.3.7-bin/conf directory, add the configuration file hive-site.xml

vi hive-site.xml

Its contents are as follows:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
 <property>
    <name>javax.jdo.option.ConnectionURL</name>
    <value>jdbc:mysql://172.20.10.3:3306/hive_metadata?&amp;createDatabaseIfNotExist=true&amp;characterEncoding=UTF-8&amp;useSSL=false</value>
 </property>
<property>
    <name>javax.jdo.option.ConnectionUserName</name>
    <value>root</value>
</property>
<property>
    <name>javax.jdo.option.ConnectionPassword</name>
    <value>root</value>
</property>
<property>
    <name>javax.jdo.option.ConnectionDriverName</name>
    <value>com.mysql.jdbc.Driver</value>
</property>
<property>
    <name>datanucleus.schema.autoCreateAll</name>
    <value>true</value> </property>
<property>
    <name>hive.metastore.schema.verification</name>
    <value>false</value>
 </property>
</configuration>

3.3 In the /usr/hive/apache-hive-2.3.7-bin/conf directory, copy hive-env.sh.template and rename it as hive-env.sh

cp hive-env.sh.template hive-env.sh

Its contents are as follows:

HADOOP_HOME=/usr/hadoop/hadoop-2.7.3
export HIVE_CONF_DIR=/usr/hive/apache-hive-2.3.7-bin/conf

3.4 Add hive environment variables

vi /etc/profile

Add the following content:

export HIVE_HOME=/usr/hive/apache-hive-2.3.7-bin
export PATH=$PATH:$HIVE_HOME/bin 
source /etc/profile

3.5 Add the mysql driver jar package: mysql-connector-java-5.1.44.jar to the directory /usr/hive/apache-hive-2.3.7-bin/lib/,

Insert picture description here

3.6 Initialize the database

schematool -initSchema -dbType mysql

Insert picture description here

3.7 Start hive and test

Insert picture description here

Guess you like

Origin blog.csdn.net/ytangdigl/article/details/109246351