stolon icon indicating copy to clipboard operation
stolon copied to clipboard

To create a stolonctl demote sub-command

Open viggy28 opened this issue 3 years ago • 0 comments

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,

  1. stop the keepers, sentinels, proxies
  2. update cluster.Spec.Role to standby and primary db's db.Spec.Role to standby
  3. 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
  4. remove postgresql.auto.conf file on the primary
  5. run pg_rewind on the all Postgres severs (primary and replica too - in case they are ahead)

Let me know your thoughts @sgotti

viggy28 avatar Jul 29 '22 05:07 viggy28