Page MenuHomePhabricator

Switchover s3 master db1123 -> db1157
Closed, ResolvedPublic

Description

When: Tuesday 12th 06:00 AM UTC

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

  • Team calendar invite

Affected wikis:: https://noc.wikimedia.org/conf/highlight.php?file=dblists/s3.dblist

Checklist:

NEW primary: db1157
OLD primary: db1123

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

Failover prep:

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

Failover:

  • Log the failover:
!log Starting s3 eqiad failover from db1123 to db1157 - T311610
  • Set section read-only:
sudo dbctl --scope eqiad section s3 ro "Maintenance until 06:15 UTC - T311610"
sudo dbctl config commit -m "Set s3 eqiad as read-only for maintenance - T311610"
  • Check s3 is indeed read-only
  • Switch primaries:
sudo db-switchover --skip-slave-move db1123 db1157
echo "===== db1123 (OLD)"; sudo db-mysql db1123 -e 'show slave status\G'
echo "===== db1157 (NEW)"; sudo db-mysql db1157 -e 'show slave status\G'
  • Promote NEW primary 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 primary and set section read-write T311610"
  • Restart puppet on both hosts:
sudo cumin 'db1123* or db1157*' 'run-puppet-agent -e "primary switchover T311610"'

Clean up tasks:

  • Clean up heartbeat table(s).
sudo db-mysql db1157 heartbeat -e "delete from heartbeat where file like 'db1123%';"
  • change events for query killer:
events_coredb_master.sql on the new primary 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
(dborch1001): sudo orchestrator-client -c untag -i db1157 --tag name=candidate
(dborch1001): sudo orchestrator-client -c tag -i db1123 --tag name=candidate
sudo db-mysql db1115 zarcillo -e "select * from masters where section = 's3';"
  • (If needed): Depool db1123 for maintenance.
sudo dbctl instance db1123 depool
sudo dbctl config commit -m "Depool db1123 T311610"
  • Apply outstanding schema changes to db1123 (if any)
  • Update/resolve this ticket.

Event Timeline

Marostegui triaged this task as Medium priority.
Marostegui moved this task from Triage to Ready on the DBA board.
Marostegui added a project: User-notice.
Marostegui added a subscriber: Marostegui.

I will do this on Tuesday 12th 06:00 AM UTC

Marostegui renamed this task from Switchover s3 master to Switchover s3 master db1123 -> db1157.Jul 4 2022, 11:48 AM
Marostegui updated the task description. (Show Details)
Marostegui updated the task description. (Show Details)

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

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

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

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

[operations/puppet@production] mariadb: Switchover s3 master db1123 -> db1157

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

Mentioned in SAL (#wikimedia-operations) [2022-07-12T05:19:01Z] <marostegui@cumin1001> START - Cookbook sre.hosts.downtime for 1:00:00 on 20 hosts with reason: Primary switchover s3 T311610

Mentioned in SAL (#wikimedia-operations) [2022-07-12T05:19:16Z] <marostegui@cumin1001> END (PASS) - Cookbook sre.hosts.downtime (exit_code=0) for 1:00:00 on 20 hosts with reason: Primary switchover s3 T311610

Mentioned in SAL (#wikimedia-operations) [2022-07-12T05:19:27Z] <marostegui@cumin1001> dbctl commit (dc=all): 'Set db1157 with weight 0 T311610', diff saved to https://phabricator.wikimedia.org/P31007 and previous config saved to /var/cache/conftool/dbconfig/20220712-051927-root.json

db1157's previous weight:

1--- eqiad/sectionLoads/DEFAULT live
2+++ eqiad/sectionLoads/DEFAULT generated
3@@ -4,7 +4,7 @@
4 },
5 {
6 "db1112": 500,
7- "db1157": 500,
8+ "db1157": 0,
9 "db1166": 300,
10 "db1175": 500,
11 "db1179": 500

Change 812841 merged by Marostegui:

[operations/puppet@production] mariadb: Switchover s3 master db1123 -> db1157

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

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

[operations/puppet@production] db1123: Disable notifications

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

Mentioned in SAL (#wikimedia-operations) [2022-07-12T06:00:17Z] <marostegui> Starting s3 eqiad failover from db1123 to db1157 - T311610

Mentioned in SAL (#wikimedia-operations) [2022-07-12T06:00:32Z] <marostegui@cumin1001> dbctl commit (dc=all): 'Set s3 eqiad as read-only for maintenance - T311610', diff saved to https://phabricator.wikimedia.org/P31008 and previous config saved to /var/cache/conftool/dbconfig/20220712-060031-marostegui.json

Mentioned in SAL (#wikimedia-operations) [2022-07-12T06:00:59Z] <marostegui@cumin1001> dbctl commit (dc=all): 'Promote db1157 to s3 primary and set section read-write T311610', diff saved to https://phabricator.wikimedia.org/P31009 and previous config saved to /var/cache/conftool/dbconfig/20220712-060058-marostegui.json

Change 812822 merged by Marostegui:

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

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

Change 813117 merged by Marostegui:

[operations/puppet@production] db1123: Disable notifications

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

Mentioned in SAL (#wikimedia-operations) [2022-07-12T06:04:08Z] <marostegui@cumin1001> dbctl commit (dc=all): 'Depool db1123 T311610', diff saved to https://phabricator.wikimedia.org/P31010 and previous config saved to /var/cache/conftool/dbconfig/20220712-060407-root.json

Schema changes will be tracked in their own task

This was done.
RO starts: 06:00:32
RO stops: 06:00:59

Total RO time: 27 seconds