恢复失败的集群
如何使用集群配置文件和数据库数据来恢复失败的集群。
Redis 企业软件 |
---|
当 Redis Enterprise Software 集群发生故障时, 您必须使用集群配置文件和数据库数据来恢复集群。
集群故障可能由以下原因引起:
- 导致集群对客户端请求或管理作无响应的硬件或软件故障。
- 超过一半的集群节点失去与集群的连接,从而导致仲裁丢失。
要恢复集群并按照故障发生前的方式重新创建它,
您必须恢复集群配置ccs-redis.rdb
添加到集群节点。
要恢复新集群中的数据库,您必须从持久性文件(如备份文件、仅附加文件 (AOF) 或 RDB 快照)还原数据库。
这些文件存储在持久存储位置。
集群恢复过程包括:
- 在新集群的节点上安装 Redis Enterprise Software。
- 将包含恢复文件从原始集群的持久性存储挂载到新集群的节点。
- 恢复新集群中第一个节点上的集群配置。
- 将其余节点加入新集群。
- 恢复数据库。
先决条件
- 我们建议您恢复集群以清理节点。 如果使用原始节点, 确保新集群中的任何节点上都没有正在运行的 Redis 进程。
- 我们建议您为新集群使用干净的持久性存储驱动器。 如果您使用原始存储驱动器, 确保将原始存储驱动器上的文件备份到安全位置。
- 确定要用作已恢复集群的配置的集群配置文件。
集群配置文件为
/css/ccs-redis.rdb
在每个节点的持久性存储上。
恢复集群
-
(可选)如果要将集群恢复到原始集群节点,请从节点中卸载 Redis Enterprise Software。
-
在新的集群节点上安装 Redis Enterprise Software。
新服务器必须具有与原始服务器相同的基本硬件和软件配置,包括:
- 相同数量的节点
- 至少相同数量的内存
- 相同的 Redis Enterprise Software 版本
- 相同的安装用户和路径
注意:如果不满足这些要求,集群恢复可能会失败。 -
将包含恢复文件的持久性存储驱动器挂载到新节点。 这些驱动器必须包含集群配置备份文件和数据库持久性文件。
注意:确保用户 redislabs 有权访问存储位置 的配置和持久性文件。如果您使用本地持久性存储,请将所有恢复文件放在每个集群节点上。
-
要恢复原始集群配置,请运行
rladmin cluster recover
在新集群的第一个节点上:rladmin cluster recover filename [ <persistent_path> | <ephemeral_path> ]<filename> node_uid <node_uid> rack_id <rack_id>
For example:
rladmin cluster recover filename /tmp/persist/ccs/ccs-redis.rdb node_uid 1 rack_id 5
When the recovery command succeeds, this node is configured as the node from the old cluster that has ID 1.
-
To join the remaining servers to the new cluster, run
rladmin cluster join
from each new node:rladmin cluster join nodes <cluster_member_ip_address> username <username> password <password> replace_node <node_id>
For example:
rladmin cluster join nodes 10.142.0.4 username admin@example.com password mysecret replace_node 2
-
Run
rladmin status
to verify the recovered nodes are now active and the databases are pending recovery:rladmin status
Note:Make sure that you update your DNS records with the IP addresses of the new nodes.
After the cluster is recovered, you must recover the databases.
On this page