When: 6th September 2021 at 05:00 AM UTC
Checklist:
- Create a task to communicate the chosen date and send an announcement to the community: T289660
- Create a calendar entry for the maintenance, invite sre-data-persistence@
- Add to deployments calendar. E.g.:
{{Deployment calendar event card |when=2021-09-05 22:00 SF |length=0.5 |window=Database primary switchover for s4 |who={{ircnick|kormat|Stevie Beth Mhaol}}, {{ircnick|marostegui|Manuel 'Early Bird' Arostegui}} |what=https://phabricator.wikimedia.org/T289650 }}
NEW primary: db2110
OLD primary: db2090
- Check configuration differences between new and old primary:
sudo pt-config-diff --defaults-file /root/.my.cnf h=db2090.codfw.wmnet h=db2110.codfw.wmnet
Failover prep:
- Silence alerts on all hosts:
sudo cookbook sre.hosts.downtime --hours 1 -r "Primary switchover s4 T289650" 'A:db-section-s4'
- Set NEW primary with weight 0
sudo dbctl instance db2110 set-weight 0 sudo dbctl config commit -m "Set db2110 with weight 0 T289650"
- Topology changes, move all replicas under NEW primary
sudo db-switchover --timeout=15 --only-slave-move db2090 db2110
- Disable puppet on both nodes
sudo cumin 'db2090* or db2110*' 'disable-puppet "primary switchover T289650"'
- Merge gerrit puppet change to promote NEW primary: https://gerrit.wikimedia.org/r/c/operations/puppet/+/716217
Failover:
- Log the failover:
!log Starting s4 codfw failover from db2090 to db2110 - T289650
- Set section read-only:
sudo dbctl --scope codfw section s4 ro "Maintenance until 05:15 UTC - T289650" sudo dbctl config commit -m "Set s4 codfw as read-only for maintenance - T289650"
- Check s4 is indeed read-only
- Switch primaries:
sudo db-switchover --skip-slave-move db2090 db2110 echo "===== db2090 (OLD)"; sudo mysql.py -h db2090 -e 'show slave status\G' echo "===== db2110 (NEW)"; sudo mysql.py -h db2110 -e 'show slave status\G'
- Promote NEW primary in dbctl, and remove read-only
sudo dbctl --scope codfw section s4 set-master db2110 sudo dbctl --scope codfw section s4 rw sudo dbctl config commit -m "Promote db2110 to s4 primary and set section read-write T289650"
- Restart puppet on both hosts:
sudo cumin 'db2090* or db2110*' 'run-puppet-agent -e "primary switchover T289650"'
Clean up tasks:
- Clean up heartbeat table(s).
- change events for query killer:
events_coredb_master.sql on the new primary db2110 events_coredb_slave.sql on the new slave db2090
- Update DNS: https://gerrit.wikimedia.org/r/716218
- Update candidate primary dbctl notes
sudo dbctl instance db2090 set-candidate-master --section s4 true sudo dbctl instance db2110 set-candidate-master --section s4 false
- Check tendril was updated
- Check zarcillo was updated
- db-switchover should do this. If it fails, do it manually: https://phabricator.wikimedia.org/P13956
- Depool OLD primary, as it's running 10.1, replicating from a 10.4 primary
sudo dbctl instance db2090 depool sudo dbctl config commit -m "Depool db2090 until it's reimaged to buster T289650"
- Apply outstanding schema changes to db2090 (if any): Nothing to apply
- Update/resolve this ticket.