背景
云顾问 - 混沌演练提供模拟云数据库 TDSQL-C 主备切换的场景故障动作,可以验证您的业务 TDSQL-C 整体高可用能力。
进行主备切换演练,旨在帮助开发人员在更加复杂和真实的环境中进行系统测试和实验,以发现可能存在的问题和风险。通过混沌工程的实验和测试,开发人员可以更加全面地了解系统的工作方式和性能特征,并针对不同的故障场景制定相应的应对措施和策略,从而提高系统的稳定性和可用性。
注意:
环境检测不通过示例:
![](https://qcloudimg.tencent-cloud.cn/image/document/4954680e857800e508edaa8b0093faec.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/4954680e857800e508edaa8b0093faec.png)
实例部署方式调整示例
:1. 登录 TDSQL-C 控制台 ,单击集群列表,选中单 AZ 的实例。
![](https://qcloudimg.tencent-cloud.cn/image/document/9e310e73ee264caa844faf442b937b55.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/9e310e73ee264caa844faf442b937b55.png)
2. 单击实例信息中的部署方式的编辑图标。
![](https://qcloudimg.tencent-cloud.cn/image/document/be5dd056d04fae609140f3e9e050c14d.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/be5dd056d04fae609140f3e9e050c14d.png)
3. 在弹框中选中多可用区部署(是),并配置多可用区配置,随后单击确认。
![](https://qcloudimg.tencent-cloud.cn/image/document/b00aed5e3d052d3bc0b9494878347111.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/b00aed5e3d052d3bc0b9494878347111.png)
演练实施
步骤一:演练准备
一台跨 AZ 部署的 TDSQL-C 实例。关注其主节点、备节点所在可用区。
![](https://qcloudimg.tencent-cloud.cn/image/document/09b86aaf52be3d1c7556177c2c967ddd.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/09b86aaf52be3d1c7556177c2c967ddd.png)
步骤二:演练编排
1. 登录 云顾问 > 混沌演练控制台,进入演练管理页面,单击新建演练。
2. 单击跳过,新建空白演练。
![](https://qcloudimg.tencent-cloud.cn/image/document/1cfa89c7ceeaac9cfd4f254c076deb62.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/1cfa89c7ceeaac9cfd4f254c076deb62.png)
3. 填写演练信息,选择对象类型 TDSQL-C。
![](https://qcloudimg.tencent-cloud.cn/image/document/bd5d59338018d974281e6467308b414b.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/bd5d59338018d974281e6467308b414b.png)
4. 添加实例并添加故障动作。
![](https://qcloudimg.tencent-cloud.cn/image/document/dd5a47ac0a3e55993aeb0d4d5019fe3c.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/dd5a47ac0a3e55993aeb0d4d5019fe3c.png)
5. 添加主备切换演练动作。该故障不需要配置参数,点击下一步。
![](https://qcloudimg.tencent-cloud.cn/image/document/1d735ef75700b93b41319ea9f8a9e7e2.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/1d735ef75700b93b41319ea9f8a9e7e2.png)
6. 单击下一步,配置演练编排方式,及可选配置护栏策略监控指标等,随后点击提交创建演练。
![](https://qcloudimg.tencent-cloud.cn/image/document/a30a815fe2810381f865c19b480d7cc5.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/a30a815fe2810381f865c19b480d7cc5.png)
步骤三:执行演练
![](https://qcloudimg.tencent-cloud.cn/image/document/92ebcd9fe30c1a35f1ed260176218c0b.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/92ebcd9fe30c1a35f1ed260176218c0b.png)
进入演练详情,单击执行,开始执行演练。
![](https://qcloudimg.tencent-cloud.cn/image/document/9d87800c965bfdcee05a23d9ebd09a5a.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/9d87800c965bfdcee05a23d9ebd09a5a.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/b9082a99dfb7fa0b6c78b7d7a056881e.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/b9082a99dfb7fa0b6c78b7d7a056881e.png)
故障注入过程中,可通过 TDSQL-C 控制台观测到切换状态。
![](https://qcloudimg.tencent-cloud.cn/image/document/f30c6542b614bf6a2a0d95f43a0d7ef3.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/f30c6542b614bf6a2a0d95f43a0d7ef3.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/ad83a4bcf56411ea36f16ba0101636ed.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/ad83a4bcf56411ea36f16ba0101636ed.png)
执行故障恢复动作。将实例部署状态恢复至故障前状态。
![](https://qcloudimg.tencent-cloud.cn/image/document/3a1210dba497dc535294dfd469683eba.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/3a1210dba497dc535294dfd469683eba.png)
恢复成功之后,可在控制台观测到节点状态已经恢复至故障前状态。
![](https://qcloudimg.tencent-cloud.cn/image/document/5f1aa4588e0682328fa65fa96f5785a2.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/5f1aa4588e0682328fa65fa96f5785a2.png)