Page MenuHomePhabricator

Switchover s5 from db1100 to db1130
Closed, ResolvedPublic

Description

As part of upgrading s5 to debian buster/mariadb 10.4, we need to switch the master to be db1130

When: Tuesday 22nd June at 05:00 AM UTC

Checklist:

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

NEW master: db1130
OLD master: db1100

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

Failover prep:

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

Failover:

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

Clean up tasks:

  • change events for query killer:
events_coredb_master.sql on the new master db1130
events_coredb_slave.sql on the new slave db1100
sudo dbctl instance db1100 set-candidate-master --section s5 true
sudo dbctl instance db1130 set-candidate-master --section s5 false
  • Check tendril was updated
  • Check zarcillo was updated
  • Depool OLD master, as it's running 10.1, replicating from a 10.4 master
sudo dbctl instance db1100 depool
sudo dbctl config commit -m "Depool db1100 until it's reimaged to buster T284529"

Related Objects

Event Timeline

Marostegui triaged this task as Medium priority.Jun 8 2021, 6:28 AM
Marostegui updated the task description. (Show Details)
Marostegui moved this task from Triage to Ready on the DBA board.

Change 699136 had a related patch set uploaded (by Marostegui; author: Marostegui):

[operations/dns@master] wmnet: Promote db1130 to s5 master

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

Change 700462 had a related patch set uploaded (by Marostegui; author: Marostegui):

[operations/puppet@production] mariadb: Promote db1130 to s5 master.

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

Mentioned in SAL (#wikimedia-operations) [2021-06-21T09:26:24Z] <marostegui@cumin1001> dbctl commit (dc=all): 'Set db1130 with weight 0 T284529', diff saved to https://phabricator.wikimedia.org/P16658 and previous config saved to /var/cache/conftool/dbconfig/20210621-092623-root.json

Mentioned in SAL (#wikimedia-operations) [2021-06-22T04:19:16Z] <marostegui@cumin1001> START - Cookbook sre.hosts.downtime for 1:00:00 on 24 hosts with reason: Master switchover s5 T284529

Mentioned in SAL (#wikimedia-operations) [2021-06-22T04:19:25Z] <marostegui@cumin1001> END (PASS) - Cookbook sre.hosts.downtime (exit_code=0) for 1:00:00 on 24 hosts with reason: Master switchover s5 T284529

Mentioned in SAL (#wikimedia-operations) [2021-06-22T04:20:07Z] <marostegui> Start topology changes for s5 switchover T284529

Change 700462 merged by Marostegui:

[operations/puppet@production] mariadb: Promote db1130 to s5 master.

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

Marostegui moved this task from Blocked to In progress on the DBA board.

Mentioned in SAL (#wikimedia-operations) [2021-06-22T05:00:25Z] <marostegui> Starting s5 eqiad failover from db1100 to db1130 - T284529

Mentioned in SAL (#wikimedia-operations) [2021-06-22T05:00:37Z] <marostegui@cumin1001> dbctl commit (dc=all): 'Set s5 eqiad as read-only for maintenance - T284529', diff saved to https://phabricator.wikimedia.org/P16675 and previous config saved to /var/cache/conftool/dbconfig/20210622-050036-root.json

Mentioned in SAL (#wikimedia-operations) [2021-06-22T05:01:23Z] <marostegui@cumin1001> dbctl commit (dc=all): 'Promote db1130 to s5 master and set section read-write T284529', diff saved to https://phabricator.wikimedia.org/P16676 and previous config saved to /var/cache/conftool/dbconfig/20210622-050123-root.json

Change 699136 merged by Marostegui:

[operations/dns@master] wmnet: Promote db1130 to s5 master

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

Mentioned in SAL (#wikimedia-operations) [2021-06-22T05:06:02Z] <marostegui@cumin1001> dbctl commit (dc=all): 'Depool old master running 10.1 T284529', diff saved to https://phabricator.wikimedia.org/P16677 and previous config saved to /var/cache/conftool/dbconfig/20210622-050602-marostegui.json

Mentioned in SAL (#wikimedia-operations) [2021-06-22T05:06:34Z] <marostegui> Stop replication on old s5 master ( db1100) - T284529

Change 700723 had a related patch set uploaded (by Marostegui; author: Marostegui):

[operations/puppet@production] db1100: Disable notifications

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

Change 700723 merged by Marostegui:

[operations/puppet@production] db1100: Disable notifications

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

Switchover was done.
Read only start: 05:00:37
Read only stop: 05:01:23

Total read only time: 46 seconds

Marostegui updated the task description. (Show Details)