Alluxio
ProductsLanguageHome
  • Alluxio概览
  • 用户指南
    • 快速上手指南
    • 架构
    • FAQ
    • 作业服务器
    • 应用场景
  • 核心功能
    • 缓存
    • 统一命名空间
  • 部署 Alluxio
    • 在Kubernetes上部署Alluxio
    • 本地运行Alluxio
    • 在集群上独立运行Alluxio
    • 在Docker上运行Alluxio
    • 在具有HA的群集上部署Alluxio
    • 使用Docker部署AlluxioFuse加速深度学习训练(试验)
    • 基本要求
  • 云源生
    • Tencent EMR
  • 计算应用
    • Apache Spark
    • Presto
    • Spark on Kubernetes
    • Apache Flink
    • Apache Hadoop MapReduce
    • Presto on Iceberg (Experimental)
    • Trino
    • Apache Hive
    • 深度学习框架
    • Tensorflow
  • 底层存储系统
    • Alluxio集成Amazon AWS S3作为底层存储
    • Alluxio集成GCS作为底层存储
    • Alluxio集成Azure Blob Store作为底层存储
    • Azure Data Lake Storage Gen2
    • Azure 数据湖存储
    • Alluxio集成HDFS作为底层存储
    • Alluxio集成COS作为底层存储
    • Alluxio集成COSN作为底层存储
    • Alluxio集成Ceph Object Storage作为底层存储
    • Alluxio集成NFS作为底层存储
    • Alluxio集成Kodo作为底层存储
    • Alluxio集成Swift作为底层存储
    • Alluxio集成WEB作为底层存储
    • Alluxio集成Minio作为底层存储
    • 阿里云对象存储服务
    • Alluxio集成Ozone作为底层存储
    • Alluxio集成CephFS作为底层存储
  • 安全设置
    • 安全性
  • 运维指南
    • 配置项设置
    • 命令行接口
    • 管理员命令行接口
    • Web界面
    • 日志
    • 度量指标系统
    • 远程记录日志
  • 管理
    • 升级
    • 异常诊断与调试
  • APIs
    • Filesystem API
    • S3 Client
    • POSIX API
    • REST API
    • Python Client
    • 兼容Hadoop的Java
    • Go 客户端
  • 开发者资源
    • 编译Alluxio源代码
    • 开发指南
    • 代码规范
    • 如何开发单元测试
    • 文档规范
  • 参考
    • 配置项列表
    • List of Metrics
  • REST API
    • Master REST API
    • Worker REST API
    • Proxy REST API
    • Job REST API
  • Javadoc
Powered by GitBook
On this page
  • 部署条件
  • 基本设置
  • 在 Presto 连接器上安装 Alluxio client jar
  • 配置 Presto 来使用 Iceberg 连接器
  • 示例:使用 Presto 查询 Alluxio 上的Iceberg表
  • 创建 schema 和 Iceberg 表
  • 在表中插入示例数据
  1. 计算应用

Presto on Iceberg (Experimental)

Last updated 6 months ago

Presto 在 0.256 版本中新增了对 支持的功能。

本文档介绍如何通过 Alluxio 使用 Presto 查询 Iceberg 表。本文档目前处于实验性阶段,此处所述信息可能会发生变化。

要使用 Presto 查询 Iceberg 表,请确保已设置好 Presto,Hive Metastore 和 Alluxio,并且 Presto 可以通过 Alluxio 的文件系统接口访问数据。否则,请参考 Presto 的通用安装和配置进行设置。该指南的大部分内容也适用于 Iceberg 流程,本文档包含了使用 Iceberg 表的详细说明。

部署条件

  • Presto 通用设置的所有

  • 服务器版本不低于 0.257

基本设置

在 Presto 连接器上安装 Alluxio client jar

将位于 {{site.ALLUXIO_CLIENT_JAR_PATH}} 的 Alluxio client jar 复制到位于 ${PRESTO_HOME}/plugin/iceberg/ 的 Presto Iceberg 连接器路径中, 然后重启 Presto 服务器:

$ ${PRESTO_HOME}/bin/launcher restart

这里需注意,相同的 client jar 文件应位于 Hive 的类路径下。否则,请参阅共同部署 Hive 和 Alluxio 的来设置 Hive。

配置 Presto 来使用 Iceberg 连接器

Presto 使用 读取和写入 Iceberg 表。要启用 Iceberg 连接器,在 Presto 的安装目录 ${PRESTO_HOME}/etc/catalog/iceberg.properties 中为 Iceberg 连接器创建一个 catalog:

connector.name=iceberg
hive.metastore.uri=thrift://localhost:9083

根据设置,修改 Hive Metastore 的连接 URI。

示例:使用 Presto 查询 Alluxio 上的Iceberg表

创建 schema 和 Iceberg 表

为了方便演示,我们创建一个示例 schema 和一个 Iceberg 表。 使用以下命令启动 Presto CLI client:

./presto --server localhost:8080 --catalog iceberg --debug
CREATE SCHEMA iceberg_test;
USE iceberg_test;
CREATE TABLE person (name varchar, age int, id int)
    WITH (location = 'alluxio://localhost:19998/person', format = 'parquet');

更改 Alluxio 连接器 URI 中的 hostname 和端口来匹配你的配置。

这些语句在 Alluxio 文件系统的 /person 路径下创建一个名为 iceberg_test 的 schema 和一个名为 person 的表,并将表存成 Parquet 格式。

在表中插入示例数据

在新创建的表中插入一行示例数据:

INSERT INTO person VALUES ('alice', 18, 1000);

也可查看Alluxio中的文件现在可通过从表中读回数据来验证是否一切正常:

SELECT * FROM person;

也可查看 Alluxio 中的文件:

$ bin/alluxio fs ls /person
drwxr-xr-x  alluxio    alluxio    10    PERSISTED 06-29-2021 16:24:02:007  DIR /person/metadata
drwxr-xr-x  alluxio    alluxio     1    PERSISTED 06-29-2021 16:24:00:049  DIR /person/data
$ bin/alluxio fs ls /person/data
-rw-r--r--  alluxio    alluxio   400    PERSISTED 06-29-2021 16:24:00:691 100% /person/data/6e6a451a-8f20-4d73-9ef6-ee48070dad27.parquet
$ bin/alluxio fs ls /person/metadata
-rw-r--r--  alluxio    alluxio  1406    PERSISTED 06-29-2021 16:23:28:608 100% /person/metadata/00000-2fd982ae-2a81-44a8-a4db-505e9ba6c09d.metadata.json
...
(snip)

这里可以看到, Iceberg 表的 metadata 文件与 data 文件已经创建成功。

有关 client 的更多信息,请参阅章节。由于我们要处理的是 Iceberg 表,这里需将 catalog 设置为iceberg 。 在 client 运行以下语句:

注意:Presto 中 Iceberg 连接器的写入路径存在 bug,因此数据插入可能会失败。在 Presto 0.257 版本中, 已解决该问题。

此 PR
Iceberg 表
指南
部署条件
Iceberg 连接器
章节
使用 Presto 查询表