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