Page MenuHomePhabricator

Switchover s6 from db1131 to db1173
Closed, ResolvedPublic

Description

As part of upgrading s6 to debian buster/mariadb 10.4, we need to switch the master to be db1173 (which is already running buster/10.4).

When: Mon 17th May at 05:00 AM UTC.

Checklist:

  • Double check db1173 has report_host enabled T271106
  • Create a task to communicate the chosen date and send an announcement to the community: T282144

NEW master: db1173
OLD master: db1131

  • Check configuration differences between new and old master:
sudo pt-config-diff h=db1131.eqiad.wmnet,F=/root/.my.cnf h=db1173.eqiad.wmnet,F=/root/.my.cnf

Failover prep:

  • Silence alerts on all hosts:
sudo cookbook sre.hosts.downtime --hours 1 -r "Master switchover s6 T282124" 'A:db-section-s6'
  • Set NEW master with weight 0
sudo dbctl instance db1173 set-weight 0
sudo dbctl config commit -m "Set db1173 with weight 0 T282124"
  • Topology changes, move all replicas under NEW master
sudo db-switchover --timeout=15 --only-slave-move db1131.eqiad.wmnet db1173.eqiad.wmnet
  • Disable puppet on both nodes
sudo cumin 'db1131* or db1173*' 'disable-puppet "master switchover T282124"'

Failover:

  • Log the failover:
!log Starting s6 eqiad failover from db1131 to db1173 - T282124
  • Set section read-only:
sudo dbctl --scope eqiad section s6 ro "Maintenance until 05:15 UTC - T282124"
sudo dbctl config commit -m "Set s6 eqiad as read-only for maintenance - T282124"
  • Check s6 is indeed read-only
  • Switch masters:
sudo db-switchover --skip-slave-move db1131 db1173
echo "===== db1131 (OLD)"; sudo mysql.py -h db1131 -e 'show slave status\G'
echo "===== db1173 (NEW)"; sudo mysql.py -h db1173 -e 'show slave status\G'
  • Promote NEW master in dbctl, and remove read-only
sudo dbctl --scope eqiad section s6 set-master db1173
sudo dbctl --scope eqiad section s6 rw
sudo dbctl config commit -m "Promote db1173 to s6 master and set section read-write T282124"
  • Restart puppet on both hosts (for heartbeat):
sudo cumin 'db1131* or db1173*' 'run-puppet-agent -e "master switchover T282124"'

Clean up tasks:

  • change events for query killer:
events_coredb_master.sql on the new master db1173
events_coredb_slave.sql on the new slave db1131
sudo dbctl instance db1131 set-candidate-master --section s6 true
sudo dbctl instance db1173 set-candidate-master --section s6 false
sudo dbctl instance db1131 depool
sudo dbctl config commit -m "Depool db1131 until it's reimaged to buster T282124"
  • Apply T276150 to db1131
  • Update/resolve this ticket.

Event Timeline

Change 686505 had a related patch set uploaded (by Kormat; author: Kormat):

[operations/puppet@production] mariadb: Promote db1173 to s6 eqiad master.

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

Change 686513 had a related patch set uploaded (by Kormat; author: Kormat):

[operations/dns@master] wmnet: Update s6-master to db1173

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

LSobanski triaged this task as Medium priority.May 10 2021, 6:15 PM
LSobanski moved this task from Triage to In progress on the DBA board.

Mentioned in SAL (#wikimedia-operations) [2021-05-17T04:46:23Z] <kormat@cumin1001> START - Cookbook sre.hosts.downtime for 1:00:00 on 26 hosts with reason: Master switchover s6 T282124

Mentioned in SAL (#wikimedia-operations) [2021-05-17T04:46:33Z] <kormat@cumin1001> END (PASS) - Cookbook sre.hosts.downtime (exit_code=0) for 1:00:00 on 26 hosts with reason: Master switchover s6 T282124

Mentioned in SAL (#wikimedia-operations) [2021-05-17T04:46:58Z] <kormat@cumin1001> dbctl commit (dc=all): 'Set db1173 with weight 0 T282124', diff saved to https://phabricator.wikimedia.org/P15976 and previous config saved to /var/cache/conftool/dbconfig/20210517-044657-kormat.json

Change 686505 merged by Kormat:

[operations/puppet@production] mariadb: Promote db1173 to s6 eqiad master.

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

Mentioned in SAL (#wikimedia-operations) [2021-05-17T05:05:06Z] <kormat> Starting s6 eqiad failover from db1131 to db1173 - T282124

Mentioned in SAL (#wikimedia-operations) [2021-05-17T05:05:27Z] <kormat@cumin1001> dbctl commit (dc=all): 'Set s6 eqiad as read-only for maintenance - T282124', diff saved to https://phabricator.wikimedia.org/P15977 and previous config saved to /var/cache/conftool/dbconfig/20210517-050526-kormat.json

Mentioned in SAL (#wikimedia-operations) [2021-05-17T05:07:40Z] <kormat@cumin1001> dbctl commit (dc=all): 'Promote db1173 to s6 master and set section read-write T282124', diff saved to https://phabricator.wikimedia.org/P15978 and previous config saved to /var/cache/conftool/dbconfig/20210517-050740-kormat.json

Change 686513 merged by Kormat:

[operations/dns@master] wmnet: Update s6-master to db1173

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

Mentioned in SAL (#wikimedia-operations) [2021-05-17T05:13:13Z] <kormat@cumin1001> dbctl commit (dc=all): 'Depool db1131 until it's reimaged to buster T282124', diff saved to https://phabricator.wikimedia.org/P15980 and previous config saved to /var/cache/conftool/dbconfig/20210517-051312-kormat.json

All done. Total read-only time: 2m14s.

Kormat updated the task description. (Show Details)