Page MenuHomePhabricator

Switchover x1 master (db1103 -> db1120)
Closed, ResolvedPublic

Description

When: Tuesday 6th at 06:30 AM UTC

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

  • Team calendar invite

Affected wikis:: All in x1

Checklist:

NEW primary: db1120
OLD primary: db1103

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

Failover prep:

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

Failover:

  • Log the failover:
!log Starting x1 eqiad failover from db1103 to db1120 - T316745
  • Switch primaries:
sudo db-switchover --skip-slave-move db1103 db1120
echo "===== db1103 (OLD)"; sudo db-mysql db1103 -e 'show slave status\G'
echo "===== db1120 (NEW)"; sudo db-mysql db1120 -e 'show slave status\G'
  • Promote NEW primary in dbctl, and remove read-only
sudo dbctl --scope eqiad section x1 set-master db1120
sudo dbctl config commit -m "Promote db1120 to x1 primary T316745"

[]x Restart puppet on both hosts:

sudo cumin 'db1103* or db1120*' 'run-puppet-agent -e "primary switchover T316745"'

Clean up tasks:

  • Clean up heartbeat table(s).
sudo db-mysql db1120 heartbeat -e "delete from heartbeat where file like 'db1103%';"
  • change events for query killer:
events_coredb_master.sql on the new primary db1120
events_coredb_slave.sql on the new slave db1103
sudo dbctl instance db1103 set-candidate-master --section x1 true
sudo dbctl instance db1120 set-candidate-master --section x1 false
(dborch1001): sudo orchestrator-client -c untag -i db1120 --tag name=candidate
(dborch1001): sudo orchestrator-client -c tag -i db1103 --tag name=candidate
sudo db-mysql db1115 zarcillo -e "select * from masters where section = 'x1';"
  • (If needed): Depool db1103 for maintenance.
sudo dbctl instance db1103 depool
sudo dbctl config commit -m "Depool db1103 T316745"
  • Change db1103 weight to mimic the previous weight db1120:
sudo dbctl instance db1103 edit
  • Apply outstanding schema changes to db1103 (if any): tracked at T312160
  • Update/resolve this ticket.

Event Timeline

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

[operations/puppet@production] mariadb: Promote db1120 to x1 master

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

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

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

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

Marostegui triaged this task as Medium priority.
Marostegui updated the task description. (Show Details)

db1120 rebooted with the latest kernel

Mentioned in SAL (#wikimedia-operations) [2022-09-06T05:12:33Z] <marostegui@cumin1001> START - Cookbook sre.hosts.downtime for 1:00:00 on 10 hosts with reason: Primary switchover x1 T316745

Mentioned in SAL (#wikimedia-operations) [2022-09-06T05:12:52Z] <marostegui@cumin1001> END (PASS) - Cookbook sre.hosts.downtime (exit_code=0) for 1:00:00 on 10 hosts with reason: Primary switchover x1 T316745

Mentioned in SAL (#wikimedia-operations) [2022-09-06T05:13:04Z] <marostegui@cumin1001> dbctl commit (dc=all): 'Set db1120 with weight 0 T316745', diff saved to https://phabricator.wikimedia.org/P33823 and previous config saved to /var/cache/conftool/dbconfig/20220906-051304-root.json

Change 828468 merged by Marostegui:

[operations/puppet@production] mariadb: Promote db1120 to x1 master

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

Mentioned in SAL (#wikimedia-operations) [2022-09-06T06:05:23Z] <marostegui> Starting x1 eqiad failover from db1103 to db1120 - T316745

Mentioned in SAL (#wikimedia-operations) [2022-09-06T06:06:03Z] <marostegui@cumin1001> dbctl commit (dc=all): 'Promote db1120 to x1 primary T316745', diff saved to https://phabricator.wikimedia.org/P33830 and previous config saved to /var/cache/conftool/dbconfig/20220906-060602-root.json

Change 828469 merged by Marostegui:

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

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

Mentioned in SAL (#wikimedia-operations) [2022-09-06T06:08:15Z] <marostegui@cumin1001> dbctl commit (dc=all): 'Depool db1103 T316745', diff saved to https://phabricator.wikimedia.org/P33831 and previous config saved to /var/cache/conftool/dbconfig/20220906-060815-root.json

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

All done