Hive安装使用

文档及下周网址

必要条件Requirements

  • Java 1.7
    Note: Hive versions 1.2 onward require Java 1.7 or newer. Hive versions 0.14 to 1.1 work with Java 1.6 as well. Users are strongly advised to start moving to Java 1.8 (see HIVE-8607).
  • Hadoop 2.x (preferred推荐), 1.x (not supported by Hive 2.0.0 onward).
    Hive versions up to 0.13 also supported Hadoop 0.20.x, 0.23.x.
  • Hive is commonly used in production(生产环境) Linux and Windows environment. Mac is a commonly used development environment. The instructions in this document are applicable to Linux and Mac. Using it on Windows would require slightly different steps.

上传hive包和myql包到linux系统

《Hive安装使用》

启动hdfs和yarn服务及MapReduce历史

  • sbin/start-dfs.sh
  • sbin/start-yarn.sh
  • sbin/mr-jobhistory-damon.sh start historyserver

    《Hive安装使用》

解压及修改配置文件

hive依赖于hadoop

  • tar -zxf apache-hive-0.13.1-bin.tar.gz -C /opt/modules/
    -C 表示change的意思

  • 把apache-hive-0.13.1-bin 重新命名为hive-0.13.1
    mv apache-hive-0.13.1-bin hive-0.13.1

  • 把hive-env.sh.template重新命令为hive-env.sh

    《Hive安装使用》

  • 修改hadoop目录
    修改hive-en.sh 中的 HADOOP_HOME=/opt/modules/hadoop-2.5.0

  • 修改hive配置文件目录
    opt/modules/hive-0.13.1/conf

运行hive

  • 在hdfs系统中添加目录
    命令:bin/hdfs dfs -mkdir -p /user/hive/warehouse 和/tmp

  • 把这两个目录放到一个组权限
    set them chmod g+w before you can create a table in Hive
    命令:bin/hdfs dfs -chmod 777 /tmp
    bin/hdfs dfs -chmod g+w /user/hive/warehouse
    bin/hdfs dfs -chmod777 /user/hive/warehouse

《Hive安装使用》
《Hive安装使用》

  • 运行 bin/hive
    第一次运行比较慢,在创建元数据,默认会创建一个default库。库为空库,没有任何表。

    《Hive安装使用》

  • 创建表并执行count查询
    在这个过程中会执行MapReduce

    《Hive安装使用》

《Hive安装使用》

网页访问地址

《Hive安装使用》

    原文作者:志辉聊码
    原文地址: https://www.jianshu.com/p/b5c86c9216ba
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞