该架构(MinIO + Iceberg REST Catalog + Amoro + Trino)的设计融合了现代数据湖的核心需求,旨在实现存储解耦、计算灵活、管理自动化及高性能查询 的综合目标。
一、核心设计理念
- 存储与计算分离
- 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的文件中:
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)
到此为止,我们的架构就搭建完成。
关键注意事项
- 生产环境建议配置持久化卷和网络隔离
- 服务器要配置 limits.conf、 sysctl.conf。可参考https://www.oceanbase.com/docs/common-oceanbase-database-cn-1000000002016077