vCloud Director 9.5 – Move to appliance and Postgres database

With the release of vCloud Director 9.5 it became known that only Postgres will be supported in the future as database backend. MS SQL was flagged as deprecated and Oracle is no longer supported with vCD 9.5 onwards. In addition vCloud Director has also been released as an appliance based on PhotonOS. Therefore, I would like to explain how you can switch to the new appliances and the database backend in a few steps.

If you are already on vCloud Director 9.0 or 9.1, you should first migrate the database backend to Postgres and then update vCloud Director.

So, the procedure is as follows:

  1. Migrate database backend to PostgreSQL while you are on vCD 9.0 or 9.1
  2. Update your existing vCloud Director cells to 9.5
  3. Upgrade the database schema after the cell upgrade
  4. Place the response.properties file on the NFS share
  5. Deploy the new vCD 9.5 appliances
  6. Decommission the old cells

But one thing at a time.

Initial configuration of the postgres database

First you need a Postgres database server. I won’t explain how to install postgres because there are already enough guides on the internet for all common operating systems.

After the installation we switch to the postgres user under which the database runs and initialize the vcloud database with the UTF-8 encoding:


su postgres
initdb --locale=en_US.UTF-8

Then, we log on to the database system (as user “postgres”):


psql

And create the vcloud database, users and permissions.


create role vcloud;
create database vcloud owner vcloud;
alter role vcloud with login;
\password vcloud
grant all privileges on database vcloud to vcloud;
\q

Afterwards some settings in the postgres.conf and pg_hba.conf file have to be changed to optimize the performance and to allow the new user to log in externally.

postgres.conf


listen_addresses = '0.0.0.0'
port = 5432
max_connections = 500
password_encryption = md5
# Set effective cache size to 50% of total memory.
effective_cache_size = 4GB
# Set shared buffers to 25% of total memory
shared_buffers = 2GB
autovacuum = on
track_counts = on
autovacuum_max_workers = 3
autovacuum_naptime = 1min
autovacuum_vacuum_cost_limit = 2400

In the file “pg_hba.conf” add the following line at the bottom:


host vcloud all 10.1.1.0/24 md5

(Change the subnet to a network from which access should be allowed.)

Finally, the postgres service must be restarted after all these config changes.

Database migration

The process of the database migration is roughly described in the official documentation. And VMware has also added an option for database migration to the cell-management-tool. We can use this option to migrate the database completely and easily.

For safety reasons, a complete backup of the existing database and snapshots of all vCD cells is absolutely mandatory!

At first, stop the vcd service on all cells:


service vmware-vcd stop

If all vcd services are stopped we can proceed with the migration.

Go to the path “/opt/vmware/vcloud-director/bin” and execute the following command on any cell (please adjust the ip address of the db server, db name, db user and db password to your needs):


./cell-management-tool dbmigrate -dbhost 10.1.1.5 -dbport 5432 -dbuser vcloud -dbname vcloud -dbpassword "vcl0ud-user-P@ssw0rd"

It will first check some things like the supported version of the database and start with the migration afterwards.

Next, we must reconfigure the database connection settings on each cell. This will update the global.properties and response.properties file.


./cell-management-tool reconfigure-database -dbhost 10.1.1.5 -dbport 5432 -dbtype postgres -dbname vcloud -dbuser vcloud -dbpassword "vcl0ud-user-P@ssw0rd"

(Again, please change the dbhost, dbname, dbuser and dbpassword settings to your needs.)

To check if the change and migration was successful, you should disable the old database or make it inaccessible to the vCloud Director cells (either by turning off the old database server, changing the password, or disabling the firewall rule).

Once this is done, we can start the vCD services on all cells and log into the Web GUI to check if everything works.


service vmware-vcd start

Upgrade the existing vCloud Director cells to version 9.5

VMware also provides an vCloud Director 9.5 upgrade guide with some useful information. I recommend to check it out.

First we stop the vCD services on all cells again:


service vmware-vcd stop

After that, a backup of the database and snapshots of all cells is again absolutely recommended.

For the database backup we can now use the command “pg_dump” on the Postgres server:


su postgres
cd /tmp
pg_dump vcloud

Afterwards you can follow the normal update procedure:

  • Download the installation .bin file for vCD 9.5 from the VMware website
  • Upload it to every cell and place it in /tmp
  • Make this file executable
  • Start the installation routine

cd /tmp
chmod u+x vmware-vcloud-director-distribution-9.5.0-10266189.bin
./vmware-vcloud-director-distribution-9.5.0-10266189.bin

At the end of the installation process you will be ask if the database schema should also be upgraded. This only needs to be done on the first cell. For the remaining cells we can answer this question in the negative.

When everything is updated, we can start the vcd services again and check if everything works.

Deploy the new vCD 9.5 appliances

This process is pretty straight forward.

You start by copying the response.properties file from any cell to the NFS share.


cp /opt/vmware/vcloud-director/etc/response.properties /opt/vmware/vcloud-director/data/transfer/

Now you can deploy and configure the OVA files in the vSphere Web Client like any other OVA / OVF deployment.

It is only important that the “vCD First Run Wizard Setup” item in the configuration dialog is omitted and not configured. Otherwise the database would be reinitialized. The “vCD First Run Wizard” configuration is only necessary if it’s the first member in a cluster (see here).

After the deployment is finished, you can start the new vCloud Director VM(s).

When you log in to the vCD Web GUI as System Administrator, you should already see the new cells under  “Manage & Monitor” -> “Cloud Cells”.

Decommissioning of the old cells

A mixed vCloud Director installation with Linux and vCD appliances within a server group is not supported by VMware. That’s why you need to take the old Linux-based cells out of service.

Either you stop the vcd services on these cells or you power off the VMs completely.


service vmware-vcd stop

After a short moment these cells should be displayed as “Disconnected” in the Cloud Cells overview in the Web GUI. If you then select these disconnected cells and click on the action dialog symbol, you should see the option “Delete”.

This allows to permanently remove these cells from the cluster.

That’s it. You migrated the database backend to Postgres, successfully upgraded your vCD 9.0 or 9.1 installation to version 9.5, and switched from Linux-based vCloud Director installations to vCloud Director OVA appliances provided by VMware. Congratulations.

 

One Reply to “vCloud Director 9.5 – Move to appliance and Postgres database”

Leave a Reply

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