Hive部署与安装

8 篇文章 0 订阅
7 篇文章 1 订阅

Hive 安装


更多Hadoop组件配套安装与部署
   Hadoop:https://blog.csdn.net/Gordo_Li/article/details/103309484
   Hbase: https://blog.csdn.net/Gordo_Li/article/details/103199302
   Hive: https://blog.csdn.net/Gordo_Li/article/details/103199319
   Pig: https://blog.csdn.net/Gordo_Li/article/details/103199334
   Sqoop: https://blog.csdn.net/Gordo_Li/article/details/103199352
   Flume: https://blog.csdn.net/Gordo_Li/article/details/103199291
   Zoopkeeper: https://blog.csdn.net/Gordo_Li/article/details/103199364
部分组件软件包:
   soft.gz.tar: https://download.csdn.net/download/Gordo_Li/11993074


  1. 前提安装MySQL

  2. 解压安装包,并移动

    cd /data/soft/
    tar -zxvf apache-hive-2.3.6-bin.tar.gz
    mv apache-hive-2.3.6-bin /data/hive-2.3.6
    
  3. 配置环境变量

    vi /etc/profile
    

    改为:

    export JAVA_HOME=/usr/local/jdk1.8
    export HADOOP_HOME=/data/hadoop-2.7.3
    export HIVE_HOME=/data/hive-2.3.6
    export PATH=$PATH:$JAVA_HOME/bin:$HADOOP_HOME/bin:$HIVE_HOME/bin
    

    使环境生效:

    source /etc/profile
    echo $HIVE_HOME
    
  4. 配置Hive

    cd /data/hive-2.3.6/conf/
    ll
    cp hive-env.sh.template hive-env.sh
    echo $HADOOP_HOME
    vi hive-env.sh
    

    加入HADOOP_HOME变量:

    HADOOP_HOME=/data/hadoop-2.7.3
    

    拷贝hive-site配置文件:

    cp hive-default.xml.template hive-site.xml
    vi hive-site.xml
    
        <property>
            <name>javax.jdo.option.ConnectionURL</name>mysql
            <value>jdbc:mysql://hw1:3306/hive?createDatabaseIfNotExist=true</value>
        </property>
        <property>
            <name>javax.jdo.option.ConnectionDriver</name>mysql驱动程序
            <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>Li19900819@</value>
        </property>
    
    
  5. 拷贝jar包

    可在MySQL官网(http://central.maven.org/maven2/mysql/mysql-connector-java/)找到,下载并解压
    wget http://central.maven.org/maven2/mysql/mysql-connector-java/8.0.18/mysql-connector-java-8.0.18.jar
    一定要和mysql版本匹配

    cd /data/soft
    cp mysql-connector-java-8.0.18.jar /data/hive-2.3.6/lib
    cd /data/hive-2.3.6/lib
    ll mysql-connector-java-5.1.36-bin.jar
    
  6. 进行元数据的初始化
    [如果用root用户,这一步跳过]

    mysql -uroot -p
    use mysql;
    grant all privileges on *.* to 'root'@'%' identified by 'Li19900819@';
    flush privileges;
    
  7. 初始化元数据

    cd /data/hive-2.3.6/bin
    ./schematool -dbType mysql -initSchema
    

    正常输出:

    [root@hw1 lib]# cd /data/hive-2.3.6/bin
    [root@hw1 bin]# ./schematool -dbType mysql -initSchema
    SLF4J: Class path contains multiple SLF4J bindings.
    SLF4J: Found binding in [jar:file:/data/hive-2.3.6/lib/log4j-slf4j-impl-2.6.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
    SLF4J: Found binding in [jar:file:/data/hadoop-2.7.3/share/hadoop/common/lib/slf4j-log4j12-1.7.10.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]
    Metastore connection URL:	 jdbc:mysql://hw1:3306/hive?createDatabaseIfNotExist=true
    Metastore Connection Driver :	 org.apache.derby.jdbc.EmbeddedDriver
    Metastore connection User:	 root
    Starting metastore schema initialization to 2.3.0
    Initialization script hive-schema-2.3.0.mysql.sql
    Initialization script completed
    schemaTool completed
    
  8. 登陆Hive

    hive
    

附录:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?><!--
   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for additional information regarding copyright ownership.
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
--><configuration>
  <!-- WARNING!!! This file is auto generated for documentation purposes ONLY! -->
  <!-- WARNING!!! Any changes you make to this file will be ignored by Hive.   -->
  <!-- WARNING!!! You must make your changes in hive-site.xml instead.         -->
  <!-- Hive Execution Parameters -->
        <property>
            <name>javax.jdo.option.ConnectionURL</name>mysql
            <value>jdbc:mysql://hw1:3306/hive?createDatabaseIfNotExist=true</value>
        </property>
        <property>
            <name>javax.jdo.option.ConnectionDriver</name>mysql驱动程序
            <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>Li19900819@</value>
        </property>
</configuration>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值