Page MenuHomePhabricator

etcd primary cluster switchover (eqiad -> codfw)
Closed, ResolvedPublic

Description

Status

As of ~ 13:50 UTC on 2026-08-04, codfw is the now the main-etcd primary cluster.

While no further operational actions are planned as part of this task, I will keep it open until I am able to refresh the Wikitech documentation.


Background

In order to reimage the eqiad conf* hosts (T428495), we first need to switch the etcd primary (R/W) cluster to codfw. This is what will allow us to fully depool etcd client traffic from eqiad in advance of the reimage.

Procedure

See https://wikitech.wikimedia.org/wiki/Etcd/Main_cluster#Master_cluster_switchover for prior art. A subsidiary goal of this work is to refresh that documentation.

Timing - Running through the full procedure below, the read-only period (steps 3 through 12) lasted ~ 17 minutes.

  1. Reduce the TTL for conftool (R/W) etcd client SRV records to 10 seconds.
  2. (shortly before) Silence the EtcdReplicationDown alert.
    • Created c54ed5b4-f2c8-4797-8ab0-907a13fc9d93
  3. Begin read-only in the etcd cluster we are switching from (eqiad).
  4. Verify read-only
    • Attempting to depool a host should fail, e.g., sudo confctl select 'name=wikikube-worker2330.codfw.wmnet' set/pooled=no
  5. Disable puppet on the current and new replication hosts
    • sudo cumin 'conf2005.codfw.wmnet,conf1008.eqiad.wmnet' 'disable-puppet "etcd replication switchover"'
  6. Merge a puppet patch that disables etcd replication in the cluster we are switching to (codfw) and enables it in the cluster we are switching from (eqiad).
  7. Run puppet-agent on the current replication host in the cluster we are switching to (codfw) (replication stops)
    • (on conf2005.codfw.wmnet) sudo run-puppet-agent -e "etcd replication switchover"
    • (on conf2005.codfw.wmnet) confirm that etcdmirror--eqiad-wmnet.service has terminated
  8. Set the replication index in the cluster we are switching from (eqiad)
    • Invoke index update script as in T433554#12169821 from any eqiad cluster member (e.g., the new replication host: conf1008)
  9. Run puppet-agent on the new replication host in the cluster we are switching from (eqiad) (replication starts)
    • (on conf1008.eqiad.wmnet) sudo run-puppet-agent -e "etcd replication switchover"
    • (on conf1008.eqiad.wmnet) confirm that etcdmirror--codfw-wmnet.service has started
  10. Test replication via a local mutation on any member of the cluster we are switching to.
    • (on conf1008.eqiad.wmnet) Monitor replication progress: journalctl -f -u etcdmirror--codfw-wmnet.service
    • (on conf2005.codfw.wmnet or any other codfw cluster member)
      • curl https://$(hostname -f):2379/v2/keys/test -XPUT -d value=""
      • curl https://$(hostname -f):2379/v2/keys/test -XDELETE
  11. Switch the conftool (R/W) etcd client SRV records to the cluster we are switching to.
  12. Begin read-write in the etcd cluster we are switching to (codfw)
  13. Verify read-write
    • Attempting to depool a host should succeed, e.g., sudo confctl select 'name=wikikube-worker2330.codfw.wmnet' set/pooled=no.
      • Remember to repool the host (e.g., sudo confctl select 'name=wikikube-worker2330.codfw.wmnet' set/pooled=yes).
  14. Restart hiddenparma (requestctl), since it will likely have cached connections toward the cluster we are switching from (i.e., the next edit attempt will fail).
    • (alert1002.wikimedia.org, alert2002.wikimedia.org) sudo systemctl restart hiddenparma.service
  15. Announce all-clear
  16. Delete EtcdReplicationDown silence. If the alert is still firing in the cluster we are switching to (i.e., where etcd-mirror was running previously), it means the ops prometheus host(s) in that DC need a puppet-agent run (you can just wait for this to happen organically before deleting the silence).
    • Deleted c54ed5b4-f2c8-4797-8ab0-907a13fc9d93
  17. Restore the TTL for conftool (R/W) etcd client SRV records to 5 minutes.

Event Timeline

Scott_French changed the task status from Open to In Progress.
Scott_French triaged this task as High priority.
Scott_French moved this task from Inbox to In Progress on the ServiceOps board.

Change #1319191 had a related patch set uploaded (by Scott French; author: Scott French):

[operations/puppet@production] hieradata: etcd read-only in eqiad

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

Change #1319192 had a related patch set uploaded (by Scott French; author: Scott French):

[operations/puppet@production] hieradata: switch etcd replication from codfw to eqiad

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

Change #1319193 had a related patch set uploaded (by Scott French; author: Scott French):

[operations/puppet@production] hieradata: etcd read-write in codfw

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

Change #1319194 had a related patch set uploaded (by Scott French; author: Scott French):

[operations/dns@master] wmnet: Reduce _etcd._tcp.conftool (R/W) SRV TTL to 10s

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

Change #1319195 had a related patch set uploaded (by Scott French; author: Scott French):

[operations/dns@master] wmnet: Switch _etcd._tcp.conftool (R/W) SRV hosts to codfw

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

Change #1319196 had a related patch set uploaded (by Scott French; author: Scott French):

[operations/dns@master] wmnet: Restore _etcd._tcp.conftool (R/W) SRV TTL to 5M

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

P95724 contains a refreshed version of the script shown in T166552#3303028. As before, this assumes replication has converged (i.e., we are read-only and the old replica is fully caught up).

For our use case, this would look something like the following, invoked from any eqiad conf* host (note: the --old-replica host can be any codfw host):

python3 set_mirror_index.py --protocol https --old-replica conf2005.codfw.wmnet:4001 --new-replica $(hostname -f):2379 --prefix __ROOT__

Change #1319194 merged by Scott French:

[operations/dns@master] wmnet: Reduce _etcd._tcp.conftool (R/W) SRV TTL to 10s

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

Change #1319191 merged by Scott French:

[operations/puppet@production] hieradata: etcd read-only in eqiad

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

Change #1319192 merged by Scott French:

[operations/puppet@production] hieradata: switch etcd replication from codfw to eqiad

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

Change #1319195 merged by Scott French:

[operations/dns@master] wmnet: Switch _etcd._tcp.conftool (R/W) SRV hosts to codfw

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

Change #1319193 merged by Scott French:

[operations/puppet@production] hieradata: etcd read-write in codfw

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

Change #1319196 merged by Scott French:

[operations/dns@master] wmnet: Restore _etcd._tcp.conftool (R/W) SRV TTL to 5M

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

New discoveries today while depooling client traffic from eqiad (to be updated as we go):

  • conftool2git.service runs on puppetserver1003 and, although being a read-only workload w.r.t. etcd, follows the conftool-specific R/W SRV record. Thus, it needed restarted to switch to codfw.
  • zarcillo in aux-k8s-eqiad tracks the same SRV record (although read-only) and thus also needs restarted if the switch is happening in advance of a disruptive maintenance.

With that, I believe there's nothing else tracked here.