vitabaks / postgresql_cluster

PostgreSQL High-Availability Cluster (based on Patroni). Automating with Ansible.
https://postgresql-cluster.org
MIT License
1.69k stars 411 forks source link

is there a way to Stop/Start Cluster? #460

Closed snapshotleisure closed 1 year ago

snapshotleisure commented 1 year ago

Hi, I was wondering if there was a way to stop and start the cluster?

As in it stops all instances of ectd/haproxy/postgresql and also start them up in the right order?

The use case will be if there is a need to stop the whole cluster for maintenance or physical server relocation

Thanks!

vitabaks commented 1 year ago

Hi!

Use systemctl stop patroni

when the server starts, all services will start automatically (in the right order)

snapshotleisure commented 1 year ago

Hi Vitabaks,

Thank you for the quick response!

For a 3 node cluster though, would I try and send the systemctl stop patroni to all 3 nodes at the same time?

Or will there possibility be some corruption, if I stop one at a time, as a 3 node cluster can only survive a 1 node outage?

Thank you for your time!

vitabaks commented 1 year ago

First the replicas, then the master. Then start the master first, then the replicas.

snapshotleisure commented 1 year ago

Hi Vitabaks

Wonderful! Thank you very much!