Page MenuHomePhabricator

Switchover es5 codfw master es2024 -> es2023
Closed, ResolvedPublic

Description

When: Anytime, writes will be disabled

Checklist:

NEW primary: es2023
OLD primary: es2024

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

Failover prep:

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

Failover:

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

Clean up tasks:

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

Event Timeline

Marostegui updated the task description. (Show Details)

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

[operations/mediawiki-config@master] db-production.php: Disable writes on es5

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

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

[operations/dns@master] wmnet: Update CNAME for es5

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

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

[operations/puppet@production] mariadb: Switchover es5 master

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

Mentioned in SAL (#wikimedia-operations) [2024-02-01T05:52:15Z] <marostegui@cumin1002> START - Cookbook sre.hosts.downtime for 1:00:00 on 6 hosts with reason: Primary switchover es5 T356235

Mentioned in SAL (#wikimedia-operations) [2024-02-01T05:52:32Z] <marostegui@cumin1002> END (PASS) - Cookbook sre.hosts.downtime (exit_code=0) for 1:00:00 on 6 hosts with reason: Primary switchover es5 T356235

Change 994611 merged by jenkins-bot:

[operations/mediawiki-config@master] db-production.php: Disable writes on es5

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

Mentioned in SAL (#wikimedia-operations) [2024-02-01T05:52:41Z] <marostegui@cumin1002> dbctl commit (dc=all): 'Set es2023 with weight 0 T356235', diff saved to https://phabricator.wikimedia.org/P56011 and previous config saved to /var/cache/conftool/dbconfig/20240201-055240-marostegui.json

Mentioned in SAL (#wikimedia-operations) [2024-02-01T05:53:54Z] <marostegui@deploy2002> Started scap: Backport for [[gerrit:994611|db-production.php: Disable writes on es5 (T356235)]]

Mentioned in SAL (#wikimedia-operations) [2024-02-01T05:55:33Z] <marostegui@deploy2002> marostegui: Backport for [[gerrit:994611|db-production.php: Disable writes on es5 (T356235)]] synced to the testservers (https://wikitech.wikimedia.org/wiki/Mwdebug)

Change 994731 merged by Marostegui:

[operations/puppet@production] mariadb: Switchover es5 master

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

Mentioned in SAL (#wikimedia-operations) [2024-02-01T06:02:13Z] <marostegui@deploy2002> Finished scap: Backport for [[gerrit:994611|db-production.php: Disable writes on es5 (T356235)]] (duration: 08m 19s)

Mentioned in SAL (#wikimedia-operations) [2024-02-01T06:07:58Z] <marostegui> Starting es4 codfw failover from es2024 to es2023 - T356235

Mentioned in SAL (#wikimedia-operations) [2024-02-01T06:08:54Z] <marostegui@cumin1002> dbctl commit (dc=all): 'Promote es2023 to es5 primary T356235', diff saved to https://phabricator.wikimedia.org/P56012 and previous config saved to /var/cache/conftool/dbconfig/20240201-060853-root.json

Mentioned in SAL (#wikimedia-operations) [2024-02-01T06:10:41Z] <marostegui@cumin1002> dbctl commit (dc=all): 'Depool es2024 T356235', diff saved to https://phabricator.wikimedia.org/P56013 and previous config saved to /var/cache/conftool/dbconfig/20240201-061041-root.json

Change 994730 merged by Marostegui:

[operations/dns@master] wmnet: Update CNAME for es5

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

Marostegui updated the task description. (Show Details)

This is all done