第 2 章 为 Data Grid 服务器执行滚动升级
执行数据网格集群的滚动升级,以便在版本之间更改,而不会停机或数据丢失。滚动升级通过 Hot Rod 将您的数据同时迁移到目标版本。
2.1. 设置目标集群
创建一个运行目标 Data Grid 版本的集群,并使用远程缓存存储从源集群加载数据。
先决条件
- 使用目标升级版本安装 Data Grid 集群。
重要
确保目标集群的网络属性不会与源集群的网络属性重叠。您应该在 JGroups 传输配置中为目标和源集群指定唯一名称。根据您的环境,您还可以使用不同的网络接口并指定端口偏移来保持目标和源集群分开。
流程
在目标集群上为您要从源集群迁移的每个缓存添加一个
RemoteCacheStore
。远程缓存存储使用 Hot Rod 协议从远程网格集群检索数据。将远程缓存存储添加到目标集群时,它可以从源集群中完全加载数据来处理客户端请求。
将客户端切换到目标集群,以便它开始处理所有请求。
- 使用目标集群的位置更新客户端配置。
- 重新启动客户端。
2.1.1. Rolling 升级的远程缓存存储
您必须使用特定的远程缓存存储配置来执行滚动升级,如下所示:
<!-- Remote cache stores for rolling upgrades must disable passivation. --> <persistence passivation="false"> <!-- The value of the cache attribute matches the name of a cache in the source cluster. Target clusters load data from this cache using the remote cache store. --> <!-- The "protocol-version" attribute matches the Hot Rod protocol version of the source cluster. 2.5 is the minimum version and is suitable for any upgrade path. --> <!-- You should enable segmentation for remote cache stores only if the number of segments in the target cluster matches the number of segments for the cache in the source cluster. --> <remote-store xmlns="urn:infinispan:config:store:remote:12.1" cache="myDistCache" protocol-version="2.5" hotrod-wrapping="true" raw-values="true" segmented="false"> <!-- Configures authentication and encryption according to the security realm of the source cluster. --> <security> <authentication server-name="infinispan"> <digest username="admin" password="changeme" realm="default"/> </authentication> </security> <!-- Points to the location of the source cluster. --> <remote-server host="127.0.0.1" port="11222"/> </remote-store> </persistence>