zoukankan      html  css  js  c++  java
  • [Hive_2] Hive 的安装&配置


    0. 说明

      在安装好 Hadoop 集群和 ZooKeeper 分布式的基础上装好 MySQL,再进行 Hive 安装配置

      


    1. 安装

      1.1 将 Hive 安装包通过 Xftp 发送到 /home/centos 目录

      

      1.2 解压

    tar -xzvf apache-hive-2.1.1-bin.tar.gz -C /soft/

      1.3 创建符号链接

    cd /soft/

    ln -s apache-hive-2.1.1-bin/ hive

      1.4 配置环境变量

    # hive环境变量
    export HIVE_HOME=/soft/hive
    export PATH=$PATH:$HIVE_HOME/bin

      1.5 生效环境变量

    source /etc/profile

    2. 修改 Hive 配置文件

      2.1 重命名 /soft/hive/conf 目录所有的 template 文件后缀去掉

    rename '.template' '' *.template

      2.2 修改 hive-env.sh 文件,添加

    HADOOP_HOME=/soft/hadoop

      2.3 重命名 hive-default.xml 文件为 hive-site.xml

    mv hive-default.xml hive-site.xml

      2.4 修改 hive-site.xml

    <configuration>
      ...
      <property>
        <name>javax.jdo.option.ConnectionDriverName</name>
        <value>com.mysql.jdbc.Driver</value>
        <description>Driver class name for a JDBC metastore</description>
      </property>
      <property>
        <name>javax.jdo.option.ConnectionURL</name>
        <value>jdbc:mysql://s101:3306/hive</value>
        <description>
          JDBC connect string for a JDBC metastore.
          To use SSL to encrypt/authenticate the connection, provide database-specific SSL flag in the connection URL.
          For example, jdbc:postgresql://myhost/db?ssl=true for postgres database.
        </description>
      </property>
      <property>
        <name>javax.jdo.option.ConnectionUserName</name>
        <value>root</value>
        <description>Username to use against metastore database</description>
      </property>
      <property>
        <name>javax.jdo.option.ConnectionPassword</name>
        <value>root</value>
        <description>password to use against metastore database</description>
      </property>
      <property>
        <name>hive.server2.enable.doAs</name>
        <value>false</value>
        <description>
          Setting this property to true will have HiveServer2 execute
          Hive operations as the user making the calls to it.
        </description>
      </property>
      <property>
        <name>hive.metastore.schema.verification</name>
        <value>false</value>
        <description>
          Enforce metastore schema version consistency.
          True: Verify that version information stored in metastore matches with one from Hive jars.  Also disable automatic
                schema migration attempt. Users are required to manually migrate schema after Hive upgrade which ensures
                proper metastore schema migration. (Default)
          False: Warn if the version information stored in metastore doesn't match with one from in Hive jars.
        </description>
      </property>
    
    
      ...
    </configuration>

      2.5 修改 hive-site.xml 中的 ${system:user.name} 和 ${system:java.io.tmpdir} //可选

    sed -i 's@${system:user.name}@centos@g' hive-site.xml
    sed -i 's@${system:java.io.tmpdir}@/home/centos/hive@g' hive-site.xml

      2.6 拷贝 MySQL 驱动到 Hive 下

    cp ~/mysql-connector-java-5.1.44.jar /soft/hive/lib/

      2.7 在 MySQL 中创建数据库 Hive

    create database hive;

      2.8 初始化元数据库

    schematool -initSchema -dbType mysql

    3. 启动 Hive 的顺序

      3.1 启动 ZooKeeper

    xzk.sh start

      3.2 启动 Hadoop(HDFS+MR)

    start-all.sh


      3.3 启动 Hive

    hive

     

      3.4 启动 Hive 2代服务

      hiveserver2 为 Hive 的 JDBC 接口,用户可以连接此端口来连接 Hive 服务器

    # 先启动
    hiveserver2
    
    # 使用新一代客户端 beeline 连接 hiveserer2
    beeline -u jdbc:hive2://s101:10000

    且将新火试新茶,诗酒趁年华。
  • 相关阅读:
    jquery 自执行笔记
    快速搭建动态web工程并且进行数据库交互页面呈现
    仿途牛导航
    一些jquery技巧
    Jquery 事件冒泡 以及阻止默认事件
    absolute(绝对定位)和 relative(相对定位)
    java 日期格式转换,加减等
    StringTokenizer 简单的描述
    运算符和表达式
    Eclipse常用命令+ 简单的自动售票程序
  • 原文地址:https://www.cnblogs.com/share23/p/9726413.html
Copyright © 2011-2022 走看看