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