# Iceberg REST 目录规范

**Iceberg REST 目录规范**是一套由 OpenAPI 定义的 HTTP 协议，维护于 [Apache Iceberg](https://www.edgepedia.org/zh/apache-iceberg) 仓库之中，它标准化了引擎和客户端与任何管理 Iceberg 表元数据的目录服务之间的通信方式：配置发现、命名空间、表、视图、提交、凭证，以及近期版本中新增的服务端扫描规划和 SQL 函数。<sup>[1](https://iceberglakehouse.com/apache-iceberg-rest-catalog/)</sup> Iceberg REST 目录即任何实现了该规范的目录服务；它不要求每个引擎和语言都配备目录专用的客户端，而是将目录逻辑置于 HTTP API 之后，一份客户端实现即可与任何合规服务器配合工作。<sup>[2](https://iceberg.apache.org/docs/latest/rest-catalog/)</sup>

| 关键事实 | 详情 |
|---|---|
| 是什么 | 一套由 OpenAPI 定义的 HTTP API，用于对 Iceberg 表执行目录操作，定义于 Apache Iceberg 仓库中的 `open-api/rest-catalog-open-api.yaml`<sup>[1](https://iceberglakehouse.com/apache-iceberg-rest-catalog/)</sup> |
| 起源 | 在 Iceberg 0.14.0 中引入，旨在解决跨语言、跨厂商的目录兼容性问题<sup>[3](https://iceberglakehouse.com/iceberg/iceberg-rest-catalog-api/)</sup> |
| 寻址方式 | 每个资源路径都位于 `/v1/{prefix}/` 之下，可选前缀由 `GET /v1/config` 返回<sup>[1](https://iceberglakehouse.com/apache-iceberg-rest-catalog/)</sup> |
| 范围 | 当前规范包含 35 个操作，涵盖配置、命名空间、表、视图、提交、凭证、扫描规划和函数<sup>[4](https://blog.icebergdatalakehouse.com/posts/iceberg-rest-catalog-compatibility-report-2026/)</sup> |
| 安全 | 客户端侧支持 OAuth2、Basic、AWS SigV4 和 Google 认证，另支持凭证发放和远程签名以实现表共享<sup>[2](https://iceberg.apache.org/docs/latest/rest-catalog/)</sup><sup> • </sup><sup>[5](https://iceberg.apache.org/docs/nightly/rest-protocol/)</sup> |
| 主要实现 | Apache Polaris、Project Nessie、AWS Glue、Amazon S3 Tables、Dremio Open Catalog、Unity Catalog、Lakekeeper，以及一个由 Hive Metastore 支撑的 REST API<sup>[6](https://opendatalakehouse.com/compare/catalogs/)</sup><sup> • </sup><sup>[7](https://hive.apache.org/docs/latest/admin/iceberg-rest-catalog/)</sup> |
| 一致性测试 | REST 兼容性套件（RCK），一个技术兼容性套件的实现，可对任何 REST 服务器运行 Java 参考测试套件<sup>[8](https://github.com/apache/iceberg/blob/main/open-api/README.md)</sup> |

## 协议为何而生

随着 Iceberg 项目发展到支持越来越多的语言和引擎，可插拔目录带来了实际问题：目录需要在多种语言中实现，商业产品也难以支持众多不同的目录和客户端。社区为此创建了 REST 目录协议——一套由 OpenAPI 规范定义的通用 API——作为应对之策；项目将其类比为 [Hive Metastore](https://www.edgepedia.org/zh/hive-metastore) 的 Thrift 协议。<sup>[9](https://iceberg.apache.org/rest-catalog-spec/)</sup>

该协议带来了若干设计上的结果。新的语言和引擎只需一份客户端实现即可支持任何目录。提交基于变更，这使得服务端冲突消解和重试成为可能，并减少了失败。元数据版本升级更加容易，因为根元数据由目录服务写入。惰性快照加载、多表提交和缓存等服务端特性成为可能，协议还支持使用凭证发放或远程签名的安全表共享。<sup>[9](https://iceberg.apache.org/rest-catalog-spec/)</sup> 由于服务器拥有提交逻辑，协议能够实现客户端目录无法提供的能力，例如服务端冲突消解和多表提交。<sup>[5](https://iceberg.apache.org/docs/nightly/rest-protocol/)</sup>

## 客户端如何连接

连接至少需要一个指向服务的 `uri`；配置的 `warehouse` 和文件 I/O 属性同样生效。<sup>[2](https://iceberg.apache.org/docs/latest/rest-catalog/)</sup> 初始化时，客户端调用服务器的配置路由 `GET /v1/config`，若设置了 `warehouse` 则将其作为查询参数传入。响应可以通过三种方式调整客户端配置：<sup>[5](https://iceberg.apache.org/docs/nightly/rest-protocol/)</sup>

1. **`defaults`**：服务器建议的属性；客户端自身的配置优先于它们。
2. **`overrides`**：服务器要求的属性；它们优先于客户端配置。一个常被覆盖的属性是 `prefix`，客户端将其放入后续每个请求的路径中（`/v1/{prefix}/namespaces/...`），从而使单个服务器能够服务多个目录。
3. **`endpoints`**：服务器支持的 API 端点列表。客户端只使用已公布端点的特性，因此未实现视图或扫描规划端点的服务器只会使这些特性不可用，而不会产生失败的请求。<sup>[5](https://iceberg.apache.org/docs/nightly/rest-protocol/)</sup>

如果服务器完全省略 `endpoints` 字段，客户端将假定一组默认的命名空间和表端点，包括列出、创建、加载和删除命名空间与表，注册表，上报指标，重命名表，以及提交事务。<sup>[10](https://github.com/apache/iceberg/blob/main/open-api/rest-catalog-open-api.yaml)</sup> 对于支持视图但早于端点发现机制的旧服务器，客户端属性 `view-endpoints-supported=true` 可强制启用视图支持。<sup>[2](https://iceberg.apache.org/docs/latest/rest-catalog/)</sup>

## 认证

大多数部署需要认证。客户端侧 `rest.auth.type` 属性可在 `none`、`basic`、`oauth2`、`sigv4` 和 `google` 之间选择。<sup>[2](https://iceberg.apache.org/docs/latest/rest-catalog/)</sup> 使用 OAuth2 时，客户端提供 Bearer `token`，或提供形如 `client_id:client_secret` 的 `credential` 字符串，通过客户端凭证流程交换；令牌端点 URI 默认为 `v1/oauth/tokens`，默认令牌生存期为 3,600,000 毫秒（1 小时），据此进行自动刷新。<sup>[2](https://iceberg.apache.org/docs/latest/rest-catalog/)</sup>

OpenAPI 规范中的 `POST /v1/oauth/tokens` 端点已被标记为弃用并将在未来移除；新部署应使用 `oauth2-server-uri` 属性将客户端指向外部身份提供方。<sup>[3](https://iceberglakehouse.com/iceberg/iceberg-rest-catalog-api/)</sup>

Apache Iceberg 文档警告称，`credential` 和 `token` 属于机密信息，而引擎可能在其 UI 和日志中暴露目录配置；例如 [Apache Spark](https://www.edgepedia.org/zh/apache-spark) 会在 [Environment](https://www.edgepedia.org/zh/environment) 标签页中列出配置并将其写入事件日志，因此运维人员应确认这些值已被 `spark.redaction.regex` 覆盖。<sup>[2](https://iceberg.apache.org/docs/latest/rest-catalog/)</sup>

## 提交协议与安全特性

处理表变更时，服务器会对照表当前元数据逐项检查每个要求，一旦全部满足便应用更新并生成新的元数据。<sup>[5](https://iceberg.apache.org/docs/nightly/rest-protocol/)</sup> 由于目录服务写入根元数据并拥有提交逻辑，协议能够实现客户端目录无法提供的服务端冲突消解、重试和多表提交。<sup>[9](https://iceberg.apache.org/rest-catalog-spec/)</sup>

有两项安全机制尤为突出。凭证发放允许目录下发短期存储凭证，使引擎无需自备长期凭证；观察者指出，这一特性在实践中常常决定目录的选型，因为若没有它，每个引擎都需要自己的长期存储凭证。远程签名在 1.12.0 版本中与 `POST .../tables/{table}/sign` 端点一同在规范中正式确立，它允许服务器对存储请求进行签名，而不必发放凭证。<sup>[6](https://opendatalakehouse.com/compare/catalogs/)</sup><sup> • </sup><sup>[1](https://iceberglakehouse.com/apache-iceberg-rest-catalog/)</sup>

## 规范的近期演进

1.11.0 版本于 2026-05-20 发布，包含来自 200 多位贡献者的 1,000 多次提交，项目称其为 REST 目录协议自引入以来最重要的进步。其核心是远程扫描规划：目录服务器规划表扫描并直接流式返回文件扫描任务，客户端不再需要获取清单列表和清单文件来判断读取哪些文件，从而减轻驱动端内存压力，并使服务端优化对引擎透明。该版本将远程扫描规划扩展到面向 Structured Streaming 工作负载的增量扫描以及 `history`、`snapshots` 等元数据表，新增 `/register-view` 端点将视图注册作为独立授权的能力，并将 S3 签名端点从扩展提升至主 OpenAPI 规范。<sup>[11](https://iceberg.apache.org/blog/apache-iceberg-1.11.0-release/)</sup>

1.12.0 版本于 2026 年 9 月 29 日发布，延续了这一扩展。它新增了列出和加载函数的端点（`GET /v1/{prefix}/namespaces/{ns}/functions` 及其针对单个函数的形式，在单个响应中返回所有重载），一个注销表端点，可将表从目录中分离而不删除其数据或元数据文件，携带 `Idempotency-Key`（UUIDv7）的 POST 请求的幂等重试（服务器公布 `idempotency-key-lifetime`），正式确立的远程签名配置，以及 `VariantType` 表示，使 Variant 列能够通过协议在模式中传输。<sup>[1](https://iceberglakehouse.com/apache-iceberg-rest-catalog/)</sup> 同一版本还采纳了表达式规范，为 Iceberg 提供了谓词表达式的正式、与引擎无关的定义，并使 REST OpenAPI 规范与之对齐，从而使读取限制行过滤器可跨客户端移植。<sup>[12](https://iceberg.apache.org/blog/apache-iceberg-1.12.0-release/?trk=article-ssr-frontend-pulse_little-text-block)</sup>

**读取限制。** 同样在 1.12.0 中，加载表的响应可能包含一个 `ReadRestrictions` 对象，它指定所需的列投影（如仅显示最后四个字符、将值置空、截断时间戳、哈希或用字母数字掩码等掩码操作）以及以 Iceberg 表达式表示的强制行过滤器。执行责任落在客户端，且以失败为安全取向：声称支持读取限制的读取器必须完整执行每个返回的操作和过滤器，若无法做到，则必须使查询失败，而不是返回原始、部分或空行。在 1.12.0 本身中，没有任何 Iceberg 读取器应用读取限制，因此返回 `ReadRestrictions` 对象的目录会被所有消费者静默忽略。<sup>[12](https://iceberg.apache.org/blog/apache-iceberg-1.12.0-release/?trk=article-ssr-frontend-pulse_little-text-block)</sup>

## 实践中的实现与兼容性

该规范已在湖仓生态系统中被广泛采用。[Apache Polaris](https://www.edgepedia.org/zh/apache-polaris) 实现了 Iceberg 的开放 REST API，以支持来自多种计算引擎的互操作，Dremio Open Catalog 搭载了 Polaris 实现；Databricks Unity Catalog 在其原生接口之外暴露了一个 Iceberg REST 端点；AWS 提供了两个 REST 目录——[AWS Glue](https://www.edgepedia.org/zh/aws-glue) 和 Amazon S3 Tables——均使用 SigV4 签名；[Apache Hive](https://www.edgepedia.org/zh/apache-hive) 可以提供由 Hive Metastore 支撑的 REST 目录 API。相关比较指出，开放的 REST API 正是目录可替换的关键：实现了它的目录通常可以被替换，未实现的则不能。<sup>[6](https://opendatalakehouse.com/compare/catalogs/)</sup><sup> • </sup><sup>[7](https://hive.apache.org/docs/latest/admin/iceberg-rest-catalog/)</sup><sup> • </sup><sup>[13](https://iceberglakehouse.com/posts/rest-catalog-v2-multi-table-commits/)</sup><sup> • </sup><sup>[14](https://docs.aws.amazon.com/glue/latest/dg/iceberg-rest-apis.html)</sup>

实测兼容性落后于数据手册。一份 2026 年 9 月的独立报告用一套相同的请求套件探测了七个目录实现，覆盖规范 35 个操作中的 25 个，并揭示了规范最新部分中的差异，例如某云目录拒绝未显式指定位置的建表请求，而其他目录则会推断位置；另一个目录拒绝命名空间名称中的大写字符；还有一个目录发放的凭证其底层存储策略拒绝写入。<sup>[4](https://blog.icebergdatalakehouse.com/posts/iceberg-rest-catalog-compatibility-report-2026/)</sup> 一项基于探测的 AWS 两个 REST 目录对比发现，33 项探测中有 20 项在核心操作上一致，但两个服务均未发布 `endpoints` 声明（因此能力发现不可用，客户端必须进行探测），均未实现视图，删除要求相反（Glue 禁止 `purgeRequested=true`，而 S3 Tables 要求它），且 `rename_table` 在 S3 Tables 上可用而在 Glue 上不可用。<sup>[15](https://builder.aws.com/content/3Is77qtI7rNFlnhMn4K2oGRVJAR/aws-has-two-iceberg-rest-catalogs-what-each-one-actually-serves)</sup>

为便于测试和本地使用，社区提供了 REST 兼容性套件——一个技术兼容性套件的实现，可对任何合规服务器运行 Java 参考测试套件——以及 `apache/iceberg-rest-fixture` Docker 镜像，它提供由内存目录支撑的 REST API。<sup>[8](https://github.com/apache/iceberg/blob/main/open-api/README.md)</sup><sup> • </sup><sup>[2](https://iceberg.apache.org/docs/latest/rest-catalog/)</sup>

## References

1. [Iceberg REST Catalog Spec: Endpoints, Auth, and Polaris, iceberglakehouse.com](https://iceberglakehouse.com/apache-iceberg-rest-catalog/)
2. [REST Catalog, Apache Iceberg documentation](https://iceberg.apache.org/docs/latest/rest-catalog/)
3. [Iceberg REST Catalog API Endpoints: Quick Reference, iceberglakehouse.com](https://iceberglakehouse.com/iceberg/iceberg-rest-catalog-api/)
4. [The 2026 Iceberg REST Catalog Compatibility Report, Alex Merced's Lakehouse Blog](https://blog.icebergdatalakehouse.com/posts/iceberg-rest-catalog-compatibility-report-2026/)
5. [REST Catalog Protocol, Apache Iceberg documentation (nightly)](https://iceberg.apache.org/docs/nightly/rest-protocol/)
6. [Comparing lakehouse catalogs, OpenDataLakehouse](https://opendatalakehouse.com/compare/catalogs/)
7. [Apache Hive: Iceberg REST Catalog API backed by Hive Metastore](https://hive.apache.org/docs/latest/admin/iceberg-rest-catalog/)
8. [open-api README, apache/iceberg on GitHub](https://github.com/apache/iceberg/blob/main/open-api/README.md)
9. [REST Catalog Spec, Apache Iceberg](https://iceberg.apache.org/rest-catalog-spec/)
10. [rest-catalog-open-api.yaml, apache/iceberg on GitHub](https://github.com/apache/iceberg/blob/main/open-api/rest-catalog-open-api.yaml)
11. [Apache Iceberg 1.11.0 Release, Apache Iceberg blog](https://iceberg.apache.org/blog/apache-iceberg-1.11.0-release/)
12. [Apache Iceberg 1.12.0 Release, Apache Iceberg blog](https://iceberg.apache.org/blog/apache-iceberg-1.12.0-release/?trk=article-ssr-frontend-pulse_little-text-block)
13. [How the Iceberg REST Catalog Turned Into the Lakehouse Control Plane, Alex Merced's Lakehouse Blog](https://iceberglakehouse.com/posts/rest-catalog-v2-multi-table-commits/)
14. [AWS Glue REST APIs for Apache Iceberg specifications, AWS documentation](https://docs.aws.amazon.com/glue/latest/dg/iceberg-rest-apis.html)
15. [AWS Has Two Iceberg REST Catalogs: What Each One Actually Serves, AWS Builder Center](https://builder.aws.com/content/3Is77qtI7rNFlnhMn4K2oGRVJAR/aws-has-two-iceberg-rest-catalogs-what-each-one-actually-serves)

---
*Initially written Oct 26, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 人工智能与数据 › 数据库与数据系统 › 数据挖掘、数据仓库与大数据 › 大数据概念

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/iceberg-rest-catalog-specification

English original: https://www.edgepedia.org/iceberg-rest-catalog-specification
