How it works...
This recipe relies on a dirty trick to avoid the long and irritating process of rebooting a server. The patroni daemon considers itself the solitary coordinator of the PostgreSQL service. Just as it will restart the PostgreSQL services that we stop without its permission, it will also stop the PostgreSQL service if we end the patroni service itself.
Since we set up Patroni as a system service, we can use the systemctl command to stop the patroni daemon. We need to stop Patroni on the server currently acting as the primary node. Without Patroni running on this server, the lock on the primary node pointer in the key-value layer will expire. Upon the next internal status iteration, both pgha1 and pgha3 will notice there's no ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access