Hive3 detailed tutorial (I) hive3 + Hadoop 3 environment installation

Miss Zhu 2022-02-13 08:38:57 阅读数:967

hive3 hive detailed tutorial hive3

This time Hive Use Hive3.1.2.
Three virtual machine nodes are planned this time , Among them in hp301 Installation on mysql and hive.

Host name IP Address
hp301 192.168.150.31 mysql/hive
hp302 192.168.150.32
hp303 192.168.150.33

Use Hive The environment that needs to be used is Hadoop, This use is Hadoop3.3.1, Its installation 、 See this blog for details Hadoop3 series :Hadoop3 Detailed tutorial
Use Hive Need to be in Linux Install on virtual machine Mysql, See... For the installation process , This blog is about Linux Install and uninstall on MySQL The connection of :Linux Next MySQL Install and uninstall

After finishing the above operation , We can do it Hive Installation .
The following are the detailed installation steps :
1. download apache-hive-3.1.2-bin.tar.gz Upload to hp301 /apps Next .
2. Unzip to /usr/local Next

tar -zxvf /apps/apache-hive-3.1.2-bin.tar.gz -C /usr/local

3. For the convenience of subsequent use , Create a soft connection to it :

ln -s /usr/local/apache-hive-3.1.2-bin/ /usr/local/hive3

4. To configure Hive Environment variables of :
stay /etc/profile.d So let's make a new one hive.sh

vi/etc/profile.d/hive.sh

Write the following code in it :

export HIVE_HOME=/usr/local/hive3
export PATH=$PATH:$HIVE_HOME/bin

Use source command , Enable environment variables :

source /etc/profile.d/hive.sh

6. Modify the configuration file
take /usr/local/hive3/conf/hive-env.sh.template Renamed as hive-env.sh
And add it later :

export JAVA_HOME=$JAVA_HOME
export HADOOP_HOME=$HADOOP_HOME
export HIVE_HOME=$HIVE_HOME

Create a new one hive-site.xml, Fill in :

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<!-- jdbc URL -->
<property>
<name>javax.jdo.option.ConnectionURL</name>
<!-- planning mysql The database in which metadata is stored is named metastore, Automatically created when initialization data does not exist -->
<value>jdbc:mysql://hp301:3306/metastore?createDatabaseIfNotExist=true&amp;useSSL=false</value>
</property>
<!-- jdbc Driver-->
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
</property>
<!-- Database user name -->
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>root</value>
</property>
<!-- Database password -->
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>Hive123+</value>
</property>
<!-- Hive Verification of metadata storage version -->
<property>
<name>hive.metastore.schema.verification</name>
<value>false</value>
</property>
<!-- Metadata storage Authorization -->
<property>
<name>hive.metastore.event.db.notification.api.auth</name>
<value>false</value>
</property>
<!-- Hive Default in HDFS Working directory of -->
<property>
<name>hive.metastore.warehouse.dir</name>
<value>/user/hive/warehouse</value>
</property>
</configuration>

7. add to Java visit MySQL Of jar package
download mysql-connector-java-5.1.47-bin.jar And upload them to linux The server , Then copy it to /usr/local/hive3/lib Next

8. initialization Hive database , Carry out orders :

schematool -initSchema -dbType mysql

At this time to use navicat see hp301 The database of , You'll find one more metastrore The database of , All tables in the library even if Hive Table structure for storing metadata :
 Insert picture description here
9. Use Hive
start-up hadoop

 start-all.sh

hadoop After a successful launch , You can start hive client :

hive

The command line effect shown in the figure :
 Insert picture description here
You can view the process through another connection ,Hive It's actually a RunJar process :
 Insert picture description here

copyright:author[Miss Zhu],Please bring the original link to reprint, thank you. https://en.javamana.com/2022/02/202202130838546374.html