Page MenuHomePhabricator

Switchover es7 master (es1035 -> es1039)
Closed, DeclinedPublic

Description

When: Anytime, writes will be disabled

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

Checklist:

NEW primary: es1039
OLD primary: es1035

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

Failover prep:

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

Failover:

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

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 es1039
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 es1035
  • Merge DNS change: FIX ME
sudo authdns-update
  • Update candidate primary dbctl and orchestrator notes
sudo dbctl instance es1035 set-candidate-master --section es7 true
sudo dbctl instance es1039 set-candidate-master --section es7 false
sudo cumin 'dborch*' 'orchestrator-client -c untag -i es1039 --tag name=candidate'
sudo cumin 'dborch*' 'orchestrator-client -c tag -i es1035 --tag name=candidate'
sudo db-mysql db1215 zarcillo -e "select * from masters where section = 'es7';"
  • (If needed): Depool es1035 for maintenance.
sudo dbctl instance es1035 depool
sudo dbctl config commit -m "Depool es1035 T400028"
  • Change es1035 weight to mimic the previous weight es1039:
sudo dbctl instance es1035 edit
  • Set section back to read-write:
sudo dbctl --scope eqiad section es7 rw
sudo dbctl --scope codfw section es7 rw
sudo dbctl config commit -m "Set es7 eqiad back to read-write - T400028"
  • Update/resolve this ticket.

Event Timeline

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

[operations/puppet@production] mariadb: Promote es1039 to es7 master

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

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

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

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

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

Mentioned in SAL (#wikimedia-operations) [2025-07-21T06:51:13Z] <marostegui@cumin1002> DONE (PASS) - Cookbook sre.hosts.downtime (exit_code=0) for 1:00:00 on 8 hosts with reason: Primary switchover es7 T400028

Change #1170910 abandoned by Marostegui:

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

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

Change #1170907 abandoned by Marostegui:

[operations/puppet@production] mariadb: Promote es1039 to es7 master

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