Page MenuHomePhabricator

Switchover s6 master (db2214 -> db2129)
Closed, ResolvedPublic

Description

When: During a pre-defined DBA maintenance windows

Affected wikis:: https://noc.wikimedia.org/conf/highlight.php?file=dblists/s6.dblist

Checklist:

NEW primary: db2129
OLD primary: db2214

  • Check configuration differences between new and old primary:
24 config differences
Variable                  db2214                    db2129
========================= ========================= =========================
general_log_file          db2214.log                db2129.log
gtid_binlog_pos           171974711-171974711-19... 171970594-171970594-10...
gtid_binlog_state         171974711-171974711-19... 171970594-171970594-10...
gtid_current_pos          0-180359184-3070029963... 0-180359184-3049354376...
gtid_domain_id            180367479                 180367475
gtid_slave_pos            0-180359184-3070029963... 0-180359184-3049354376...
hostname                  db2214                    db2129
ignore_db_dirs            #rocksdb                  
innodb_buffer_pool_size   405874409472              404800667648
innodb_version            10.6.18                   10.6.17
log_bin_basename          /srv/sqldata/db2214-bin   /srv/sqldata/db2129-bin
log_bin_index             /srv/sqldata/db2214-bi... /srv/sqldata/db2129-bi...
optimizer_adjust_secon...                           0
pid_file                  /srv/sqldata/db2214.pid   /srv/sqldata/db2129.pid
report_host               db2214.codfw.wmnet        db2129.codfw.wmnet
rpl_semi_sync_master_e... ON                        OFF
rpl_semi_sync_slave_en... OFF                       ON
server_id                 180367479                 180367475
slave_transaction_retr... 1158,1159,1160,1161,12... 1158,1159,1160,1161,12...
slow_query_log_file       db2214-slow.log           db2129-slow.log
version                   10.6.18-MariaDB-log       10.6.17-MariaDB-log
version_source_revision   887bb3f73555ff8a50138a... 15c75ad083a55e198ae783...
version_ssl_library       OpenSSL 3.0.11 19 Sep ... OpenSSL 3.0.14 4 Jun 2024
wsrep_node_name           db2214                    db2129

Failover prep:

  • Silence alerts on all hosts:
sudo cookbook sre.hosts.downtime --hours 1 -r "Primary switchover s6 T374806" 'A:db-section-s6'
  • Set NEW primary with weight 0 (was 400)
sudo dbctl instance db2129 set-weight 0
sudo dbctl config commit -m "Set db2129 with weight 0 T374806"
  • Depool NEW from any specific group (API, vslow, dump) if present.
sudo dbctl instance db2129 edit
# If some changes were made:
sudo dbctl config commit -m "Remove db2129 from API/vslow/dump T374806"
  • Topology changes, move all replicas under NEW primary
sudo db-switchover --timeout=25 --replicating-master --read-only-master --only-slave-move db2214 db2129
  • Disable puppet on both nodes
sudo cumin 'db2214* or db2129*' 'disable-puppet "primary switchover T374806"'

Failover:

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

Clean up tasks:

  • Clean up heartbeat table(s).
sudo db-mysql db2129 heartbeat -e "delete from heartbeat where file like 'db2214%';"
  • 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 db2129
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 db2214
  • Update candidate primary dbctl and orchestrator notes
sudo dbctl instance db2214 set-candidate-master --section s6 true
sudo dbctl instance db2129 set-candidate-master --section s6 false
sudo cumin 'dborch*' 'orchestrator-client -c untag -i db2129 --tag name=candidate'
sudo cumin 'dborch*' 'orchestrator-client -c tag -i db2214 --tag name=candidate'
sudo db-mysql db1215 zarcillo -e "select * from masters where section = 's6';"
  • (If needed): Depool db2214 for maintenance.
sudo dbctl instance db2214 depool
sudo dbctl config commit -m "Depool db2214 T374806"
  • Change db2214 weight to mimic the previous weight db2129:
sudo dbctl instance db2214 edit
  • Apply outstanding schema changes to db2214 (if any)
  • Update/resolve this ticket.

Details

Event Timeline

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

[operations/puppet@production] mariadb: Promote db2129 to s6 master

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

ABran-WMF changed the task status from Open to In Progress.Sep 16 2024, 7:48 AM
ABran-WMF claimed this task.
ABran-WMF triaged this task as High priority.
ABran-WMF updated the task description. (Show Details)

Mentioned in SAL (#wikimedia-operations) [2024-09-16T07:48:40Z] <arnaudb@cumin1002> START - Cookbook sre.hosts.downtime for 1:00:00 on 26 hosts with reason: Primary switchover s6 T374806

Mentioned in SAL (#wikimedia-operations) [2024-09-16T07:49:22Z] <arnaudb@cumin1002> END (PASS) - Cookbook sre.hosts.downtime (exit_code=0) for 1:00:00 on 26 hosts with reason: Primary switchover s6 T374806

Change #1073038 merged by Arnaudb:

[operations/puppet@production] mariadb: Promote db2129 to s6 master

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

Mentioned in SAL (#wikimedia-operations) [2024-09-16T08:01:33Z] <arnaudb@cumin1002> dbctl commit (dc=all): 'Promote db2129 to s6 primary T374806', diff saved to https://phabricator.wikimedia.org/P69130 and previous config saved to /var/cache/conftool/dbconfig/20240916-080132-arnaudb.json

Mentioned in SAL (#wikimedia-operations) [2024-09-16T08:03:43Z] <arnaudb@cumin1002> dbctl commit (dc=all): 'db2214 T374806', diff saved to https://phabricator.wikimedia.org/P69131 and previous config saved to /var/cache/conftool/dbconfig/20240916-080342-arnaudb.json

ABran-WMF moved this task from Triage to Done on the DBA board.