zoukankan      html  css  js  c++  java
  • Hive 3.x 安装

    下载安装包

    Hive安装包传送门

    hive-3.x版本与hadoop的3.x版本相对应。同理,2.x版本与hadoop2.x版本相对应。

    上传到服务器

    解压安装包

    tar -zxvf apache-hive-3.1.2-bin.tar.gz -C /data/soft/
    

    修改配置文件

    # 修改文件夹名称
    mv apache-hive-3.1.2-bin/ hive-3.12
    # 修改hive-env.sh
    cd hive-3.12/conf/
    mv hive-env.sh.template hive-env.sh
    

    在hive-env.sh文件的末尾添加下面三行内容

    export JAVA_HOME=/usr/local/jdk1.8
    export HADOOP_HOME=/data/soft/hadoop-3.2.0
    export HIVE_HOME=/data/soft/hive-3.12
    

    对hive-site.xml进行修改

    <property>
        <name>javax.jdo.option.ConnectionURL</name>
        <value>jdbc:mysql://master:3306/hive?characterEncoding=UTF-8&amp;useSSL=false</value>
    </property>
    <property>
        <name>javax.jdo.option.ConnectionDriverName</name>
        <value>com.mysql.jdbc.Driver</value>
    </property>
    <property>
        <name>javax.jdo.option.ConnectionUserName</name>
        <value>root</value>
    </property>
    <property>
        <name>javax.jdo.option.ConnectionPassword</name>
        <value>Root123456+</value>
    </property>
    <property>
        <name>hive.querylog.location</name>
        <value>/data/hive_repo/querylog</value>
    </property>
    <property>
        <name>hive.exec.local.scratchdir</name>
        <value>/data/hive_repo/scratchdir</value>
    </property>
    <property>
        <name>hive.downloaded.resources.dir</name>
        <value>/data/hive_repo/resources</value>
    </property>
    

    在hadoop中修改core-site.xml配置并同步到集群其他机器

    <property>
            <name>hadoop.proxyuser.root.hosts</name>
            <value>*</value>
        </property>
        <property>
            <name>hadoop.proxyuser.root.groups</name>
            <value>*</value>
        </property> 
    

    将mysql驱动包复制到lib目录下

    [root@bigdata01 ~]# ls
    anaconda-ks.cfg               mysql57-community-release-el7-10.noarch.rpm
    apache-hive-3.1.2-bin.tar.gz  mysql-connector-java-5.1.41.jar
    hello.txt                     store
    [root@bigdata01 ~]# mv ./mysql-connector-java-5.1.41.jar /data/soft/hive-3.12/lib/
    

    修改配置后重启集群

    初始化Hive的Metastore

    cd /data/soft/hive-3.12/bin/
    ./schematool -dbType mysql -initSchema
    

    初始化出现异常

    [root@bigdata01 bin]# ./schematool  -dbType mysql -initSchema
    SLF4J: Class path contains multiple SLF4J bindings.
    SLF4J: Found binding in [jar:file:/data/soft/hive-3.12/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
    SLF4J: Found binding in [jar:file:/data/soft/hadoop-3.2.0/share/hadoop/common/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
    SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
    SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
    Exception in thread "main" java.lang.RuntimeException: com.ctc.wstx.exc.WstxParsingException: Illegal character entity: expansion character (code 0x8
     at [row,col,system-id]: [3215,96,"file:/data/soft/hive-3.12/conf/hive-site.xml"]
            at org.apache.hadoop.conf.Configuration.loadResource(Configuration.java:2981)
            at org.apache.hadoop.conf.Configuration.loadResources(Configuration.java:2930)
            at org.apache.hadoop.conf.Configuration.getProps(Configuration.java:2805)
    

    修改hive-site.xml中的文件 删除3215行内容

    再次初始化报错,提示hive库未创建.MySql中创建hive库后执行,初始化成功。

    Initialization script completed
    Sat Apr 03 19:19:39 CST 2021 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
    schemaTool completed
    

    初始化完成后hive库中会创建相关元数据表信息。

  • 相关阅读:
    vuerouter-2.路由跳转
    vuerouter-1.路由基础
    vuebase-11._跨域处理
    vuebase-10_Axios配置
    vuebase--9._axios post请求
    vuebase--8._axios
    vuebase-7.过滤器
    vuebase-6.自定义指令
    vuebase-5.过渡和动画
    vuebase---4.实例生命周期
  • 原文地址:https://www.cnblogs.com/shine-rainbow/p/hive-3x-an-zhuang.html
Copyright © 2011-2022 走看看