There's more...

The analogous process to adding a node to the cluster stack is to remove one. That procedure is considerably easier and mainly involves executing these commands as the postgres user to remove pg2. For example:

pkill patroni
export MEMBER=$(etcdctl member list | grep pg2 | cut -d ':' -f 1)
etcdctl member remove $MEMBER

Since the etcd layer is persistent across all nodes, pg2 is permanently removed from all of them unless we add it again by following this recipe. Once Patroni is stopped and etcd no longer considers pg2 part of the key-value layer, we can safely recycle the server without worry.

We also need to remove references to pg2 from the HAProxy configuration file, but that isn't critical.

Hopefully you're making use ...

Get PostgreSQL High Availability Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.