迁移 Service Registry 部署


Red Hat Integration 2023.q2

从 Service Registry 版本 1.1 迁移到 2.4

Red Hat Integration Documentation Team

摘要

本指南描述了 Service Registry 版本 2.x 的主要更改,并解释了如何将现有 Service Registry 版本 1.1 部署迁移到版本 2.4。

前言

使开源包含更多

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。我们从这四个术语开始:master、slave、黑名单和白名单。由于此项工作十分艰巨,这些更改将在即将推出的几个发行版本中逐步实施。有关更多详情,请参阅我们的首席技术官 Chris Wright 提供的消息

对红帽文档提供反馈

我们感谢您对我们文档的反馈。要提供反馈,请突出显示文档中的文本并添加注释。

先决条件

  • 已登陆到红帽客户门户网站。
  • 在红帽客户门户网站中,文档采用 Multi-page HTML 查看格式。

流程

要提供反馈,请执行以下步骤:

  1. 点文档右上角的反馈按钮查看现有的反馈。

    注意

    反馈功能仅在多页 HTML 格式中启用。

  2. 高亮标记您要提供反馈的文档中的部分。
  3. 点在高亮文本旁弹出的 Add Feedback

    文本框将在页面右侧的"反馈"部分中打开。

  4. 在文本框中输入您的反馈,然后点 Submit

    创建了一个与文档相关的问题。

  5. 要查看问题,请点击反馈视图中的问题链接。

第 1 章 从 Service Registry 1.1 迁移到 2.x

Service Registry 2.x 包括破坏之前 Service Registry 1.1 发行版本中更改的新功能。本节论述了 Service Registry 1.1 和版本 2.x 之间的主要变化。

由于 2.x 中的破坏变化,因此不需要自动升级且迁移过程。这包括将现有 registry 中的数据移到新 registry 中。您还必须查看现有的 registry 客户端应用程序并更新其配置以满足新要求。

当迁移到 2.x 版本时,您必须考虑以下主要更改:

1.1. 新数据存储选项

Service Registry 1.1 (jpainfinispan)中的现有 registry 数据存储选项已被版本 2.x 中的新存储选项(sqlkafkasql)替代。这些新存储选项提供更强大的、性能且可维护的 Service Registry 部署。

有关如何使用您选择的存储选项部署 Service Registry 2.x 的详情,请参阅在 OpenShift 上安装和部署 Service Registry

1.2. 新的 v2 REST API

Service Registry 2.x 包括了一个新的 REST API,支持工件组,改进了长期可维护性。Service Registry 仍然支持原始 registry v1 REST API 和兼容性 API,如 Confluent 和 IBM schema registry API。Service Registry 现在也实现了 CNCF Cloud Events 规格中提供的 Schema Registry 规格。

1.3. 重构了 Java 客户端库

  • Service Registry Java 客户端类在名为 apicurio-registry-client 的不同 Maven 模块中提供 2.x 版本。
  • Kafka 客户端序列化器和反序列化器(SerDes)类以三个不同的 Maven 模块在 2.x 版本中提供,每个支持的数据格式对应一种:Apache Avro、Protobuf 和 JSON Schema。现在,您只能在不拉取不关注的传输依赖项的情况下使用您想要的模块。

第 2 章 迁移 Service Registry 数据

将数据迁移到 Service Registry 2.x 需要从现有 1.1 部署中导出所有数据,并将其导入到新的 2.x 部署中。如果您使用 Service Registry 作为 Kafka 应用程序的 schema registry,则数据迁移至关重要,因为每个 Kafka 消息都执行存储在 Service Registry 中的模式的全局标识符。此标识符必须在 registry 数据迁移过程中保留。

Service Registry 2.x 提供了一个 API,用于批量导入/导出 registry 部署中的所有数据,这样可保证从现有 registry 导入数据时保留所有标识符。导出 API 下载包含工件信息的自定义 .zip 文件。导入 API 接受此 .zip,并将所有工件加载到单个批处理中的 registry 中。

Service Registry 1.1 不提供导入/导出 API。但是,版本 2.x 提供了一个与 Service Registry 1.1 兼容的导出工具,用于导出 .zip,您可以导入到 2.x registry。此工具使用通用现有 API 来导出 registry 中的所有内容。但是,它的性能比 2.x 导出 API 少,且仅在从 1.1 registry 导出时使用。

先决条件

  • 运行您要从中导出的 1.1 服务器的 Service Registry 实例,以及您要导入到的 2.x 服务器。
  • 从红帽客户门户网站下载 Service Registry exportV1 工具。这是一个 Java 应用程序,您可以在命令行中运行。

流程

  1. 使用 exportV1 工具导出 Service Registry 1.1 中的所有数据。这会在当前目录中生成 registry-export.zip 文件:

    java -jar apicurio-registry-utils-exportV1-2.4.3.Final-redhat-00006.jar http://old-registry.my-company.com/api
    Copy to Clipboard Toggle word wrap
  2. 使用导入 API 将 .zip 文件导入到 Service Registry 2.x 中:

    curl -X POST "http://new-registry.my-company.com/apis/registry/v2/admin/import" \
      -H "Accept: application/json" -H "Content-Type: application/zip" \
      --data-binary @registry-export.zip
    Copy to Clipboard Toggle word wrap
  3. 运行这些命令并比较 count 字段,检查所有工件是否已导入到新的 2.x registry 中:

    curl "http://old-registry.my-company.com/api/search/artifacts"
    Copy to Clipboard Toggle word wrap
    curl "http://new-registry.my-company.com/apis/registry/v2/search/artifacts"
    Copy to Clipboard Toggle word wrap

第 3 章 迁移 Service Registry 客户端应用程序

您必须检查现有的 Service Registry 客户端应用程序,以确保 Maven 依赖项和 Java 客户端配置满足版本 2.x 的新要求。例如,这包括 Service Registry Java REST 客户端库或 Kafka 客户端序列化器/反序列化器(Serdes)库的新 Maven 依赖项。您还必须使用新的 registry v2 API 路径更新 Java 应用程序配置。

先决条件

  • 现有 Service Registry 1.1 Java 客户端应用程序或 Kafka 客户端制作者,以及带有 SerDes 的消费者 Java 应用程序

流程

  1. 如果使用 Service Registry Java REST 客户端,您必须更改 Service Registry Java 客户端库的 Maven 依赖项,该库已在 2.x 版本中重新打包:

    <dependency>
        <groupId>io.apicurio</groupId>
        <artifactId>apicurio-registry-client</artifactId>
        <version>2.4.3.Final-redhat-00006</version>
    </dependency>
    Copy to Clipboard Toggle word wrap
  2. 在 Java 客户端应用程序中,您必须更改 registry URL 配置,使其从指向现有的 v1 API 路径到新的 v2 路径。例如:

    public class ClientExample {
    
        private static final RegistryRestClient client;
    
         public static void main(String[] args) throws Exception {
            // Create a registry client
            String registryUrl = "https://new-registry.my-company.com/apis/registry/v2";
            RegistryClient client = RegistryClientFactory.create(registryUrl);
        }
    }
    Copy to Clipboard Toggle word wrap

    您可以在 Service Registry 用户指南 中找到有关 Java 客户端的更多详细信息。

  3. 如果使用 Service Registry SerDes 库,您必须更改 Maven 依赖项,该依赖项已在 2.x 版本中重新打包。在 Service Registry 1.1 中,SerDes 库仅提供了一个 Maven 依赖项:

    <dependency>
        <groupId>io.apicurio</groupId>
        <artifactId>apicurio-registry-utils-serde</artifactId>
        <version>1.3.2.Final-redhat-00002</version>
    </dependency>
    Copy to Clipboard Toggle word wrap

    在 Service Registry 2.x 中,SerDes 库被分成三个 Maven 依赖项,每个支持的数据格式一个: avroprotobufjson 模式,取决于您的用例:

    <dependency>
        <groupId>io.apicurio</groupId>
        <artifactId>apicurio-registry-serdes-avro-serde</artifactId>
        <version>2.4.3.Final-redhat-00006</version>
    </dependency>
    <dependency>
        <groupId>io.apicurio</groupId>
        <artifactId>apicurio-registry-serdes-protobuf-serde</artifactId>
        <version>2.4.3.Final-redhat-00006</version>
    </dependency>
    <dependency>
        <groupId>io.apicurio</groupId>
        <artifactId>apicurio-registry-serdes-jsonschema-serde</artifactId>
        <version>2.4.3.Final-redhat-00006</version>
    </dependency>
    Copy to Clipboard Toggle word wrap
  4. 在 Kafka producer 和消费者 Java 应用程序中,您必须更改 registry URL 配置,使其从指向现有的 v1 API 路径。例如:

    现有 registry v1 API 路径

    props.putIfAbsent(AbstractKafkaSerDe.REGISTRY_URL_CONFIG_PARAM, "http://old-registry.my-company.com/api");
    Copy to Clipboard Toggle word wrap

    新的 registry v2 API 路径

    props.putIfAbsent(SerdeConfig.REGISTRY_URL, "http://new-registry.my-company.com/apis/registry/v2");
    Copy to Clipboard Toggle word wrap

    重构的 SerDes 库还包括对配置属性的其他重要更改。有关 SerDes 配置的详情,请参阅 Service Registry 用户指南

附录 A. 使用您的订阅

Service Registry 通过软件订阅提供。要管理您的订阅,请访问红帽客户门户中的帐户。

访问您的帐户

  1. 转至 access.redhat.com
  2. 如果您还没有帐户,请创建一个帐户。
  3. 登录到您的帐户。

激活订阅

  1. 转至 access.redhat.com
  2. 导航到 My Subscriptions
  3. 导航到 激活订阅 并输入您的 16 位激活号。

下载 ZIP 和 TAR 文件

要访问 ZIP 或 TAR 文件,请使用客户门户网站查找下载的相关文件。如果您使用 RPM 软件包,则不需要这一步。

  1. 打开浏览器并登录红帽客户门户网站 产品下载页面,网址为 access.redhat.com/downloads
  2. Integration and Automation 类别中找到 Red Hat Integration 条目。
  3. 选择所需的 Service Registry 产品。此时会打开 Software Downloads 页面。
  4. 单击组件的 Download 链接。

更新于 2023-09-19

法律通告

Copyright © 2023 Red Hat, Inc.
The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/by-sa/3.0/. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, the Red Hat logo, JBoss, OpenShift, Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.
Linux® is the registered trademark of Linus Torvalds in the United States and other countries.
Java® is a registered trademark of Oracle and/or its affiliates.
XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.
MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries.
Node.js® is an official trademark of Joyent. Red Hat is not formally related to or endorsed by the official Joyent Node.js open source or commercial project.
The OpenStack® Word Mark and OpenStack logo are either registered trademarks/service marks or trademarks/service marks of the OpenStack Foundation, in the United States and other countries and are used with the OpenStack Foundation's permission. We are not affiliated with, endorsed or sponsored by the OpenStack Foundation, or the OpenStack community.
All other trademarks are the property of their respective owners.
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

Theme

© 2025 Red Hat