背景
Redis 集群是业务存储热数据的重要组件,为保证业务的可用性,依靠集群内节点之间的 Gossip 协议来进行节点状态的判断,默认的心跳超时时间 (cluster-node-timeout) 为15s。如果此故障节点为主节点时,腾讯云Redis将采取故障切换机制,将重新从备节点选举新的主节点。
腾讯云混沌演练平台基于以上特性,提供手动方式跨过节点故障阶段直接模拟HA策略的故障动作,您可通过该手动故障方式模拟当 Redis 集群发生故障切换机制的短时间内对业务的影响。
演练实施
演练准备
准备一台多节点跨 AZ 属性的 Redis 实例。
演练步骤
步骤1:创建演练
![](https://qcloudimg.tencent-cloud.cn/image/document/029b3f1c5c7a9028d0c6d24d58c1528f.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/029b3f1c5c7a9028d0c6d24d58c1528f.png)
步骤2:添加动作
根据模拟的容灾场景灵活选择主备切换模式:
优先同可用区切换
模拟主节点发生故障时,腾讯云Redis真实HA策略场景:数据最新节点优先提主;数据相同时优先同可用区其他节点选举。
优先跨可用区切换
模拟可用区整体故障时,其他可用区节点提主场景。
![](https://qcloudimg.tencent-cloud.cn/image/document/9ef8c63504c684ee670184992a64a0c7.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/9ef8c63504c684ee670184992a64a0c7.png)
步骤3:执行演练动作
1. 执行演练
![](https://qcloudimg.tencent-cloud.cn/image/document/e51ba8a89d4c723adae53e45f295acf6.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/e51ba8a89d4c723adae53e45f295acf6.png)
2. MFA 校验
![](https://qcloudimg.tencent-cloud.cn/image/document/ffa7648322bdf9f2ccb832cb77e43307.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/ffa7648322bdf9f2ccb832cb77e43307.png)
3. 执行演练动作
![](https://qcloudimg.tencent-cloud.cn/image/document/8c0609d3312fe3641d8339f5e694c32a.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/8c0609d3312fe3641d8339f5e694c32a.png)
结果观测
故障前节点状态信息
以优先跨可用区模式为例,观察注入故障前后可用区是否变更。
![](https://qcloudimg.tencent-cloud.cn/image/document/93baa4f6eaffe8b6d526b82c1efcfe98.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/93baa4f6eaffe8b6d526b82c1efcfe98.png)
故障后节点状态信息
![](https://qcloudimg.tencent-cloud.cn/image/document/36e86c510fc0dc58654c67cb103b69d2.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/36e86c510fc0dc58654c67cb103b69d2.png)