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

668

启动hdfs和yarn服务及MapReduce历史

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


    700

解压及修改配置文件

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


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

700

700

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

    465
  • 创建表并执行count查询
    在这个过程中会执行MapReduce
  • 网页访问地址

700
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值