Hive安装详细步骤

Hive安装详细步骤

Hive安装前,首先以安装完成Hadoop,且本文中使用MySQL作为Hive的元数据存储库,MySQL数据库也要提前准备好,关于Hadoop和MySQL的安装可参考另外两篇文章:

本文中安装的版本为: apache-hive-2.3.9

本示例中Hive安装在 /app目录下,解压后重命名为hive

cd /app
tar -zxvf apache-hive-2.3.9-bin.tar.gz
mv apache-hive-2.3.9-bin hive
vim ~/.bashrc

export HIVE_HOME=/app/hive
export PATH=$PATH:$HIVE_HOME/bin
export HADOOP_HOME=/app/hadoop-2.10.1

source ~/.bashrc

查看Hive版本,正常输出无问题即可,如下:


hive --version

Hive 2.3.9
Git git://chaos-mbp.lan/Users/chao/git/hive -r 92dd0159f440ca7863be3232f3a683a510a62b9d
Compiled by chao on Tue Jun 1 14:02:14 PDT 2021
From source with checksum 6715a3ba850b746eefbb0ec20d5a0187

<configuration>

    <property>
        <name>javax.jdo.option.ConnectionURLname>
        <value>jdbc:mysql://199.188.166.113:3306/hive?createDatabaseIfNotExist=true&useSSL=falsevalue>
        <description>JDBC connect string for a JDBC metastoredescription>
    property>

    <property>
        <name>javax.jdo.option.ConnectionDriverNamename>
        <value>com.mysql.jdbc.Drivervalue>
        <description>Driver class name for a JDBC metastoredescription>
    property>

    <property>
        <name>javax.jdo.option.ConnectionUserNamename>
        <value>hivevalue>
        <description>username to use against metastore databasedescription>
    property>

    <property>
        <name>javax.jdo.option.ConnectionPasswordname>
        <value>zhaotyvalue>
        <description>password to use against metastore databasedescription>
    property>

    <property>
        <name>hive.metastore.warehouse.dirname>
        <value>/user/hive/warehousevalue>
        <description>location of default database for the warehousedescription>
    property>

    <property>
        <name>hive.cli.print.current.dbname>
        <value>truevalue>
        <description>Whether to include the current database in the Hive prompt.description>
    property>

    <property>
        <name>hive.cli.print.current.dbname>
        <value>truevalue>
        <description>Whether to include the current database in the Hive prompt.description>
    property>

    <property>
        <name>hive.cli.print.headername>
        <value>truevalue>
    property>

    <property>
        <name>hive.exec.mode.local.autoname>
        <value>truevalue>
        <description>Let Hive determine whether to run in local mode automaticallydescription>
    property>
configuration>
[hadoop@node3 bin]$ schematool -dbType mysql -initSchema

SLF4J: Class path contains multiple SLF4J bindings.

SLF4J: Found binding in [jar:file:/app/hive/lib/log4j-slf4j-impl-2.6.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/app/hadoop-2.10.1/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Metastore connection URL:        jdbc:mysql://199.188.166.113:3306/hive?allowPublicKeyRetrieval=true&createDatabaseIfNotExist=true&useSSL=false
Metastore Connection Driver :    com.mysql.cj.jdbc.Driver
Metastore connection User:       hive
Starting metastore schema initialization to 2.3.0
Initialization script hive-schema-2.3.0.mysql.sql
Initialization script completed
schemaTool completed

[hadoop@node3 ~]$ hive

which: no hbase in (/home/hadoop/.local/bin:/home/hadoop/bin:/app/java/jdk1.8.0_181/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/app/mysql8/bin:/app/hadoop-2.10.1/bin:/app/hive/bin)
SLF4J: Class path contains multiple SLF4J bindings.

SLF4J: Found binding in [jar:file:/app/hive/lib/log4j-slf4j-impl-2.6.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/app/hadoop-2.10.1/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]

Logging initialized using configuration in jar:file:/app/hive/lib/hive-common-2.3.9.jar!/hive-log4j2.properties Async: true
Hive-on-MR is deprecated in Hive 2 and may not be available in the future versions. Consider using a different execution engine (i.e. spark, tez) or using Hive 1.X releases.

hive (default)>

Hive的日志默认存放在 /tmp/hadoop目录下( hadoop为当前用户名),这个位置可以修改,也可以不改,但是要知道位置。

Original: https://blog.csdn.net/weixin_49192027/article/details/124762065
Author: 黑伴白
Title: Hive安装详细步骤

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/818459/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球