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系统

启动hdfs和yarn服务及MapReduce历史

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


解压及修改配置文件

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


  • 修改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

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


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


网页访问地址


最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容