As part of upgrading s3 to debian buster/mariadb 10.4, we need to switch the master to be db1157 (which is already running buster/10.4).
When: Mon 21th June at 05:00 AM UTC.
Checklist:
[x] Double check db1157 has `report_host` enabled T271106
[x] Create a task to communicate the chosen date and send an announcement to the community: T284650
NEW master: db1157
OLD master: db1123
[x] Check configuration differences between new and old master:
```
sudo pt-config-diff h=db1123.eqiad.wmnet,F=/root/.my.cnf h=db1157.eqiad.wmnet,F=/root/.my.cnf
```
**Failover prep:**
[x] Silence alerts on all hosts:
```
sudo cookbook sre.hosts.downtime --hours 1 -r "Master switchover s3 T284648" 'A:db-section-s3'
```
[x] Set NEW master with weight 0
```
sudo dbctl instance db1157 set-weight 0
sudo dbctl config commit -m "Set db1157 with weight 0 T284648"
```
[x] Topology changes, move all replicas under NEW master
```
sudo db-switchover --timeout=15 --only-slave-move db1123.eqiad.wmnet db1157.eqiad.wmnet
```
[x] Disable puppet on both nodes
```
sudo cumin 'db1123* or db1157*' 'disable-puppet "master switchover T284648"'
```
[x] Merge gerrit puppet change to promote NEW master: https://gerrit.wikimedia.org/r/c/operations/puppet/+/698981
**Failover:**
[x] Log the failover:
```
!log Starting s3 eqiad failover from db1123 to db1157 - T284648
```
[x] Set section read-only:
```
sudo dbctl --scope eqiad section s3 ro "Maintenance until 05:15 UTC - T284648"
sudo dbctl config commit -m "Set s3 eqiad as read-only for maintenance - T284648"
```
[x] Check s3 is indeed read-only
[x] Switch masters:
```
sudo db-switchover --skip-slave-move db1123 db1157
echo "===== db1123 (OLD)"; sudo mysql.py -h db1123 -e 'show slave status\G'
echo "===== db1157 (NEW)"; sudo mysql.py -h db1157 -e 'show slave status\G'
```
[x] Promote NEW master in dbctl, and remove read-only
```
sudo dbctl --scope eqiad section s3 set-master db1157
sudo dbctl --scope eqiad section s3 rw
sudo dbctl config commit -m "Promote db1157 to s3 master and set section read-write T284648"
```
[x] Restart puppet on both hosts:
```
sudo cumin 'db1123* or db1157*' 'run-puppet-agent -e "master switchover T284648"'
```
**Clean up tasks:**
[x] change events for query killer:
```
events_coredb_master.sql on the new master db1157
events_coredb_slave.sql on the new slave db1123
```
[x] Update DNS: https://gerrit.wikimedia.org/r/c/operations/dns/+/698982
[x] Update candidate master dbctl notes
```
sudo dbctl instance db1123 set-candidate-master --section s3 true
sudo dbctl instance db1157 set-candidate-master --section s3 false
```
[x] Check tendril was updated
[x] Check zarcillo was updated
** db-switchover should do this. If it fails, do it manually: https://phabricator.wikimedia.org/P13956
[x] Depool OLD master, as it's running 10.1, replicating from a 10.4 master
```
sudo dbctl instance db1123 depool
sudo dbctl config commit -m "Depool db1123 until it's reimaged to buster T284648"
```
[] Apply outstanding schema changes to db1123 (if any)
[] Update/resolve this ticket.