yoho.switch
有货故障切换脚本
切换流程
0.公网域名解析
有货前台
: api.yoho.cn
, service.yoho.cn
, union.yoho.cn
, webunion.yohobuy.com
- default:
123.206.1.98
- backup 1:
123.206.2.50
- backup 2(灰度):
140.143.181.49
pch5
: *.yohobuy.com
, *.m.yohobuy.com
- default: 140.143.217.201
云负载均衡器是跨多AZ可用的, 所以一般不需要切换域名
需要切换域名的场景: 某个负载均衡器出现故障
1. 可用区故切换
可用区切换的场景:
- 某个可用区内部出现系统性故障, 例如可用区VM之间网络不同; 切换方案:
1) 如果主可用区故障,则进行数据库切换 + 流量切换到副可用区;
2)如果副可用区故障,则流量切换到主可用区;
- 可用区之间的网络出现故障。例如az1 <--> az2 网络不通; 切换方案:流量切换到主可用区
1.1 流量切换到主可用区(AZ1)
副可用区出现故障的场景,细分如下2个场景:
副可用区所在的外部负载均衡器正常: 在副可用区所在的负载均衡器上将流量切换到主可用区(AZ1)
副可用区所在的外部负载均衡器异常: 切换问询服务器,将APP的流量引导到主可用区
1.2 数据库切换 + 流量切换到副可用区(AZ2)
需要进行切换的数据库域名:
domain | record | az1 master | az2 slave |
---|---|---|---|
yohoops.org. | write.cms | 10.66.0.99 | 10.66.106.11 |
yohoops.org. | write.orders | 10.66.0.170 | 10.66.106.13 |
yohoops.org. | write.passport | 10.66.0.105 | 10.66.106.8 |
yohoops.org. | write.shops | 10.66.0.213 | 10.66.106.3 |
yohoops.org. | write.uic | 10.66.6.136 | 10.66.106.12 |
yohoops.org. | write.yohood | 10.66.0.170 | 10.66.106.13 |
yohoops.org. | write1.orders | 10.66.0.57 | 10.66.106.6 |
yohoops.org. | write1.promotion | 10.66.0.57 | 10.66.106.6 |
yohoops.org. | write2.orders | 10.66.0.81 | 10.66.106.9 |
yohoops.org. | write2.promotion | 10.66.0.81 | 10.66.106.9 |
yohoops.org. | write3.orders | 10.66.0.98 | 10.66.106.15 |
yohoops.org. | write3.promotion | 10.66.0.98 | 10.66.106.15 |
yohoops.org. | write4.orders | 10.66.0.121 | 10.66.106.16 |
yohoops.org. | write4.promotion | 10.66.0.121 | 10.66.106.16 |
Role Variables
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
Dependencies
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
Playbook
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
License
BSD
Author Information
chunhua.zhang@yoho.cn