Page MenuHomePhabricator

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

Description

When: Anytime, writes will be disabled

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

Checklist:

NEW primary: es1038
OLD primary: es1037

  • Check configuration differences between new and old primary:
$ sudo pt-config-diff --defaults-file /root/.my.cnf h=es1037.eqiad.wmnet h=es1038.eqiad.wmnet
15 config differences
Variable                  es1037                    es1038
========================= ========================= =========================
general_log_file          es1037.log                es1038.log
gtid_domain_id            172006403                 172007428
gtid_slave_pos            0-171966521-9791330871... 0-171966521-9791330871...
hostname                  es1037                    es1038
log_bin_basename          /srv/sqldata/es1037-bin   /srv/sqldata/es1038-bin
log_bin_index             /srv/sqldata/es1037-bi... /srv/sqldata/es1038-bi...
pid_file                  /srv/sqldata/es1037.pid   /srv/sqldata/es1038.pid
read_only                 OFF                       ON
report_host               es1037.eqiad.wmnet        es1038.eqiad.wmnet
rpl_semi_sync_master_e... ON                        OFF
rpl_semi_sync_slave_en... OFF                       ON
server_id                 172006403                 172007428
slow_query_log_file       es1037-slow.log           es1038-slow.log
thread_pool_stall_limit   100                       10
wsrep_node_name           es1037                    es1038

(in deployment.eqiad.org):

scap backport 1049555
  • Check es6 is indeed read-only

Failover prep:

  • Silence alerts on all hosts:
sudo cookbook sre.hosts.downtime --hours 1 -r "Primary switchover es6 T368401" '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 es1038 set-weight 0
sudo dbctl config commit -m "Set es1038 with weight 0 T368401"
  • Topology changes, move all replicas under NEW primary
sudo db-switchover --timeout=25 --only-slave-move es1037 es1038
  • Disable puppet on both nodes
sudo cumin 'es1037* or es1038*' 'disable-puppet "primary switchover T368401"'

Failover:

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

Clean up tasks:

  • Clean up heartbeat table(s).
sudo db-mysql es1038 heartbeat -e "delete from heartbeat where file like 'es1037%';"
  • change events for query killer:
curl -sS 'https://gerrit.wikimedia.org/r/plugins/gitiles/operations/software/+/refs/heads/master/dbtools/events_coredb_master.sql?format=TEXT' | base64 -d | sudo db-mysql es1038
curl -sS 'https://gerrit.wikimedia.org/r/plugins/gitiles/operations/software/+/refs/heads/master/dbtools/events_coredb_slave.sql?format=TEXT' | base64 -d | sudo db-mysql es1037
sudo dbctl instance es1037 set-candidate-master --section es6 true
sudo dbctl instance es1038 set-candidate-master --section es6 false
(dborch1001): sudo orchestrator-client -c untag -i es1038 --tag name=candidate
(dborch1001): sudo orchestrator-client -c tag -i es1037 --tag name=candidate
sudo db-mysql db1215 zarcillo -e "select * from masters where section = 'es6';"
  • (If needed): Depool es1037 for maintenance.
sudo dbctl instance es1037 depool
sudo dbctl config commit -m "Depool es1037 T368401"
  • Change es1037 weight to mimic the previous weight es1038:
sudo dbctl instance es1037 edit
  • Enable writes in es6 by merging and deploying revert of mediawiki config patch:

(in deployment.eqiad.org)

scap backport 1050096

https://gerrit.wikimedia.org/r/c/operations/dns/+/1050096

  • Update/resolve this ticket.

Event Timeline

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

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

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

Change #1049551 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/1049551

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

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

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

Change #1049555 merged by jenkins-bot:

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

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

Mentioned in SAL (#wikimedia-operations) [2024-06-27T06:01:30Z] <arnaudb@deploy1002> Started scap: Backport for [[gerrit:1049555|mariadb: disable writes on es6 (T368401)]]

Mentioned in SAL (#wikimedia-operations) [2024-06-27T06:04:03Z] <arnaudb@deploy1002> arnaudb: Backport for [[gerrit:1049555|mariadb: disable writes on es6 (T368401)]] synced to the testservers (https://wikitech.wikimedia.org/wiki/Mwdebug)

Mentioned in SAL (#wikimedia-operations) [2024-06-27T06:09:31Z] <arnaudb@deploy1002> Finished scap: Backport for [[gerrit:1049555|mariadb: disable writes on es6 (T368401)]] (duration: 08m 00s)

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

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

Mentioned in SAL (#wikimedia-operations) [2024-06-27T06:10:56Z] <arnaudb@cumin1002> dbctl commit (dc=all): 'Set es1038 with weight 0 T368401', diff saved to https://phabricator.wikimedia.org/P65507 and previous config saved to /var/cache/conftool/dbconfig/20240627-061055-arnaudb.json

Change #1049550 merged by Arnaudb:

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

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

Mentioned in SAL (#wikimedia-operations) [2024-06-27T06:15:55Z] <arnaudb> Starting es6 eqiad failover from es1037 to es1038 - T368401

Mentioned in SAL (#wikimedia-operations) [2024-06-27T06:16:39Z] <arnaudb@cumin1002> dbctl commit (dc=all): 'Promote es1038 to es6 primary T368401', diff saved to https://phabricator.wikimedia.org/P65508 and previous config saved to /var/cache/conftool/dbconfig/20240627-061639-arnaudb.json

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

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

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

Change #1050095 merged by Arnaudb:

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

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

Change #1049551 abandoned by Arnaudb:

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

Reason:

https://gerrit.wikimedia.org/r/c/operations/dns/+/1050095

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

Mentioned in SAL (#wikimedia-operations) [2024-06-27T06:23:39Z] <arnaudb@cumin1002> dbctl commit (dc=all): 'weight es1037 T368401', diff saved to https://phabricator.wikimedia.org/P65509 and previous config saved to /var/cache/conftool/dbconfig/20240627-062338-arnaudb.json

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

Mentioned in SAL (#wikimedia-operations) [2024-06-27T06:45:07Z] <arnaudb@cumin1002> dbctl commit (dc=all): 'weight es1038 T368401', diff saved to https://phabricator.wikimedia.org/P65510 and previous config saved to /var/cache/conftool/dbconfig/20240627-064506-arnaudb.json