Page MenuHomePhabricator

Switchover s3 from db1123 to db1157
Closed, ResolvedPublic

Description

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

When: Mon 21th June at 05:00 AM UTC.

Checklist:

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

NEW master: db1157
OLD master: db1123

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

Failover prep:

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

Failover:

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

Clean up tasks:

  • change events for query killer:
events_coredb_master.sql on the new master db1157
events_coredb_slave.sql on the new slave db1123
sudo dbctl instance db1123 set-candidate-master --section s3 true
sudo dbctl instance db1157 set-candidate-master --section s3 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 db1123 depool
sudo dbctl config commit -m "Depool db1123 until it's reimaged to buster T284648"
  • Apply outstanding schema changes to db1123 (if any)
  • Update/resolve this ticket.

Event Timeline

Kormat updated the task description. (Show Details)
Kormat updated the task description. (Show Details)

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

[operations/puppet@production] mariadb: Promote db1157 as s3 primary

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

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

[operations/dns@master] wmnet: Update s3-master to db1157

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

LSobanski triaged this task as Medium priority.Jun 10 2021, 9:02 AM
LSobanski moved this task from Triage to Ready on the DBA board.

Mentioned in SAL (#wikimedia-operations) [2021-06-21T04:48:42Z] <kormat@cumin1001> START - Cookbook sre.hosts.downtime for 1:00:00 on 21 hosts with reason: Master switchover s3 T284648

Mentioned in SAL (#wikimedia-operations) [2021-06-21T04:48:49Z] <kormat@cumin1001> END (PASS) - Cookbook sre.hosts.downtime (exit_code=0) for 1:00:00 on 21 hosts with reason: Master switchover s3 T284648

Mentioned in SAL (#wikimedia-operations) [2021-06-21T04:49:56Z] <kormat@cumin1001> dbctl commit (dc=all): 'Set db1157 with weight 0 T284648', diff saved to https://phabricator.wikimedia.org/P16646 and previous config saved to /var/cache/conftool/dbconfig/20210621-044955-kormat.json

Change 698981 merged by Kormat:

[operations/puppet@production] mariadb: Promote db1157 as s3 primary

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

Mentioned in SAL (#wikimedia-operations) [2021-06-21T05:01:59Z] <kormat> Starting s3 eqiad failover from db1123 to db1157 - T284648

Mentioned in SAL (#wikimedia-operations) [2021-06-21T05:03:04Z] <kormat@cumin1001> dbctl commit (dc=all): 'Set s3 eqiad as read-only for maintenance - T284648', diff saved to https://phabricator.wikimedia.org/P16647 and previous config saved to /var/cache/conftool/dbconfig/20210621-050304-kormat.json

Mentioned in SAL (#wikimedia-operations) [2021-06-21T05:05:07Z] <kormat@cumin1001> dbctl commit (dc=all): 'Promote db1157 to s3 master and set section read-write T284648', diff saved to https://phabricator.wikimedia.org/P16648 and previous config saved to /var/cache/conftool/dbconfig/20210621-050506-kormat.json

Change 698982 merged by Kormat:

[operations/dns@master] wmnet: Update s3-master to db1157

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

Mentioned in SAL (#wikimedia-operations) [2021-06-21T05:11:50Z] <kormat@cumin1001> dbctl commit (dc=all): 'Depool db1123 until it's reimaged to buster T284648', diff saved to https://phabricator.wikimedia.org/P16649 and previous config saved to /var/cache/conftool/dbconfig/20210621-051149-kormat.json

Kormat updated the task description. (Show Details)

All done :)