You can use a repmgr command to switch the roles of the primary and one of the standby nodes in your database high availability cluster during a planned maintenance.
- Put all vCloud Director cells that are part of the high availability cluster into maintenance mode.
- Verify that all the nodes in the cluster are healthy and online.
- Log in or SSH as root to the OS of the standby node that you want to promote.
- Change the user to postgres.
sudo -i -u postgres
- (Optional) Verify that the prerequisites for the switchover are met by running the command with the --dry-run option.
/opt/vmware/vpostgres/current/bin/repmgr standby switchover -f /opt/vmware/vpostgres/current/etc/repmgr.conf --siblings-follow --dry-run
- Switch the roles of the primary and the standby cell.
/opt/vmware/vpostgres/current/bin/repmgr standby switchover -f /opt/vmware/vpostgres/current/etc/repmgr.conf --siblings-follow
The last line of the console output indicates that the standby switchover has completed successfully.
What to do next
- Run the reconfigure-database command to update the database IP address on all vCloud Director cells. See Update the Database IP Addresses on vCloud Director Cells.
- When you reconfigure the vCloud Director cells in the server group to point to the new primary database, take out of maintenance mode all vCloud Director cells that are part of the high availability cluster.