vCloud Director Postgres migrate from MSSQL to POSTGRESQL (test&dev only!)

Carsten Landeck
20. October 2017
Reading time: 3 min

[et_pb_section bb_built=”1″][et_pb_row][et_pb_column type=”4_4″][et_pb_text _builder_version=”3.0.105″]

With VCD 9.0 PostgreSQL 9.5 support was introduced.

This article describes how you do a migration of your test VCD from an external MSSQL to a “internal” postgres DB installed on a single cell VCD.

(for  production environment please refer to VMware and use SSL encryption for the DB access and put the new DB on an external host. Also consider building a postgres HA solution for your production environment).

  1. Install PostgreSQL to your Centos or Redhat single Cell installation

you may have to add EPEL first. (yum install epel-release)

yum install
yum install postgresql95-server postgresql95-contrib
/usr/pgsql-9.5/bin/postgresql95-setup initdb

2. Configure Postgres Security and Access

vi /var/lib/pgsql/9.5/data/pg_hba.conf

# Open for all and everyone
host    all             all               md5
host    all             all             ::1/128                 md5
host all all trust
vi /var/lib/pgsql/9.5/data/postgres.conf

# TCP Listen
listen_address = '*'
port= 5438

3. Enable and Start Service

systemctl enable postgresql-9.5.service
systemctl start postgresql-9.5.service

4. Set Password for postgres User

sudo -i -u postgres
alter user postgres password 'Pa$w0rd';

5. Create VCD DB

create user vcloud;
alter role vcloud with login;
grant all privileges on database vcloud to vcloud;
alter user vcloud password 'Pa$w0rd';

6. Shutdown Cell and Migrate

# a
# Shut Down Cell
/opt/vmware/vcloud-director/bin/cell-management-tool cell -u Administrator --shutdown

# b
# Migration 
/opt/vmware/vcloud-director/bin/cell-management-tool dbmigrate -dbhost -dbname vcloud -dbuser vcloud -dbport 5432  

# c
# Reconfigure DB
/opt/vmware/vcloud-director/bin/cell-management-tool reconfigure-database -dbuser vcloud -dbpassword 'Pa$w0rd' -dbport 5432 -dbhost -dbname vcloud -dbtype postgres

# d
# Start VCD
service vmware-vcd start

# e 
# Watch Cell Log while startup
tail -f /opt/vmware/vcloud-director/logs/cell.log

The Log should state something like:

Successfully connected to database: jdbc:postgresql://
Successfully initialized system cryptography

Some hints:

In the official documentation the switch “-dbtype postgres” for reconfigure database was not listet. Also the documentation says use “cell-management-tool reconfigure-database” without any parameters – which did not work for me at all. Though the wizard said success, but the still showed the wrong MSSQL DB.

If you want to stick to MSSQL you may install a free linux based MSSQL on you cell instead of a postgres. Sebastian wrote a nice blog about the installation.

You may also refer to this Blog:

Migrate vCloud Director 9.0 DB from MSSQL to Postgres

and VMware documentation

and VMware documentation part 2