stolon can promote a standby cluster to a primary cluster. However, it can't demote a primary cluster to become a standby cluster.
Why is this needed:
Currently, only way is to rebuild the cluster (correct me if I am wrong). It's not efficient. Imagine rebuilding a cluster of 10TB size. It can take multiple hours.
Rough idea on how to implement:
On the failed cluster,
stop the keepers, sentinels, proxies
update cluster.Spec.Role to standby and primary db's db.Spec.Role to standby
create a recovery.conf file only on the primary. Not sure whether we need to populate the content in it. If needed we can do that using standbyConfig.standbySettings.primaryConninfo
remove postgresql.auto.conf file on the primary
run pg_rewind on the all Postgres severs (primary and replica too - in case they are ahead)
What would you like to be added:
stolon can promote a standby cluster to a primary cluster. However, it can't demote a primary cluster to become a standby cluster.
Why is this needed:
Currently, only way is to rebuild the cluster (correct me if I am wrong). It's not efficient. Imagine rebuilding a cluster of 10TB size. It can take multiple hours.
Rough idea on how to implement:
On the failed cluster,
standby
and primary db's db.Spec.Role tostandby
Let me know your thoughts @sgotti