4.4. 使用 Apicurio Registry REST API 命令导出和导入 registry 数据


作为管理员,您可以使用 Core Registry API v2 将数据从一个 Apicurio Registry 实例导出数据,并导入到另一个 Apicurio Registry 实例,以便您可以在不同实例之间迁移数据。

本节展示了使用 Core Registry API v2 的简单基于 curl 的示例,以 .zip 格式导出并导入一个 Apicurio Registry 实例的现有数据。Apicurio Registry 实例中包含的所有工件数据都会在 .zip 文件中导出。

注意

您只能导入从另一个 Apicurio Registry 实例导出的 Apicurio Registry 数据。

前提条件

  • Apicurio Registry 在您的环境中安装并运行。
  • 已创建 Apicurio Registry 实例:

    • 要从中导出数据的源实例至少包含一个 schema 或 API 工件。
    • 要将数据导入的目标实例为空,以保留唯一的 ID。

流程

  1. 从现有源 Apicurio Registry 实例导出 Apicurio Registry 数据:

    $ curl MY-REGISTRY-URL/apis/registry/v2/admin/export \
      -H "Authorization: Bearer $ACCESS_TOKEN" \
      --output my-registry-data.zip
    Copy to Clipboard Toggle word wrap

    MY-REGISTRY-URL 是在其上部署源 Apicurio Registry 的主机名。例如: my-cluster-source-registry-myproject.example.com

  2. 将 registry 数据导入到目标 Apicurio Registry 实例中:

    $ curl -X POST "MY-REGISTRY-URL/apis/registry/v2/admin/import" \
      -H "Content-Type: application/zip" -H "Authorization: Bearer $ACCESS_TOKEN" \
      --data-binary @my-registry-data.zip
    Copy to Clipboard Toggle word wrap

    MY-REGISTRY-URL 是部署目标 Apicurio Registry 的主机名。例如: my-cluster-target-registry-myproject.example.com

返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat