PostgreSQL Activate Standby (Failover)

Follow

Activation or Failover or Promotion of standby postrgeSQL cluster will make the standby cluster accessible in read-write mode to your application(s). You can execute the Activate standby in case your primary server or cluster is completely down or when performing a DR Test.

1. Concept

This process can be run also in case primary cluster isn’t accessible at all. The Activation is irreversible process.

Activation process is the same for WAL Streaming and WAL shipping configurations

The Activation process has following steps:

A. Disable Observer for the configuration

B. Promote Standby PostgreSQL cluster

C. Execute User Script (Optional)

2. Standby Activation

To activate your standby PostgreSQL cluster, select Activate Standby from ACTIONS pane:

image-20250320-071127.png

On following screen you’re able to see the Activation readiness status (1), select User scripts to be executed post Activation (2) and start the Activation process (3).

image-20250320-071217.png

When ready, click on Activate and confirm that you want to proceed. After activation completes, the configuration in dbvcontrol dashboard will be in “IN FAILOVER STATE” status and former standby server will be promoted to primary:

image-20250320-071505.png

3. Recover from Standby Activation

Recovery from Standby Failover is semi-automated process where user needs to perform several steps.

A. Stop and delete the old primary PostgreSQL cluster

This can be done for example by running on old primary server:

/usr/pgsql-16/bin/pg_ctl -D /var/lib/pgsql/16/data stop

Once the instance is stopped, delete the old primary data files:

rm -rf /var/lib/pgsql/16/data/*

Old primary cluster should have status “NOT PRESENT” in the dashboard afterwards:

image-20250320-072248.png

B. Recover the configuration from failover

In the ACTIONS pane, click on recover from failover (1) and confirm the action (2):

image-20250320-072412.pngimage-20250320-072459.png

The configuration will then be reversed to the state as it was before creating PostgreSQL DR cluster:

image-20250320-072554.png

C. Reinstate the old primary PostgreSQL cluster as standby

Proceed with steps in Creating PostgreSQL Standby Cluster to reinstate the old primary database as standby. Once finished, the replciation will be established in the opposite direction as before switchover:

image-20250320-072720.png

D. Perform graceful Switchover

Follow steps in Graceful Switchover in order to reverse the replication and get back to the original state as it was before the activation. After switchover, the configuration will have following state in the dashboard:

image-20250320-073011.png
Have more questions? Submit a request

Comments