背景
负载均衡作为一个代理,一般服务于被代理的各种业务服务,提供了一种廉价有效透明的方法扩展网络设备和服务器的带宽、增加吞吐量、加强网络数据处理能力、提高网络的灵活性和可用性。
作为网络传输的关键一环,腾讯云混沌演练平台为您提供了对 CLB 停止的能力,协助您实现实例不可用或者监听器不可用。
故障原理
对 CLB 注入停止故障,造成实例停止或者监听器停止,导致客户端访问服务失败。
演练实施
演练准备
创建私有网络,在该网络内部署一台 CVM 和 CLB 实例,CVM 实例部署测试服务,CLB 实例创建监听器监听 CVM 服务端口。
演练步骤
步骤1:创建演练
1. 登录 混沌演练控制台,进入演练管理页面创建演练,添加实例。
![](https://qcloudimg.tencent-cloud.cn/image/document/e66a46ba8e26e8bb809c3e7dc4cbea92.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/e66a46ba8e26e8bb809c3e7dc4cbea92.png)
2. 添加动作。平台为您提供 CLB 停止故障动作。
![](https://qcloudimg.tencent-cloud.cn/image/document/15e5653835a00845cc3586024acb46d5.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/15e5653835a00845cc3586024acb46d5.png)
提供三种停止对象,分别是负载均衡实例、四层监听器、七层监听器。
![](https://qcloudimg.tencent-cloud.cn/image/document/24e73ffbee8e40d02858b2294f012f61.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/24e73ffbee8e40d02858b2294f012f61.png)
步骤3:执行演练动作
单击执行下发故障动作,登入同 VPC 实例,分析业务服务响应。
结果观测
停止对象:负载均衡实例
![](https://qcloudimg.tencent-cloud.cn/image/document/4fb7c161ba2c8b7b624ce52f117e55a4.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/4fb7c161ba2c8b7b624ce52f117e55a4.png)
稳态表现,通过 curl 对应服务,正常响应。
![](https://qcloudimg.tencent-cloud.cn/image/document/9aedb9701c8c4e186a510290fba5ac53.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/9aedb9701c8c4e186a510290fba5ac53.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/c02182d2587086a55fac68e5b77cc7eb.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/c02182d2587086a55fac68e5b77cc7eb.png)
故障注入后,通过 curl 对应服务,没有响应。
![](https://qcloudimg.tencent-cloud.cn/image/document/af9b7df53489a7971048720c1c87a29c.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/af9b7df53489a7971048720c1c87a29c.png)
停止对象:四层路径监听器
稳态表现,通过 curl 对应规则匹配到的监听器服务,正常响应。
![](https://qcloudimg.tencent-cloud.cn/image/document/678af3d6fdaba1d5d852c6565206bbff.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/678af3d6fdaba1d5d852c6565206bbff.png)
故障注入后,curl 对应规则匹配到的监听器服务,没有响应。
![](https://qcloudimg.tencent-cloud.cn/image/document/25777caf5e26c86f811d376ce169b26d.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/25777caf5e26c86f811d376ce169b26d.png)
停止对象:七层路径监听器
稳态表现,通过 curl 对应规则匹配到的监听器服务,正常响应。
![](https://qcloudimg.tencent-cloud.cn/image/document/9f09e311d5f383697c30d22a765abd72.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/9f09e311d5f383697c30d22a765abd72.png)
故障注入后,curl 对应规则匹配到的监听器服务,没有响应。
![](https://qcloudimg.tencent-cloud.cn/image/document/9593efe0887031a2a376e754b1d460b9.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/9593efe0887031a2a376e754b1d460b9.png)
长链接结果观测(ssh 模拟长链接)
稳态表现,客户端正常访问,并且可以输入操作命令。
![](https://qcloudimg.tencent-cloud.cn/image/document/1104b24fbc9a8dd85fcbf6d3d8e38bcc.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/1104b24fbc9a8dd85fcbf6d3d8e38bcc.png)
稳态表现,在服务端通过
netstat -tu
可以看到和客户端的长链接。![](https://qcloudimg.tencent-cloud.cn/image/document/e5f78d2d86acd662eae324eb4c103dfb.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/e5f78d2d86acd662eae324eb4c103dfb.png)
故障注入后,原有客户端已经无法访问,此时已经不能输入命令。
![](https://qcloudimg.tencent-cloud.cn/image/document/65bdaa4d704b8636daaae7d302dcbff9.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/65bdaa4d704b8636daaae7d302dcbff9.png)
故障注入后,建立新的长链接没有响应。
![](https://qcloudimg.tencent-cloud.cn/image/document/00c374e7c5f24939bb05656149daa830.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/00c374e7c5f24939bb05656149daa830.png)
故障注入后,服务端长链接还在。
![](https://qcloudimg.tencent-cloud.cn/image/document/d4a343ac4e48b42f296701ae3a563c5e.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/d4a343ac4e48b42f296701ae3a563c5e.png)