README.md 3.55 KB

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. 可用区故切换

可用区切换的场景:

1.某个可用区内部出现系统性故障, 例如可用区VM之间网络不同; 切换方案:

1) 如果主可用区故障,则进行数据库切换 + 流量切换到副可用区;

2)如果副可用区故障,则流量切换到主可用区;

2.可用区之间的网络出现故障。例如az1 <--> az2 网络不通; 切换方案:流量切换到主可用区

1.1 流量切换到主可用区(AZ1)

1)AZ2公网流量切换到AZ1

2)AZ1公网、内网(*.yoho.yohoops.org)流量切换到AZ1

1.2 流量切换到副可用区(AZ2)

1)AZ1公网流量、内网流量切换到AZ2

2)AZ2公网流量切换到AZ2

1.3 切换问询服务器流量到AZ1

curl -H "Host: dnsresolver.yohoops.org" "http://10.66.4.23/switchCloud?cloudType=1"

curl -H "Host: dnsresolver.yohoops.org" "http://10.66.4.15/switchCloud?cloudType=1"

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