How it works...

Unfortunately our first order of business is to break the entire cluster. The key-value layer is essential to storing the cluster definition, as well as ensuring only one PostgreSQL server ever wins the leader race. It's one element that is not optional, and as a result, we must shut down all of our Patroni instances in order to swap out all key-value references at once.

While we suggest stopping the leader node last, this is not entirely essential. However, avoiding needless failovers is always beneficial to cluster health.

Next we need to remove the etcd and corresponding host line from the Patroni stampede.yml configuration file. We can then add equivalent consul and host lines that inform Patroni to use Consul instead. ...

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.