Charmed PostgreSQL K8s How-to - Removal of Async replication

Removal of Async replication

WARNING: it is an internal article. Do NOT use it in production! Contact Canonical Data Platform team if you are interested in the topic.

Pre-requisits

Make sure both Rome and Lisbon Clusters are deployed using the Async Deployment manual!

Detach Cluster from Async Replication Setup

Note: It is important to switchover the Primary Cluster before detaching it from Async Replication Setup!

Assuming the Lisbon is a current Primary and we want to detach Rome (for removal or reuse):

juju remove-relation -m lisbon async-primary db2:async-replica

The command above will move cluster Rome into the detached state blocked keeping all the data in place.

Removing detached cluster

Remove no-longer necessary Cluster Rome (and destroy storage if Rome data is no longer necessary):

juju remove-application -m rome db1 # --destroy-storage

New Cluster from detached Cluster

Convert Rome to the new Cluster keeping the current data in use:

juju run -m rome db1/leader promote-cluster