1. 前置条件: 已经安装好了带有HDFS, MapReduce, Yarn 功能的 Hadoop集群

    链接: ubuntu18.04.2 hadoop3.1.2+zookeeper3.5.5高可用完全分布式集群搭建

  2. 上传tar包并解压到指定目录:

    tar -zxvf apache-hive-3.1.2-bin.tar.gz -C /opt/ronnie
  3. 修改hive配置文件:

    • 新建文件夹

      mkdir /opt/ronnie/hive-3.1.2/warehouse
      hadoop fs -mkdir -p /opt/ronnie/hive-3.1.2/warehouse
      hadoop fs -chmod 777 /opt/ronnie/hive-3.1.2/warehouse
      hadoop fs -ls /opt/ronnie/hive-3.1.2/
    • 复制配置文件

      cd /opt/ronnie/hive-3.1.2/conf
      cp hive-exec-log4j2.properties.template hive-exec-log4j2.properties
      cp hive-log4j2.properties.template hive-log4j2.properties
      cp hive-default.xml.template hive-default.xml
      cp hive-default.xml.template hive-site.xml
      cp hive-env.sh.template hive-env.sh
  • 修改环境配置文件

    vim hive-env.sh
    
    HADOOP_HOME=/opt/ronnie/hadoop-3.1.2
    export HIVE_CONF_DIR=/opt/ronnie/hive-3.1.2/conf
    export HIVE_AUX_JARS_PATH=/opt/ronnie/hive-3.1.2/lib
    • vim hive-site.xml修改配置文件

      • 这时候先回顾一下vim操作(由于这个文件页数比较多...):

        • gg: 到页首

        • G: 到页末

        • 22, 6918 d(在此执行的删行操作)
        • 修改配置文件参数:

          <configuration>
          <property>
          <name>javax.jdo.option.ConnectionUserName</name>
          <value>root</value>
          </property>
          <property>
          <name>javax.jdo.option.ConnectionPassword</name>
          <!--你的Mysql数据库密码-->
          <value>xxxxxxx</value>
          </property>
          <property>
          <name>javax.jdo.option.ConnectionURL</name>
          <value>jdbc:mysql://192.168.180.130:3306/hive?allowMultiQueries=true&amp;useSSL=false&amp;verifyServerCertificate=false</value>
          </property>
          <property>
          <name>javax.jdo.option.ConnectionDriverName</name>
          <value>com.mysql.jdbc.Driver</value>
          </property>
          <property>
          <name>datanucleus.readOnlyDatastore</name>
          <value>false</value>
          </property>
          <property>
          <name>datanucleus.fixedDatastore</name>
          <value>false</value>
          </property>
          <property>
          <name>datanucleus.autoCreateSchema</name>
          <value>true</value>
          </property>
          <property>
          <name>datanucleus.autoCreateTables</name>
          <value>true</value>
          </property>
          <property>
          <name>datanucleus.autoCreateColumns</name>
          <value>true</value>
          </property>
          </configuration>
  1. 下载jdbc

    cd /home/ronnie/soft
    wget http://mirrors.163.com/mysql/Downloads/Connector-J/mysql-connector-java-5.1.48.tar.gz
  2. MySQL设置

    • 下载:

      sudo apt-get install mysql
    • mysql -uroot 进入mysql界面(Ubuntu mysql 下载后默认开机自启, Centos的话还需要service start mysqld 一下)

    • 修改密码:

      • 查看用户及密码:

        • 老版本:

          use mysql;
          select host,user,password from mysql.user;
        • 我用的5.7版本

          use mysql;
          select user, host, authentication_string from user;
      • 设置新密码

        update mysql.user set authentication_string='你要设置的密码' where user='root';
    • 这边有一个巨坑, 初始化数据库的时候报的:

      org.apache.hadoop.hive.metastore.HiveMetaException: Failed to get schema version.
      Underlying cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException : Communications link failure
      • 连接的问题, 但是grant all on hive.* to root@'%' identified by 'xxxxxx'; 敲了好几次都没用。

        mysql> select user, authentication_string, host from user;
        +------------------+-------------------------------------------+-----------+
        | user | authentication_string | host |
        +------------------+-------------------------------------------+-----------+
        | root | | localhost |
        | mysql.session | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | localhost |
        | mysql.sys | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | localhost |
        | debian-sys-maint | *19A653DDEEC19D326E8DFA1A3D00E26C16438DD8 | localhost |
        | root | *A63376A449EDC1A66FEFBC77E645D70EF6941893 | % |
        +------------------+-------------------------------------------+-----------+
        • 发现有重复的root用户, 删掉, 直接将root修改为%

          delete from user where host = '%';
          mysql> select user, authentication_string, host from user;
          +------------------+-------------------------------------------+-----------+
          | user | authentication_string | host |
          +------------------+-------------------------------------------+-----------+
          | root | | localhost |
          | mysql.session | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | localhost |
          | mysql.sys | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | localhost |
          | debian-sys-maint | *19A653DDEEC19D326E8DFA1A3D00E26C16438DD8 | localhost |
          +------------------+-------------------------------------------+-----------+ mysql> update user set host='%' where user = 'root';
          Query OK, 1 row affected (0.00 sec)
          Rows matched: 1 Changed: 1 Warnings: 0 mysql> flush privileges;
          Query OK, 0 rows affected (0.00 sec) mysql> select user, authentication_string, host from user;
          +------------------+-------------------------------------------+-----------+
          | user | authentication_string | host |
          +------------------+-------------------------------------------+-----------+
          | root | | % |
          | mysql.session | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | localhost |
          | mysql.sys | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | localhost |
          | debian-sys-maint | *19A653DDEEC19D326E8DFA1A3D00E26C16438DD8 | localhost |
          +------------------+-------------------------------------------+-----------+
        • 重启服务:

          service mysqld restart
        • 还是报错......, 测试了一下远程navicat也连不上, 报的1251

        • vim /etc/mysql/mysql.conf.d/mysqld.cnf 把其中的bind-address改为0.0.0.0

        • 还是报错, 最终的解决方案:

          ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '密码';
          #记得提交
          FLUSH PRIVILEGES;
      • 然后就连上navicat了, 执行初始化成功了

        root@node02:~# schematool  -initSchema -dbType mysql
        SLF4J: Class path contains multiple SLF4J bindings.
        SLF4J: Found binding in [jar:file:/opt/ronnie/hive-3.1.2/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
        SLF4J: Found binding in [jar:file:/opt/ronnie/hadoop-3.1.2/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]
        Metastore connection URL: jdbc:mysql://192.168.180.131:3306/hive?allowMultiQueries=true&useSSL=false&verifyServerCertificate=false
        Metastore Connection Driver : com.mysql.jdbc.Driver
        Metastore connection User: root
        Starting metastore schema initialization to 3.1.0
        Initialization script hive-schema-3.1.0.mysql.sql
      • 看一下mysql, 表生成成功

    1. 启动Hive

      root@node02:~# hive
      SLF4J: Class path contains multiple SLF4J bindings.
      SLF4J: Found binding in [jar:file:/opt/ronnie/hive-3.1.2/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
      SLF4J: Found binding in [jar:file:/opt/ronnie/hadoop-3.1.2/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]
      SLF4J: Class path contains multiple SLF4J bindings.
      SLF4J: Found binding in [jar:file:/opt/ronnie/hbase-2.0.6/lib/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
      SLF4J: Found binding in [jar:file:/opt/ronnie/hive-3.1.2/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
      SLF4J: Found binding in [jar:file:/opt/ronnie/hadoop-3.1.2/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.slf4j.impl.Log4jLoggerFactory]
      2019-12-02 12:34:18,689 WARN [main] util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
      SLF4J: Class path contains multiple SLF4J bindings.
      SLF4J: Found binding in [jar:file:/opt/ronnie/hive-3.1.2/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
      SLF4J: Found binding in [jar:file:/opt/ronnie/hadoop-3.1.2/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]
      Hive Session ID = b34ea22b-d5d7-4c0a-b8de-4ff47f241e34 Logging initialized using configuration in file:/opt/ronnie/hive-3.1.2/conf/hive-log4j2.properties Async: true
      Hive Session ID = 368bd863-0a45-4c46-94d6-df196a3b4d9b
      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>
      • Hive 2以上版本已经将Hive on MR视为废弃, 将来版本可能会移除, 现在用spark或tez结合hive的会多一些。
      • 现在企业主流使用的hive还是1.x, 部分企业逐渐向2.3版本靠拢, 3.1.2 确实还是太新了。
    2. 启动HiveServer2 (hiveserver2的服务端口默认是10000,WebUI端口默认是10002)

      $HIVE_HOME/bin/./hive --service hiveserver2

基于Hadoop3.1.2集群的Hive3.1.2安装(有不少坑)的更多相关文章

  1. ubuntu18.04 基于Hadoop3.1.2集群的Hbase2.0.6集群搭建

    前置条件: 之前已经搭好了带有HDFS, MapReduce,Yarn 的 Hadoop 集群 链接: ubuntu18.04.2 hadoop3.1.2+zookeeper3.5.5高可用完全分布式 ...

  2. 基于centos6.5 hbase 集群搭建

    注意本章内容是在上一篇文章“基于centos6.5 hadoop 集群搭建”基础上创建的 1.上传hbase安装包 hbase-0.96.2-hadoop2 我的目录存放在/usr/hadoop/hb ...

  3. CentOS7搭建Hadoop-3.3.0集群手记

    前提 这篇文章是基于Linux系统CentOS7搭建Hadoop-3.3.0分布式集群的详细手记. 基本概念 Hadoop中的HDFS和YARN都是主从架构,主从架构会有一主多从和多主多从两种架构,这 ...

  4. Tomcat:基于Apache+Tomcat的集群搭建

    根据Tomcat的官方文档说明可以知道,使用Tomcat配置集群需要与其它Web Server配合使用才可以完成,典型的有Apache和IIS. 这里就使用Apache+Tomcat方式来完成基于To ...

  5. 基于Twemproxy的Redis集群搭建以及想法

    基于Twemproxy的Redis集群方案(转) redis3.0 已经发布了几个月了,但是我这等菜鸟到网上还是没有找到很好的关于搭建redis3.0集群的文章,而且好像很多公司的redis版本还保持 ...

  6. 基于Kubernetes的WAF集群介绍

    Kubernetes是Google开源的容器集群管理系统.它构建Docker技术之上,为容器化的应用提供资源调度.部署运行.服务发现.扩容缩容等整一套功能,可看作是基于容器技术的PaaS平台. 本文旨 ...

  7. 基于zookeeper的Swarm集群搭建

    简介 Swarm:docker原生的集群管理工具,将一组docker主机作为一个虚拟的docker主机来管理. 对客户端而言,Swarm集群就像是另一台普通的docker主机. Swarm集群中的每台 ...

  8. 项目实战2—实现基于LVS负载均衡集群的电商网站架构

    负载均衡集群企业级应用实战-LVS 实现基于LVS负载均衡集群的电商网站架构 背景:随着业务的发展,网站的访问量越来越大,网站访问量已经从原来的1000QPS,变为3000QPS,网站已经不堪重负,响 ...

  9. 基于Hadoop2.7.3集群数据仓库Hive1.2.2的部署及使用

    基于Hadoop2.7.3集群数据仓库Hive1.2.2的部署及使用 HBase是一种分布式.面向列的NoSQL数据库,基于HDFS存储,以表的形式存储数据,表由行和列组成,列划分到列族中.HBase ...

随机推荐

  1. Css——显示2行数据,超出显示...

    解决需求——数据较长时,只显示两行,超出显示... .showTwoRow { text-align: left; text-overflow: ellipsis; display: -webkit- ...

  2. 【原】postman设置环境变量和全局变量

    一:设置环境变量 1. postman通过变换环境变量来快速变换环境地址. 2. 现可以将localhost:80信息添加至环境 3. 点击确定后,在首页可看到已添加的环境变量信息及设置的变量信息: ...

  3. 嵊州普及Day6T3

    题意:n个点,对于q个询问,有t秒及一个矩形的范围.在此矩形内的数每秒加1,若等于c,则下一秒变为0. 思路:t可能很大,%c+1就可以了.然后一个一个加起来就可以了. 见代码: #include&l ...

  4. 如何用AU3调用自己用VC++写的dll函数

    这问题困扰我一个上午了,终于找到原因了,不敢藏私,和大家分享一下. 大家都知道,AU3下调用dll文件里的函数是很方便的,只要一个dllcall语句就可以了. 比如下面这个: $result = Dl ...

  5. 编写跨平台Java程序注意事项

    使用Java语言编写应用程序最大的优点在于“一次编译,处处运行”,然而这并不是说所有的Java程序都具有跨平台的特性,事实上,相当一部分的Java程序是不能在别的操作系统上正确运行的,那么如何才能编写 ...

  6. vue 父组件调用子组件方法简单例子(笔记)

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  7. Burp Suite Pro1.7.36破解版

    百度网盘下载(H大会一直更新):链接: https://pan.baidu.com/s/1brjPKM7 密码: 9v4r 爱盘下载:https://down.52pojie.cn/Tools/Net ...

  8. user模块User表

    user模块User表 创建user模块 前提:在 luffy 虚拟环境下 1.终端从项目根目录进入apps目录 >: cd luffyapi & cd apps 2.创建app > ...

  9. 多个span标签在同一行显示

    属性设置为display:inline或display:inline-block

  10. vim学习--usr03 moving around

    Word movement 小写的"w""ge""e""b" w表示向后移动到一个单词开头 ge表示向前移动到一个单词末 ...