Alluxio集成Hive和Presto

前提

已经集成好了mapreduce
https://www.jianshu.com/p/ee641a3d90d8

1. 配置hive

conf/hive-env.sh

export HIVE_AUX_JARS_PATH=/opt/alluxio-2.0.1/client/alluxio-2.0.1-client.jar:${HIVE_AUX_JARS_PATH}

对于开源版,可以像上面这么配置,对于CDH版需要如下配置:

Alluxio集成Hive和Presto_第1张图片
image.png

2. 运行示例

  • 下载示例文件
    地址:http://grouplens.org/datasets/movielens/

  • 解压,将u_user上传到alluxio文件系统中

$ ./bin/alluxio fs mkdir /ml-100k
$ ./bin/alluxio fs copyFromLocal /path/to/ml-100k/u.user alluxio://centos134:19998//ml-100k
Alluxio集成Hive和Presto_第2张图片
  • 进入hive shell从alluxio导入表
hive> CREATE TABLE u_user (
userid INT,
age INT,
gender CHAR(1),
occupation STRING,
zipcode STRING)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY '|'
LOCATION 'alluxio://centos134:19998/ml-100k';

Alluxio集成Hive和Presto_第3张图片

ps:上面是新建表,对于hive中已经存在的表,将其有hdfs转换到alluxio上面可以进行如下操作:(主要就是修改表的配置将location改为alluxio中的位置,参考https://docs.alluxio.io/os/user/stable/cn/compute/Hive.html#%E5%9C%A8alluxio%E4%B8%AD%E4%BD%BF%E7%94%A8%E5%B7%B2%E7%BB%8F%E5%AD%98%E5%82%A8%E5%9C%A8hdfs%E4%B8%AD%E7%9A%84%E8%A1%A8

  • 1


    Alluxio集成Hive和Presto_第4张图片
    image.png
  • 2


    image.png
  • 3


    Alluxio集成Hive和Presto_第5张图片
  • 4


    Alluxio集成Hive和Presto_第6张图片
    image.png

3. 集成presto

确认presto已经安装好,并且可以正常查询hive数据。

  • 复制jar包
    把 Alluxio 客户端 jar 包//client/alluxio-2.0.1-client.jar 放到所有 Presto 服务器的${PRESTO_HOME}/plugin/hive-hadoop2/
Alluxio集成Hive和Presto_第7张图片
  • 重启
    $ ${PRESTO_HOME}/bin/launcher restart

  • 测试

    • 进入shell:

      ./presto --server centos134:8099

    • sql:

      show tables from hive.default;

      Alluxio集成Hive和Presto_第8张图片

      select * from hive.default.u_user limit 10;
      Alluxio集成Hive和Presto_第9张图片

你可能感兴趣的:(Alluxio集成Hive和Presto)