Deep Dive in to Virtualization & Cloud

VMware vCloud Director Cell Role Switchover

VMware vCloud Director (vCD) is deployment, automation, and management software for virtual infrastructure resources in multi-tenant cloud environments. VMware vCloud Director provides role-based access to a Web console that allows the members of an organization to interact with the organization’s resources to create and work with vApps and virtual machines.

In this blog we will do learn how the vCloud Director Database high availability functions. I have already created a blog on vCloud Director deployment with Database high availability and please refer this before you start with clustered deployment.

How vCloud Director HA Function

The vCloud Director appliance includes an embedded PostgreSQL database. The embedded PostgreSQL database includes the Replication Manager (repmgr) tool suite, which provides a high availability (HA) function to a cluster of PostgreSQL servers. You can create an appliance deployment with a database HA cluster that provides failover capabilities to your vCloud Director database. You can deploy the vCloud Director appliance as a primary cell and two standby cells. Also, you can deploy additional instances of the vCloud Director appliance in the server group as vCD application cells, which run only the vCloud Director group of services without the embedded database. vCD application cells connect to the database in the primary cell.

Deploy the vCloud Director appliance as a primary cell and two instances of the vCloud Director appliance as standby cells. After the initial standby appliance deployment, the replication manager begins synchronizing its database with the primary appliance database. To view the status of the primary and the standby cells in an appliance database high availability (HA) cluster, you can log in to the appliance management user interface of any cell from the database HA cluster.

Switch Standby Node to Primary

Log in as root to the appliance management user interface of a running standby cell, In the Role column for the standby cell that you want to become the new primary cell, click Promote.

The cell becomes the new primary cell in running state. The other standby cell is following the newly promoted primary cell. 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.

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

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

Also, you can see the GUI as your standby node changed to primary and other nodes are following new primary.

You can use below command to see the database server details on other nodes, it should be automatically updated to the primary node.

#grep "database.jdbcUrl" /opt/vmware/vcloud-director/etc/

If any of the cells is not updated, run the command to reconfigure it

Initially stop the cell service on specific node

#service vmware-vcd stop

Use below command to update the database node details and start the services

#/opt/vmware/vcloud-director/bin/cell-management-tool reconfigure-database --database-host primary node IP address
#service vmware-vcd start

Remove Failed Node from Cloud Cells

Finally use the Service Provider Admin Portal to remove the failed primary appliance from the vCloud Director server group

From the menu select Cloud ResourcesCloud Cells Unregister

Remove the failed primary appliance from the repmgr high availability cluster. You can use below commands to achieve the same.

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

Run the below command to get the node ID details

$ /opt/vmware/vpostgres/current/bin/repmgr cluster show

To verify that the prerequisites for unregistering the node are met, run the command with the –dry-run option

$ /opt/vmware/vpostgres/current/bin/repmgr primary unregister --node-id=node ID --dry-run

Unregister the node

$ /opt/vmware/vpostgres/current/bin/repmgr primary unregister --node-id=node ID

In upcoming blogs, we will discuss more on VMware vCloud Director. To make this vCD series more understandable, I am splitting this into multiple blogs

Part 1 – What is VMware vCloud Director

Part 2 – VMware vCloud Director Standalone Installation

Part 3 – VMware vCloud Director Installation with High Availability

Part 4 – VMware vCloud Director – Install and Configure RabbitMQ Cluster

Part 5 – VMware vCloud Director Cell Certificates & Load Balancing

Part 6 – VMware vCloud Director Cell Role Switchover

Part 7 – VMware vCloud Director Basic Configuration

Part 8 – VMware vCloud Director Virtual Data Center

Part 9 – VMware vCloud Director Org vDC Configuration


If you have any comments, please drop me a line.
I hope this article was informative, and don’t forget to buy me a coffee if you found this worth reading.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.