使用minio + iceberg-rest + amoro+ + trino搭建iceberg数据湖架构

该架构(MinIO + Iceberg REST Catalog + Amoro + Trino)的设计融合了现代数据湖的核心需求,旨在实现‌存储解耦、计算灵活、管理自动化及高性能查询 ‌的综合目标。

一、核心设计理念

  1. 存储与计算分离
  • MinIO‌ 作为底层对象存储,提供高扩展、低成本的云原生存储能力,兼容 S3 API 简化多引擎接入。
  1. 统一元数据治理
  • Iceberg REST Catalog‌ 替代 Hive Metastore,提供标准化 RESTful 接口管理表元数据(如分区、Schema、快照)。
  • 优势‌:解耦元数据服务,避免单点故障,支持多引擎并发读写(Flink/Spark/Trino)。
  1. 自动化湖仓管理
  • Amoro ‌ 填补了 Iceberg 原生能力的空白,提供:
    • 小文件自动合并‌(通过 Flink 作业优化存储)
    • 多引擎协调‌(保证 Trino、Flink、Spark 的事务一致性)
    • 表生命周期管理‌(如分区清理、数据归档)
  1. 高性能分析查询
  • Trino ‌ 作为统一 SQL 查询层,支持:
    • 秒级响应复杂分析;
    • Iceberg 高级特性(时间旅行、增量扫描)

数据写入建议使用spark、flink等引擎直接通过iceberg rest catalog写入minio存储。可实现批流、实时流。

上一篇文章中是 trino直接访问amoro,amoro存在单一节点存在性能瓶颈,amoro还在孵化阶段,为了解决上面的问题,因此引入iceberg rest catalog 元数据管理,让amoro接管外部 External Catalog,trino直接配置访问 rest catalog。

另外,大家会问为什么数据查询分析不适用doris? 其实是可以的。考虑一点:doris数仓分析访问iceberg时,它有一个10分钟的元数据同步时间,会导致实时写入iceberg的数据,不能第一时间查询到。因此引入doris 会导致只能达到分钟级的实时数仓。

二、部署流程

以下是使用docker-compose搭建,可用于日常开发环境。

确保已安装Docker 27.0.3 和Docker Compose。

把下面的yaml保存到docker-compose.yml的文件中:

复制代码
version: "3"

services:
  minio:
    image: minio/minio
    container_name: minio
    networks:
      demo-iceberg:
        aliases:
          - warehouse.minio
    environment:
      - MINIO_ROOT_USER=admin
      - MINIO_ROOT_PASSWORD=password
      - MINIO_DOMAIN=minio
    ports:
      - 9001:9001
      - 9000:9000
    command: [ "server", "/data", "--console-address", ":9001" ]
  rest:
    image: tabulario/iceberg-rest
    container_name: iceberg-rest
    networks:
      demo-iceberg:
        aliases:
          - warehouse.rest
    ports:
      - 8181:8181
    environment:
      - AWS_ACCESS_KEY_ID=admin
      - AWS_SECRET_ACCESS_KEY=password
      - AWS_REGION=us-east-1
      - CATALOG_WAREHOUSE=s3://warehouse/
      - CATALOG_IO__IMPL=org.apache.iceberg.aws.s3.S3FileIO
      - CATALOG_S3_ENDPOINT=http://minio:9000
  amoro:
    image: apache/amoro
    container_name: amoro
    ports:
      - 8081:8081
      - 1630:1630
      - 1260:1260
    environment:
      - JVM_XMS=1024
    networks:
      demo-iceberg:
    volumes:
      - ./amoro:/tmp/warehouse
    command: ["/entrypoint.sh", "ams"]
    tty: true
    stdin_open: true
  trino:
    image: trinodb/trino:419
    container_name: trino
    environment:
      - AWS_ACCESS_KEY_ID=admin
      - AWS_SECRET_ACCESS_KEY=password
      - AWS_REGION=us-east-1
    volumes:
      - ./example.properties:/etc/trino/catalog/example.properties
    networks:
      demo-iceberg:
        aliases:
          - warehouse.trino
    ports:
      - 8080:8080
networks:
  demo-iceberg:
    ipam:
      driver: default

iceberg rest 镜像使用 tabulario/iceberg-rest。不要去使用iceberg官网上的 apache/iceberg-rest-fixture,会报错。

接下来,在docker-compose.yml所在的目录下创建example.properties文件:

复制代码
connector.name=iceberg
iceberg.catalog.type=rest
iceberg.rest-catalog.uri=http://<IP地址>:8181
fs.native-s3.enabled=true
s3.endpoint=http://<IP地址>:9000
s3.region=us-east-1
s3.aws-access-key=admin
s3.aws-secret-key=password

最后一步骤:使用以下命令启动docker容器:

复制代码
docker-compose up minio rest amoro

配置

minio 创建 bucket

打开http://localhost:9000在浏览器中,输入admin/password登录minio界面。

amoro 配置

Create optimizer group

Open http://localhost:1630 in a browser, enter admin/admin to log in to the dashboard.

Click on Optimizing in the sidebar, choose Optimizer Groups and click Add Group button to create a new group befre creating catalog

Create catalog

Click on Catalogs in the sidebar, click on the + button under Catalog List to create a test catalog, and name it to demo_catalog:

o use the Iceberg Format, select Type as External Catalog, and choose Metastore as Custom, and choose Iceberg as Table Format.

key catalog-impl in to org.apache.iceberg.rest.RESTCatalog

add key as uri in in to http://<rest ip address>:8181

这一步非常重要,请查看下面的图片填写。

按照上面配置的,修改example.properties文件。然后执行以下命令:

复制代码
docker-compose up trino

Demo steps

Initialize tables

Click on amoro system Terminal in the sidebar, you can create the test tables here using SQL. Terminal supports executing Spark SQL statements for now.

复制代码
CREATE DATABASE IF NOT EXISTS db;
CREATE TABLE IF NOT EXISTS db.tb_users (
    id INT,
    name string,
    ts TIMESTAMP
) 
PARTITIONED BY (days(ts));

INSERT OVERWRITE db.tb_users VALUES 
(1, "eric", timestamp("2022-07-01 12:32:00")),
(2, "frank", timestamp("2022-07-02 09:11:00")),
(3, "lee", timestamp("2022-07-02 10:11:00"));

SELECT * FROM db.tb_users;

Click on the RUN button uppon the SQL editor, and wait for the SQL query to finish executing. You can then see the query results under the SQL editor.

Initialize tables

start up the docker containers with this command:

复制代码
docker exec -it tirno trino

trino> show catalogs;
 Catalog 
---------
 example 
 jmx     
 memory  
 system  
 tpcds   
 tpch    
(6 rows)

trino> show schemas in example;
       Schema       
--------------------
 db                 
 information_schema 
(2 rows)

trino> show tables in example.db;
 Table 
-------
 tb_users
(1 row)


trino> select * from example.db.tb_users;
 id | name  |               ts               
----+-------+--------------------------------
  1 | eric  | 2022-07-01 12:32:00.000000 UTC  
  2 | frank | 2022-07-02 09:11:00.000000 UTC 
  3 | lee   | 2022-07-02 10:11:00.000000 UTC  
(3 rows)

到此为止,我们的架构就搭建完成。

关键注意事项

相关推荐
兰丰岐7 天前
使用apache amoro + trino+minio搭建iceberg数据湖架构
iceberg·amoro·apache amoro
Bruk.Liu11 天前
《Minio 分片上传实现(基于Spring Boot)》
前端·spring boot·minio
记得开心一点嘛14 天前
使用MinIO搭建自己的分布式文件存储
分布式·spring cloud·minio
镜舟科技1 个月前
数据湖和数据仓库的区别
数据仓库·物联网·ai·数据存储·数据湖·湖仓一体·大数据分析
迷雾骑士1 个月前
CentOS Stream安装MinIO教程
centos·minio
itachi-uchiha1 个月前
Docker安装MinIO对象存储中间件
中间件·容器·minio
Kookoos1 个月前
使用 ABP vNext 集成 MinIO 构建高可用 BLOB 存储服务
后端·c#·.net·.netcore·minio·blob
梦想画家1 个月前
MinIO:从入门到精通,解锁云原生存储的奥秘
minio·数据工程
为美好的生活献上中指1 个月前
java每日精进 5.18【文件存储】
java·开发语言·minio·七牛云存储·s3·七牛云