When: 2nd Feb at 09AM UTC
NEW primary: es1020
OLD primary: es1021
[x] Check configuration differences between new and old primary:
```
sudo pt-config-diff --defaults-file /root/.my.cnf h=es1020.eqiad.wmnet h=es1021.eqiad.wmnet
```
**Failover prep:**
[x] Disable writes to es4 by merging this patch: https://gerrit.wikimedia.org/r/c/operations/mediawiki-config/+/758715/
[x] Check there are no writes
[x] Silence alerts on all hosts:
```
sudo cookbook sre.hosts.downtime --hours 2 -r "Switchover es4 T300127" 'A:db-section-es4'
```
[x] Set NEW primary with weight 10
```
sudo dbctl instance es1020 set-weight 10
sudo dbctl config commit -m "Set es1020 with weight 10 T300127"
```
[x] Topology changes, move all replicas under NEW primary
```
sudo db-switchover --timeout=15 --only-slave-move es1021 es1020
```
[x] Disable puppet on both nodes
```
sudo cumin 'es1020* or es1021*' 'disable-puppet "primary switchover T300127"'
```
[x] Merge gerrit puppet change to promote NEW primary: https://gerrit.wikimedia.org/r/c/operations/puppet/+/758716
**Failover:**
[x] Log the failover:
```
!log Starting es4 eqiad failover from es1021 to es1020 - T300127
```
[x] Switch primaries:
```
sudo db-switchover --skip-slave-move es1021 es1020
echo "===== es1021 (OLD)"; sudo db-mysql es1021 -e 'show slave status\G'
echo "===== es1020 (NEW)"; sudo db-mysql es1020 -e 'show slave status\G'
```
[x] Promote NEW primary in dbctl, and remove read-only
```
sudo dbctl --scope eqiad section es4 set-master es1020
sudo dbctl config commit -m "Promote es1020 to es4 primary T300127"
```
[x] Restart puppet on both hosts:
```
sudo cumin 'es1020* or es1021*' 'run-puppet-agent -e "primary switchover T300127"'
```
**Clean up tasks:**
[x] Clean up heartbeat table(s).
[x] change events for query killer:
```
events_coredb_master.sql on the new primary es1020
events_coredb_slave.sql on the new slave es1021
```
[x] Update DNS: https://gerrit.wikimedia.org/r/c/operations/dns/+/758717
[x] Re-enable writes on es4: https://gerrit.wikimedia.org/r/c/operations/mediawiki-config/+/758918
[x] Update candidate primary dbctl notes
```
sudo dbctl instance es1021 set-candidate-master --section es4 true
sudo dbctl instance es1020 set-candidate-master --section es4 false
```
[x] Check zarcillo was updated
** db-switchover should do this. If it fails, do it manually: https://phabricator.wikimedia.org/P13956
[] Depool OLD primary for reimage
```
sudo dbctl instance es1021 depool
sudo dbctl config commit -m "Depool es1021 until it's reimaged to buster T300127"
```