Page MenuHomePhabricator

Switchover es4 master (es1021 -> es1020)
Closed, ResolvedPublic

Description

When: Anytime, writes will be disabled

Checklist:

NEW primary: es1020
OLD primary: es1021

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

Failover prep:

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

Failover:

  • Log the failover:
!log Starting es4 eqiad failover from es1021 to es1020 - T337283
  • Switch primaries:
sudo db-switchover --skip-slave-move es1021 es1020
echo "===== es1021 (OLD)"; sudo db-mysql es1021 -e 'show slave status\G'
echo "===== es1020 (NEW)"; sudo db-mysql es1020 -e 'show slave status\G'
  • Promote NEW primary in dbctl, and remove read-only
sudo dbctl --scope eqiad section es4 set-master es1020
sudo dbctl config commit -m "Promote es1020 to es4 primary T337283"
  • Restart puppet on both hosts:
sudo cumin 'es1021* or es1020*' 'run-puppet-agent -e "primary switchover T337283"'

Clean up tasks:

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

Event Timeline

Marostegui triaged this task as Medium priority.May 23 2023, 5:29 AM
Marostegui updated the task description. (Show Details)

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

[operations/mediawiki-config@master] db-production: Disable es4 writes

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

Change 922376 merged by jenkins-bot:

[operations/mediawiki-config@master] db-production: Disable es4 writes

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

Mentioned in SAL (#wikimedia-operations) [2023-05-23T06:17:59Z] <marostegui@deploy1002> Started scap: Backport for [[gerrit:922376|db-production: Disable es4 writes (T337283)]]

Mentioned in SAL (#wikimedia-operations) [2023-05-23T06:19:32Z] <marostegui@deploy1002> marostegui: Backport for [[gerrit:922376|db-production: Disable es4 writes (T337283)]] synced to the testservers: mwdebug2002.codfw.wmnet, mwdebug1001.eqiad.wmnet, mwdebug1002.eqiad.wmnet, mwdebug2001.codfw.wmnet

Mentioned in SAL (#wikimedia-operations) [2023-05-23T06:26:21Z] <marostegui@deploy1002> Finished scap: Backport for [[gerrit:922376|db-production: Disable es4 writes (T337283)]] (duration: 08m 21s)

Mentioned in SAL (#wikimedia-operations) [2023-05-23T06:38:16Z] <marostegui@cumin1001> START - Cookbook sre.hosts.downtime for 1:00:00 on 6 hosts with reason: Primary switchover es4 T337283

Mentioned in SAL (#wikimedia-operations) [2023-05-23T06:38:32Z] <marostegui@cumin1001> END (PASS) - Cookbook sre.hosts.downtime (exit_code=0) for 1:00:00 on 6 hosts with reason: Primary switchover es4 T337283

Mentioned in SAL (#wikimedia-operations) [2023-05-23T06:38:37Z] <marostegui@cumin1001> dbctl commit (dc=all): 'Set es1020 with weight 0 T337283', diff saved to https://phabricator.wikimedia.org/P48469 and previous config saved to /var/cache/conftool/dbconfig/20230523-063836-root.json

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

[operations/puppet@production] es1020: Promote to es4 master

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

Change 922453 merged by Marostegui:

[operations/puppet@production] es1020: Promote to es4 master

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

Mentioned in SAL (#wikimedia-operations) [2023-05-23T06:46:53Z] <marostegui> Starting es4 eqiad failover from es1021 to es1020 - T337283

Mentioned in SAL (#wikimedia-operations) [2023-05-23T06:47:30Z] <marostegui@cumin1001> dbctl commit (dc=all): 'Promote es1020 to es4 primary T337283', diff saved to https://phabricator.wikimedia.org/P48470 and previous config saved to /var/cache/conftool/dbconfig/20230523-064729-root.json

Mentioned in SAL (#wikimedia-operations) [2023-05-23T06:48:21Z] <marostegui@cumin1001> dbctl commit (dc=all): 'Depool es1021 T337283', diff saved to https://phabricator.wikimedia.org/P48471 and previous config saved to /var/cache/conftool/dbconfig/20230523-064820-root.json

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

[operations/dns@master] wmnet: Change dns for es4-master

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

Change 922455 merged by Marostegui:

[operations/dns@master] wmnet: Change dns for es4-master

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

Marostegui updated the task description. (Show Details)
Marostegui moved this task from Triage to Done on the DBA board.

All done - old master rebooted