Blog

Immer aktuell informiert sein in unserem Blog!

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 https://yum.postgresql.org/9.5/redhat/rhel-7.3-x86_64/pgdg-redhat95-9.5-3.noarch.rpm
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             127.0.0.1/32            md5
host    all             all             ::1/128                 md5
host all all 0.0.0.0/0 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
psql
alter user postgres password 'Pa$$w0rd';

 

5. Create VCD DB

CREATE DATABASE vcloud;
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 127.0.0.1 -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 127.0.0.1 -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://127.0.0.1:5432/vcloud?socketTimeout=90
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 responses.properties 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

Unseren Newsletter abonnieren