When: Anytime, writes will be disabled
- Prerequisites **: https://wikitech.wikimedia.org/wiki/MariaDB/Primary_switchover
Checklist:
NEW primary: es1020
OLD primary: es1021
- Check configuration differences between new and old primary:
sudo pt-config-diff --defaults-file /root/.my.cnf h=es1021.eqiad.wmnet h=es1020.eqiad.wmnet
- Disable writes in es4 by merging: https://gerrit.wikimedia.org/r/c/operations/mediawiki-config/+/831511/
- Check es4 is indeed read-only
Failover prep:
- Silence alerts on all hosts:
sudo cookbook sre.hosts.downtime --hours 1 -r "Primary switchover es4 T317522" 'A:db-section-es4'
- Set NEW primary with weight 0 (and depool it from API or vslow/dump groups if it is present).
sudo dbctl instance es1020 set-weight 0 sudo dbctl config commit -m "Set es1020 with weight 0 T317522"
- Topology changes, move all replicas under NEW primary
sudo db-switchover --timeout=25 --only-slave-move es1021 es1020
- Disable puppet on both nodes
sudo cumin 'es1021* or es1020*' 'disable-puppet "primary switchover T317522"'
- Merge gerrit puppet change to promote NEW primary: https://gerrit.wikimedia.org/r/c/operations/puppet/+/831513/
Failover:
- Log the failover:
!log Starting es4 eqiad failover from es1021 to es1020 - T317522
- Switch primaries:
sudo db-switchover --skip-slave-move es1021 es1020 echo "===== es1021 (OLD)"; sudo db-mysql es1021 -e 'show slave status\G' echo "===== es1020 (NEW)"; sudo db-mysql es1020 -e 'show slave status\G'
- Promote NEW primary in dbctl, and remove read-only
sudo dbctl --scope eqiad section es4 set-master es1020 sudo dbctl config commit -m "Promote es1020 to es4 primary T317522"
- Restart puppet on both hosts:
sudo cumin 'es1021* or es1020*' 'run-puppet-agent -e "primary switchover T317522"'
Clean up tasks:
- Clean up heartbeat table(s).
sudo db-mysql es1020 heartbeat -e "delete from heartbeat where file like 'es1021%';"
- change events for query killer:
events_coredb_master.sql on the new primary es1020 events_coredb_slave.sql on the new slave es1021
- Update DNS: https://gerrit.wikimedia.org/r/c/operations/dns/+/831524/
- Update candidate primary dbctl and orchestrator notes
sudo dbctl instance es1021 set-candidate-master --section es4 true sudo dbctl instance es1020 set-candidate-master --section es4 false (dborch1001): sudo orchestrator-client -c untag -i es1020 --tag name=candidate (dborch1001): sudo orchestrator-client -c tag -i es1021 --tag name=candidate
- Check zarcillo was updated
- db-switchover should do this. If it fails, do it manually: https://phabricator.wikimedia.org/P13956
sudo db-mysql db1115 zarcillo -e "select * from masters where section = 'es4';"
- (If needed): Depool es1021 for maintenance.
sudo dbctl instance es1021 depool sudo dbctl config commit -m "Depool es1021 T317522"
- Change es1021 weight to mimic the previous weight es1020:
sudo dbctl instance es1021 edit
- Enable writes in es4 by merging the revert patch: https://gerrit.wikimedia.org/r/c/operations/mediawiki-config/+/831224
- Update/resolve this ticket.