找回密码
 立即注册
首页 业界区 业界 使用minio + iceberg-rest + amoro+ + trino搭建iceberg ...

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

师佳思 2025-6-21 05:57:44
该架构(MinIO + Iceberg REST Catalog + Amoro + Trino)的设计融合了现代数据湖的核心需求,旨在实现‌存储解耦、计算灵活、管理自动化及高性能查询‌的综合目标。
1.jpeg

一、核心设计理念


  • 存储与计算分离


  • MinIO‌ 作为底层对象存储,提供高扩展、低成本的云原生存储能力,兼容 S3 API 简化多引擎接入。

  • 统一元数据治理


  • Iceberg REST Catalog‌ 替代 Hive Metastore,提供标准化 RESTful 接口管理表元数据(如分区、Schema、快照)。
  • 优势‌:解耦元数据服务,避免单点故障,支持多引擎并发读写(Flink/Spark/Trino)。

  • 自动化湖仓管理


  • Amoro‌ 填补了 Iceberg 原生能力的空白,提供:

    • 小文件自动合并‌(通过 Flink 作业优化存储)
    • 多引擎协调‌(保证 Trino、Flink、Spark 的事务一致性)
    • 表生命周期管理‌(如分区清理、数据归档)


  • 高性能分析查询


  • 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的文件中:
  1. version: "3"
  2. services:
  3.   minio:
  4.     image: minio/minio
  5.     container_name: minio
  6.     networks:
  7.       demo-iceberg:
  8.         aliases:
  9.           - warehouse.minio
  10.     environment:
  11.       - MINIO_ROOT_USER=admin
  12.       - MINIO_ROOT_PASSWORD=password
  13.       - MINIO_DOMAIN=minio
  14.     ports:
  15.       - 9001:9001
  16.       - 9000:9000
  17.     command: [ "server", "/data", "--console-address", ":9001" ]
  18.   rest:
  19.     image: tabulario/iceberg-rest
  20.     container_name: iceberg-rest
  21.     networks:
  22.       demo-iceberg:
  23.         aliases:
  24.           - warehouse.rest
  25.     ports:
  26.       - 8181:8181
  27.     environment:
  28.       - AWS_ACCESS_KEY_ID=admin
  29.       - AWS_SECRET_ACCESS_KEY=password
  30.       - AWS_REGION=us-east-1
  31.       - CATALOG_WAREHOUSE=s3://warehouse/
  32.       - CATALOG_IO__IMPL=org.apache.iceberg.aws.s3.S3FileIO
  33.       - CATALOG_S3_ENDPOINT=http://minio:9000
  34.   amoro:
  35.     image: apache/amoro
  36.     container_name: amoro
  37.     ports:
  38.       - 8081:8081
  39.       - 1630:1630
  40.       - 1260:1260
  41.     environment:
  42.       - JVM_XMS=1024
  43.     networks:
  44.       demo-iceberg:
  45.     volumes:
  46.       - ./amoro:/tmp/warehouse
  47.     command: ["/entrypoint.sh", "ams"]
  48.     tty: true
  49.     stdin_open: true
  50.   trino:
  51.     image: trinodb/trino:419
  52.     container_name: trino
  53.     environment:
  54.       - AWS_ACCESS_KEY_ID=admin
  55.       - AWS_SECRET_ACCESS_KEY=password
  56.       - AWS_REGION=us-east-1
  57.     volumes:
  58.       - ./example.properties:/etc/trino/catalog/example.properties
  59.     networks:
  60.       demo-iceberg:
  61.         aliases:
  62.           - warehouse.trino
  63.     ports:
  64.       - 8080:8080
  65. networks:
  66.   demo-iceberg:
  67.     ipam:
  68.       driver: default
复制代码
iceberg rest 镜像使用 tabulario/iceberg-rest。不要去使用iceberg官网上的 apache/iceberg-rest-fixture,会报错。
接下来,在docker-compose.yml所在的目录下创建example.properties文件:
  1. connector.name=iceberg
  2. iceberg.catalog.type=rest
  3. iceberg.rest-catalog.uri=http://<IP地址>:8181
  4. fs.native-s3.enabled=true
  5. s3.endpoint=http://<IP地址>:9000
  6. s3.region=us-east-1
  7. s3.aws-access-key=admin
  8. s3.aws-secret-key=password
复制代码
最后一步骤:使用以下命令启动docker容器:
  1. docker-compose up minio rest amoro
复制代码
配置

minio 创建 bucket

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

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
3.png

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://:8181
这一步非常重要,请查看下面的图片填写。
4.png

按照上面配置的,修改example.properties文件。然后执行以下命令:
  1. 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.
  1. CREATE DATABASE IF NOT EXISTS db;
  2. CREATE TABLE IF NOT EXISTS db.tb_users (
  3.     id INT,
  4.     name string,
  5.     ts TIMESTAMP
  6. )
  7. PARTITIONED BY (days(ts));
  8. INSERT OVERWRITE db.tb_users VALUES
  9. (1, "eric", timestamp("2022-07-01 12:32:00")),
  10. (2, "frank", timestamp("2022-07-02 09:11:00")),
  11. (3, "lee", timestamp("2022-07-02 10:11:00"));
  12. 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:
  1. docker exec -it tirno trino
复制代码
  1. trino> show catalogs;
  2. Catalog
  3. ---------
  4. example
  5. jmx     
  6. memory  
  7. system  
  8. tpcds   
  9. tpch   
  10. (6 rows)
  11. trino> show schemas in example;
  12.        Schema      
  13. --------------------
  14. db                 
  15. information_schema
  16. (2 rows)
  17. trino> show tables in example.db;
  18. Table
  19. -------
  20. tb_users
  21. (1 row)
  22. trino> select * from example.db.tb_users;
  23. id | name  |               ts               
  24. ----+-------+--------------------------------
  25.   1 | eric  | 2022-07-01 12:32:00.000000 UTC  
  26.   2 | frank | 2022-07-02 09:11:00.000000 UTC
  27.   3 | lee   | 2022-07-02 10:11:00.000000 UTC  
  28. (3 rows)
复制代码
到此为止,我们的架构就搭建完成。
关键注意事项

  • 生产环境建议配置持久化卷和网络隔离
  • 服务器要配置 limits.conf、 sysctl.conf。可参考https://www.oceanbase.com/docs/common-oceanbase-database-cn-1000000002016077

来源:程序园用户自行投稿发布,如果侵权,请联系站长删除
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!
您需要登录后才可以回帖 登录 | 立即注册