Page MenuHomePhabricator

Switchover es6 master (es1038 -> es1037)
Closed, ResolvedPublic

Description

When: Anytime, writes will be disabled

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

Checklist:

NEW primary: es1037
OLD primary: es1038

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

(in deployment.eqiad.org):

scap backport 1041107
  • Check es6 is indeed read-only

Failover prep:

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

Failover:

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

Clean up tasks:

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

(in deployment.eqiad.org)

scap backport 1041401
  • Update/resolve this ticket.

Event Timeline

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

[operations/puppet@production] mariadb: Promote es1037 to es6 master

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

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

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

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

Change #1041107 had a related patch set uploaded (by Arnaudb; author: Arnaudb):

[operations/mediawiki-config@master] dbconfig: remove cluster30/es6 to switchmaster

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

Change #1041107 merged by jenkins-bot:

[operations/mediawiki-config@master] dbconfig: temporary disable writes on es6

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

Mentioned in SAL (#wikimedia-operations) [2024-06-11T05:51:39Z] <arnaudb@deploy1002> Started scap: Backport for [[gerrit:1041107|dbconfig: temporary disable writes on es6 (T367055)]]

Mentioned in SAL (#wikimedia-operations) [2024-06-11T05:56:08Z] <arnaudb@deploy1002> arnaudb: Backport for [[gerrit:1041107|dbconfig: temporary disable writes on es6 (T367055)]] synced to the testservers (https://wikitech.wikimedia.org/wiki/Mwdebug)

Mentioned in SAL (#wikimedia-operations) [2024-06-11T06:07:21Z] <arnaudb@deploy1002> Finished scap: Backport for [[gerrit:1041107|dbconfig: temporary disable writes on es6 (T367055)]] (duration: 15m 42s)

Mentioned in SAL (#wikimedia-operations) [2024-06-11T06:23:02Z] <arnaudb@cumin1002> START - Cookbook sre.hosts.downtime for 1:00:00 on 6 hosts with reason: Primary switchover es6 T367055

Mentioned in SAL (#wikimedia-operations) [2024-06-11T06:23:19Z] <arnaudb@cumin1002> END (PASS) - Cookbook sre.hosts.downtime (exit_code=0) for 1:00:00 on 6 hosts with reason: Primary switchover es6 T367055

Mentioned in SAL (#wikimedia-operations) [2024-06-11T06:23:54Z] <arnaudb@cumin1002> dbctl commit (dc=all): 'Set es1037 with weight 0 T367055', diff saved to https://phabricator.wikimedia.org/P64586 and previous config saved to /var/cache/conftool/dbconfig/20240611-062353-arnaudb.json

Change #1041092 merged by Arnaudb:

[operations/puppet@production] mariadb: Promote es1037 to es6 master

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

Mentioned in SAL (#wikimedia-operations) [2024-06-11T06:30:13Z] <arnaudb> Starting es6 eqiad failover from es1038 to es1037 - T367055

Mentioned in SAL (#wikimedia-operations) [2024-06-11T06:31:10Z] <arnaudb@cumin1002> dbctl commit (dc=all): 'Promote es1037 to es6 primary T367055', diff saved to https://phabricator.wikimedia.org/P64588 and previous config saved to /var/cache/conftool/dbconfig/20240611-063109-arnaudb.json

Change #1041093 merged by Arnaudb:

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

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

ABran-WMF claimed this task.
ABran-WMF triaged this task as High priority.
ABran-WMF updated the task description. (Show Details)
ABran-WMF moved this task from Triage to Done on the DBA board.