Page MenuHomePhabricator

Switchover es6 master (es1038 -> es1037)
Closed, DeclinedPublic

Description

When: Anytime, writes will be disabled

Prerequisites: https://wikitech.wikimedia.org/wiki/MariaDB/Primary_switchover

Checklist:

NEW primary: es1037
OLD primary: es1038

  • Check configuration differences between new and old primary:
sudo pt-config-diff --defaults-file /root/.my.cnf h=es1038.eqiad.wmnet h=es1037.eqiad.wmnet
  • Set section read-only:
sudo dbctl --scope eqiad section es6 ro "Maintenance - T400027"
sudo dbctl --scope codfw section es6 ro "Maintenance - T400027"
sudo dbctl config commit -m "Set es6 eqiad as read-only for maintenance - T400027"
  • Check es6 is indeed read-only

Failover prep:

  • Silence alerts on all hosts:
sudo cookbook sre.hosts.downtime --hours 1 -r "Primary switchover es6 T400027" 'A:db-section-es6'
  • Set NEW primary with weight 0 (and depool it from API or vslow/dump groups if it is present).
sudo dbctl instance es1037 set-weight 0
sudo dbctl config commit -m "Set es1037 with weight 0 T400027"
  • Topology changes, move all replicas under NEW primary
sudo db-switchover --timeout=25 --only-slave-move es1038 es1037
  • Disable puppet on both nodes
sudo cumin 'es1038* or es1037*' 'disable-puppet "primary switchover T400027"'
  • Merge gerrit puppet change to promote NEW primary: FIXME

Failover:

  • Log the failover:
!log Starting es6 eqiad failover from es1038 to es1037 - T400027
  • Switch primaries:
sudo db-switchover --skip-slave-move es1038 es1037
echo "===== es1038 (OLD)"; sudo db-mysql es1038 -e 'show slave status\G'
echo "===== es1037 (NEW)"; sudo db-mysql es1037 -e 'show slave status\G'
  • Promote NEW primary in dbctl, and remove read-only
sudo dbctl --scope eqiad section es6 set-master es1037
sudo dbctl config commit -m "Promote es1037 to es6 primary T400027"
  • Clean up heartbeat table(s).
sudo db-mysql es1037 heartbeat -e "delete from heartbeat where file like 'es1038%';"
  • Restart puppet on both hosts:
sudo cumin 'es1038* or es1037*' 'run-puppet-agent -e "primary switchover T400027"'

Clean up tasks:

  • change events for query killer:
curl -sS 'https://gerrit.wikimedia.org/r/plugins/gitiles/operations/software/+/refs/heads/master/dbtools/events_coredb_master.sql?format=TEXT' | base64 -d | sudo db-mysql es1037
curl -sS 'https://gerrit.wikimedia.org/r/plugins/gitiles/operations/software/+/refs/heads/master/dbtools/events_coredb_slave.sql?format=TEXT' | base64 -d | sudo db-mysql es1038
  • Merge DNS change: FIX ME
sudo authdns-update
  • Update candidate primary dbctl and orchestrator notes
sudo dbctl instance es1038 set-candidate-master --section es6 true
sudo dbctl instance es1037 set-candidate-master --section es6 false
sudo cumin 'dborch*' 'orchestrator-client -c untag -i es1037 --tag name=candidate'
sudo cumin 'dborch*' 'orchestrator-client -c tag -i es1038 --tag name=candidate'
sudo db-mysql db1215 zarcillo -e "select * from masters where section = 'es6';"
  • (If needed): Depool es1038 for maintenance.
sudo dbctl instance es1038 depool
sudo dbctl config commit -m "Depool es1038 T400027"
  • Change es1038 weight to mimic the previous weight es1037:
sudo dbctl instance es1038 edit
  • Set section back to read-write:
sudo dbctl --scope eqiad section es6 rw
sudo dbctl --scope codfw section es6 rw
sudo dbctl config commit -m "Set es6 eqiad back to read-write - T400027"
  • Update/resolve this ticket.

Event Timeline

Change #1170899 had a related patch set uploaded (by Gerrit maintenance bot; author: Gerrit maintenance bot):

[operations/puppet@production] mariadb: Promote es1037 to es6 master

https://gerrit.wikimedia.org/r/1170899

Change #1170902 had a related patch set uploaded (by Gerrit maintenance bot; author: Gerrit maintenance bot):

[operations/dns@master] wmnet: Update es6-master alias

https://gerrit.wikimedia.org/r/1170902

Marostegui triaged this task as Medium priority.
Marostegui moved this task from Triage to In progress on the DBA board.

Actually this is not needed, I can just go RO on es7 and upgrade the master for T399540: Upgrade masters to 10.6.22 and 10.11.13 .2 update

Change #1170902 abandoned by Marostegui:

[operations/dns@master] wmnet: Update es6-master alias

https://gerrit.wikimedia.org/r/1170902

Change #1170899 abandoned by Marostegui:

[operations/puppet@production] mariadb: Promote es1037 to es6 master

https://gerrit.wikimedia.org/r/1170899

Mentioned in SAL (#wikimedia-operations) [2025-07-21T07:16:09Z] <marostegui@cumin1002> dbctl commit (dc=all): 'Set es6 eqiad as read-only for maintenance - T400027', diff saved to Unable to send diff to phaste and previous config saved to /var/cache/conftool/dbconfig/20250721-071604-marostegui.json

Mentioned in SAL (#wikimedia-operations) [2025-07-21T07:17:45Z] <marostegui@cumin1002> dbctl commit (dc=all): 'Set es6 eqiad back to read-write - T400027', diff saved to https://phabricator.wikimedia.org/P79463 and previous config saved to /var/cache/conftool/dbconfig/20250721-071744-marostegui.json