升级数据平面


Red Hat Data Grid 8.3

将 Data Grid 升级到 8.3

Red Hat Customer Content Services

摘要

将 Data Grid 集群从一个 8.x 版本升级到另一个版本。您可以执行滚动升级,以避免在 Data Grid 期间转换数据以获得兼容性的停机时间或离线升级。

Red Hat Data Grid

Data Grid 是一个高性能分布式内存数据存储。

无架构数据结构
将不同对象存储为键值对的灵活性。
基于网格的数据存储
旨在在集群中分发和复制数据。
弹性扩展
动态调整节点数量,以便在不中断服务的情况下满足需求。
数据互操作性
从不同端点在网格中存储、检索和查询数据。

Data Grid 文档

红帽客户门户网站中提供了 Data Grid 的文档。

Data Grid 下载

访问 红帽客户门户上的 Data Grid 软件下载。

注意

您必须有一个红帽帐户才能访问和下载数据中心软件。

使开源包含更多

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

第 1 章 Data Grid 8 升级备注

在从一个 Data Grid 8 升级到另一个版本前,请查看本节中的详情。

1.1. 升级到 Data Grid 8.3

阅读以下信息,以确保成功从以前的 Data Grid 8 升级到 8.3:

使用基于文件的缓存存储升级部署

从 Data Grid 8.3 开始,基于文件的缓存存储默认为软索引 SoftIndexFileStore,而不是单文件 SingleFileStore。在 Data Grid 8.2 及更早版本中,对于基于文件的缓存存储,single FileStore 是默认设置。

升级后,任何带有 13.0 或更高版本的 schema 版本的文件存储配置都会自动迁移到 SoftIndexFileStore

如果您从以前的版本升级到 Data Grid 8.3,且您的缓存包含带有 soft-index-file-store 元素的任何配置,您应该将该配置转换为使用 file-store 元素。有关模式更改和修改您的数据平面缓存配置的详情,请参阅迁移文档。

使用多个端点配置升级数据平面服务器部署

从 Data Grid Server 8.3 开始,您可以使用安全域配置端点,以及带有 端点 元素的 Hot Rod 或 REST 连接器。endpoint 元素 打包多个 endpoint 元素。

如果您要从 8.2 或更早版本升级 Data Grid Server,并且您的配置包含 endpoint 元素的任何子元素,则必须迁移您的配置以使用 endpoint 元素。

至少从 8.1 升级

如果要从 8.0 升级,您必须首先升级到 8.1。Data Grid 8.0 中的持久性数据与更新的版本不兼容。为了解决这个问题,Data Grid 8.2 及之后的版本会在集群启动时从 Data Grid 8.1 中自动转换现有的持久缓存存储。但是,Data Grid 不会转换 Data Grid 8.0 中的缓存存储。

第 2 章 为 Data Grid Server 集群执行滚动升级

执行 Data Grid 集群的滚动升级,以便在不停机或数据丢失的情况下在版本间有所变化,并通过 Hot Rod 协议迁移数据。

2.1. 设置目标数据平面集群

创建一个集群,它使用您要升级的 Data Grid 版本,然后使用远程缓存存储将源集群连接到目标集群。

先决条件

  • 使用目标集群所需版本安装 Data Grid Server 节点。
重要

确保目标集群的网络属性不与源集群的重叠。您应该在 JGroups 传输配置中为目标集群指定唯一的名称。根据您的环境,您还可以使用不同的网络接口和端口偏移来分隔源和目标集群。

流程

  1. 以 JSON 格式创建远程缓存存储配置,允许目标集群连接到源集群。

    目标集群上的远程缓存使用 Hot Rod 协议从源集群检索数据。

    {
      "remote-store": {
        "cache": "myCache",
        "shared": true,
        "raw-values": true,
        "security": {
          "authentication": {
            "digest": {
              "username": "username",
              "password": "changeme",
              "realm": "default"
            }
          }
        },
        "remote-server": [
          {
            "host": "127.0.0.1",
            "port": 12222
          }
        ]
      }
    }
    Copy to Clipboard Toggle word wrap
  2. 使用 Data Grid 命令行界面(CLI)或 REST API 将远程缓存存储配置添加到目标集群,以便它连接到源集群。

    • CLI:在目标集群中使用 migrate cluster connect 命令。

      [//containers/default]> migrate cluster connect -c myCache --file=remote-store.json
      Copy to Clipboard Toggle word wrap
    • REST API:使用 rolling-upgrade/source-connection 方法解释在有效负载中包含远程存储配置的 POST 请求。

      POST /v2/caches/myCache/rolling-upgrade/source-connection
      Copy to Clipboard Toggle word wrap
  3. 对要迁移的每个缓存重复前面的步骤。
  4. 将客户端切换到目标集群,以便它开始处理所有请求。

    1. 使用目标集群的位置更新客户端配置。
    2. 重启客户端。

2.2. 将数据同步到目标集群

当您设置目标 Data Grid 集群并将其连接到源集群时,目标集群可以使用远程缓存存储并按需加载数据来处理客户端请求。要完全将数据迁移到目标集群,以便您可以弃用源集群,您可以同步数据。此操作从源集群读取数据并将其写入目标集群。数据并行迁移到目标集群中的所有节点,每个节点都会获得数据的子集。您必须为每个要迁移到目标集群的缓存执行同步。

先决条件

  • 使用适当的 Data Grid 版本设置目标集群。

流程

  1. 开始使用 Data Grid 命令行界面(CLI)或 REST API 将您要迁移到目标集群的每个缓存同步。

    • CLI:使用 migrate cluster synchronize 命令。

      migrate cluster synchronize -c myCache
      Copy to Clipboard Toggle word wrap
    • REST API:使用带有 POST 请求的 ?action=sync-data 参数。

      POST /v2/caches/myCache?action=sync-data
      Copy to Clipboard Toggle word wrap

      当操作完成后,Data Grid 会使用复制到目标集群的条目总数进行响应。

  2. 断开目标集群中的每个节点与源集群的连接。

    • CLI:使用 migrate cluster disconnect 命令。

      migrate cluster disconnect -c myCache
      Copy to Clipboard Toggle word wrap
    • REST API:忽略 DELETE 请求。

      DELETE /v2/caches/myCache/rolling-upgrade/source-connection
      Copy to Clipboard Toggle word wrap

后续步骤

同步源集群中的所有数据后,滚动升级过程已完成。现在,您可以弃用源集群。

第 3 章 在缓存存储间迁移数据

Data Grid 提供了在缓存存储之间迁移数据的 Java 工具。

在升级 Data Grid 时,主版本之间的功能差异不允许缓存存储间的向后兼容性。您可以使用 StoreMigrator 转换数据,使其与目标版本兼容。

例如,升级到 Data Grid 8.0 将默认的 marshaller 改为 Protostream。在以前的版本中,缓存存储使用二进制格式,它与 marshalling 的更改不兼容。这意味着 Data Grid 8.0 无法从之前 Data Grid 版本的缓存存储中读取。

在其他情况下,Data Grid 版本弃用或删除缓存存储实现,如 JDBC Mixed 和 Binary 存储。在这些情况下,您可以使用 StoreMigrator 转换为不同的缓存存储实现。

3.1. 缓存存储 migrator

Data Grid 提供 StoreMigrator.java 工具,用于为最新的 Data Grid 缓存存储实施重新创建数据。

StoreMigrator 从以前的 Data Grid 版本作为源获取缓存存储,并使用缓存存储实施作为目标。

运行 StoreMigrator 时,它会使用 EmbededCacheManager 接口定义的缓存存储类型创建目标缓存。然后 StoreMigrator 将源存储中的条目加载到内存中,然后将它们放入目标缓存中。

StoreMigrator 还允许您将数据从一种类型的缓存存储迁移到另一个类型。例如,您可以从基于 JDBC 字符串的缓存存储迁移到 RocksDB 缓存存储。

重要

StoreMigrator 无法将数据从片段缓存存储迁移到:

  • 非分段缓存存储。
  • 分段缓存存储具有不同片段数。

3.2. 获取缓存存储 migrator

StoreMigrator 作为 Data Grid 工具库 infinispan-tools 的一部分提供,并包含在 Maven 存储库中。

流程

  • StoreMigrator 配置 pom.xml,如下所示:

    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
    
        <groupId>org.infinispan.example</groupId>
        <artifactId>jdbc-migrator-example</artifactId>
        <version>1.0-SNAPSHOT</version>
    
        <dependencies>
          <dependency>
            <groupId>org.infinispan</groupId>
            <artifactId>infinispan-tools</artifactId>
          </dependency>
          <!-- Additional dependencies -->
        </dependencies>
    
        <build>
          <plugins>
            <plugin>
              <groupId>org.codehaus.mojo</groupId>
              <artifactId>exec-maven-plugin</artifactId>
              <version>1.2.1</version>
              <executions>
                <execution>
                  <goals>
                    <goal>java</goal>
                  </goals>
                </execution>
              </executions>
              <configuration>
                <mainClass>org.infinispan.tools.store.migrator.StoreMigrator</mainClass>
                <arguments>
                  <argument>path/to/migrator.properties</argument>
                </arguments>
              </configuration>
            </plugin>
          </plugins>
        </build>
    </project>
    Copy to Clipboard Toggle word wrap

3.3. 配置缓存存储 migrator

为源和目标缓存设置属性,存储在 migrator.properties 文件中。

流程

  1. 创建 migrator.properties 文件。
  2. migrator.properties 中配置源缓存存储。

    1. 使用 source 添加所有配置属性,如下例所示:

      source.type=SOFT_INDEX_FILE_STORE
      source.cache_name=myCache
      source.location=/path/to/source/sifs
      source.version=<version>
      Copy to Clipboard Toggle word wrap
  3. migrator.properties 中配置目标缓存存储。

    1. 使用 target. 前缀所有配置属性,如下例所示:

      target.type=SINGLE_FILE_STORE
      target.cache_name=myCache
      target.location=/path/to/target/sfs.dat
      Copy to Clipboard Toggle word wrap

3.3.1. 缓存存储 migrator 的配置属性

StoreMigrator 属性中配置源和目标缓存存储。

Expand
表 3.1. 缓存存储类型属性
属性描述必填/选填

type

指定源或目标的缓存存储类型。

.type=JDBC_STRING

.type=JDBC_BINARY

.type=JDBC_MIXED

.type=LEVELDB

.type=ROCKSDB

.type=SINGLE_FILE_STORE

.type=SOFT_INDEX_FILE_STORE

.type=JDBC_MIXED

必填

Expand
表 3.2. 常见属性
属性描述值示例必填/选填

cache_name

命名存储后端的缓存。

.cache_name=myCache

必填

segment_count

指定可以使用分段的目标缓存存储的片段数。

片段数量必须与 Data Grid 配置中的 cluster.hash.numSegments 匹配。

换句话说,缓存存储的片段数量必须与对应缓存的片段数匹配。如果片段数量不同,Data Grid 无法从缓存存储中读取数据。

.segment_count=256

选填

Expand
表 3.3. JDBC 属性
属性描述必填/选填

dialect

指定底层数据库的分割。

必填

version

指定源缓存存储的 marshaller 版本。
设置以下值之一:

Data Grid 7.2.x 的 slirp 8

Data Grid 7.3.x 发行 9

* 10 for Data Grid 8.0.x

Data Grid 8.1.x 的 slirp 11

Data Grid 8.2.x 的 slirp 12

Data Grid 8.3.x 的 slirp 13

只适用于源存储。

marshaller.class

指定自定义 marshaller 类。

使用自定义 marshallers 时需要此项。

marshaller.externalizers

指定以以下格式载入的自定义 AdvancedExternalizer 实现的逗号分隔列表: [id]:<Externalizer class>

选填

connection_pool.connection_url

指定 JDBC 连接 URL。

必填

connection_pool.driver_class

指定 JDBC 驱动程序的类。

必填

connection_pool.username

指定数据库用户名。

必填

connection_pool.password

指定数据库用户名的密码。

必填

db.major_version

设置数据库主版本。

选填

db.minor_version

设置数据库次要版本。

选填

db.disable_upsert

禁用数据库 upsert。

选填

db.disable_indexing

指定是否创建了表索引。

选填

table.string.table_name_prefix

指定表名称的额外前缀。

选填

table.string.<id|data|timestamp>.name

指定列名称。

必填

table.string.<id|data|timestamp>.type

指定列类型。

必填

key_to_string_mapper

指定 two WayKey2StringMapper 类。

选填

注意

要从二进制缓存迁移到旧的 Data Grid 版本中,请在以下属性中将 table.string 变为 table.binary.\ the :

  • source.table.binary.table_name_prefix
  • source.table.binary.<id\|data\|timestamp>.name
  • source.table.binary.<id\|data\|timestamp>.type
# Example configuration for migrating to a JDBC String-Based cache store
target.type=STRING
target.cache_name=myCache
target.dialect=POSTGRES
target.marshaller.class=org.example.CustomMarshaller
target.marshaller.externalizers=25:Externalizer1,org.example.Externalizer2
target.connection_pool.connection_url=jdbc:postgresql:postgres
target.connection_pool.driver_class=org.postrgesql.Driver
target.connection_pool.username=postgres
target.connection_pool.password=redhat
target.db.major_version=9
target.db.minor_version=5
target.db.disable_upsert=false
target.db.disable_indexing=false
target.table.string.table_name_prefix=tablePrefix
target.table.string.id.name=id_column
target.table.string.data.name=datum_column
target.table.string.timestamp.name=timestamp_column
target.table.string.id.type=VARCHAR
target.table.string.data.type=bytea
target.table.string.timestamp.type=BIGINT
target.key_to_string_mapper=org.infinispan.persistence.keymappers. DefaultTwoWayKey2StringMapper
Copy to Clipboard Toggle word wrap
Expand
表 3.4. RocksDB 属性
属性描述必填/选填

位置

设置数据库目录。

必填

compression

指定要使用的压缩类型。

选填

# Example configuration for migrating from a RocksDB cache store.
source.type=ROCKSDB
source.cache_name=myCache
source.location=/path/to/rocksdb/database
source.compression=SNAPPY
Copy to Clipboard Toggle word wrap
Expand
表 3.5. SingleFileStore 属性
属性描述必填/选填

位置

设置包含缓存存储 .dat 文件的目录。

必填

# Example configuration for migrating to a Single File cache store.
target.type=SINGLE_FILE_STORE
target.cache_name=myCache
target.location=/path/to/sfs.dat
Copy to Clipboard Toggle word wrap
Expand
表 3.6. SoftIndexFileStore 属性
属性描述

必填/选填

位置

设置数据库目录。

必填

index_location

设置数据库索引目录。

# Example configuration for migrating to a Soft-Index File cache store.
target.type=SOFT_INDEX_FILE_STORE
target.cache_name=myCache
target.location=path/to/sifs/database
target.location=path/to/sifs/index
Copy to Clipboard Toggle word wrap

3.4. 迁移数据平面缓存存储

运行 StoreMigrator,将数据从一个缓存存储迁移到另一个缓存存储中。

先决条件

  • 获取 infinispan-tools.jar
  • 创建 migrator.properties 文件来配置源和目标缓存存储。

流程

  • 如果从源构建 infinispan-tools.jar,请执行以下操作:

    1. 将您的源和目标数据库(如 JDBC 驱动程序)的 infinispan-tools.jar 和依赖项添加到您的 classpath 中。
    2. 指定 migrator.properties 文件作为 StoreMigrator 的参数。
  • 如果您从 Maven 存储库拉取 infinispan-tools.jar,请运行以下命令:

    mvn exec:java

法律通告

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