In this vCloud Director Migrations: Linux vCD external SQL DB to vCD Appliance – Part 2, I will migrate a Linux vCloud Director with an external SQL Server DB into a new vCloud Director Appliance with embedded Postgres DB.
Before I start, honestly, I would like that VMware could write documentation that easy to read and easy to follow. To do this migration process and the other migrations that I already have written about vCloud Director migrations, VMware has no proper documentation that you can follow all the steps without any doubts.
If any of the bloggers can write a step-by-step migrations process without any doubts, what are the steps, when, where, and how to do it, why VMware cant? That is my question.
If the first migration I have written is very straightforward, this migration and migrating from Linux vCloud Director with embedded Postgres DB to a vCloud Director Appliance are not. It needs extra steps, and some files need to be copied in a certain step, not before, not after.
I need to do many tests before I was able to this with success and without any post-migration issues in the new vCloud Director Appliance.
Also, I would like to thanks Marian Fischer for his tips and time to support me and put me on the right track to do this.
That been said, lets us start.
This is the source environment:
- Linux CentOs 7
- vCloud Director 9.7.0
- 2 vNIC with 2 IPs
- IP1: 192.168.1.114/24 – Used for HTTP and Console Access
- IP2: 192.168.1.115/24 – Used for DB
- 2 vNIC with 2 IPs
- vCenter / vSphere 6.7
- NSX-V 6.4.8
Destination source environment(after upgrade and migration):
- vCloud Director 9.7.0 Appliance
- 2 vNIC with 2 IPs
- IP1: 192.168.1.110/24 – Used for HTTP and Console Access
- IP2: 192.168.2.210/24 – Used for DB
- 2 vNIC with 2 IPs
- vCenter / vSphere 6.7
- NSX-V 6.4.8
As I said, this is a Linux vCD 9.7, meaning that it can still support an external SQL Server DB, in vCD 10.x is not supported anymore. So if you upgrade the Linux vCD 9.7 to 10.x, was not able to use SQL Server DB anymore and needed to perform the migration in two steps.
Note: As we stated in my previous article, I will go through how to install vCD Appliance since there are many documentation and blog posts on how to do this.
How to migrate Step-by-Step.
Note: So that it is easy to identify the steps and area to do those steps/commands, I will refer to Source Linux vCD(vCD with External SQL DB) and Destination vCD Appliance (as the new vCD Appliance that you did install)
1. – Stop vCD cells in both vCDs
Source Linux vCD – stop vCD
1 2 3 |
[root@Linux-vCDSQL-DB ~]# /opt/vmware/vcloud-director/bin/cell-management-tool -u administrator cell --shutdown |
Destination Appliance – stop vCD
1 2 3 |
[root@Destination-vCD-Appliance [ / ]#/opt/vmware/vcloud-director/bin/cell-management-tool -u administrator cell --shutdown |
2. – On Source Linux vCD, start migration DB from Source Linux vCD to Destination vCD Appliance.
1 2 3 |
[root@Linux-vCDSQL-DB ~]#/opt/vmware/vcloud-director/bin/cell-management-tool dbmigrate -dbhost 192.168.2.110 -dbport 5432 -dbuser vcloud -dbname vcloud -dbpassword "password.123" |
First, try to migrate, ERROR.
1 2 3 4 5 |
May 01, 2021 3:05:38 PM org.postgresql.Driver connect SEVERE: Connection error: org.postgresql.util.PSQLException: FATAL: no pg_hba.conf entry for host "192.168.2.120", user "vcloud", database "vcloud", SSL off |
Since I did a lot of tries and rollbacks, in this case, I forget to change Destination vCD Appliance to accept connections from Source Linux vCD.
How to do this?
In this Destination vCD Appliance, do the following steps.
1 2 3 4 |
[root@Destination-vCD-Appliance [ / ]# cd /opt/vmware/appliance/etc/pg_hba.d [root@Destination-vCD-Appliance [ /opt/vmware/appliance/etc/pg_hba.d ]# vi access |
Add the following line(s). Replace the IPs with your environment IP. You can add the network, or you can add the IPs from the Source Linux vCD. I add both networks.
host all all 192.168.1.0/24 md5
host all all 192.168.2.0/24 md5
Then cat the file pg_hba.conf and wait until pg_hba.d has added the new entries.
1 2 3 |
[root@Destination-vCD-Appliance [ /opt/vmware/appliance/etc/pg_hba.d ]# cat /var/vmware/vpostgres/10/pgdata/pg_hba.conf |
When the new entries are displayed, restart your migration by running migrate command again.
2. – On Source Linux vCD
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
[root@Linux-vCDSQL-DB ~]# /opt/vmware/vcloud-director/bin/cell-management-tool dbmigrate -dbhost 192.168.2.110 -dbport 5432 -dbuser vcloud -dbname vcloud -dbpassword "Manager.2010" Configuring the target database... .......\ Successfully configured the target database. Target database is using PostgreSQL version 10.6 (VMware Postgres 10.6.0-11022610 release). Blacklisted licensing_vm_data. Finished clearing tables for migration. Beginning database migration. ......................................................................................................................................................................................................................................................................................................................................... Database migration succeeded. SUCCESS:329 FAILED:0 SKIPPED:0 To start using this database, run the cell-management-tool reconfigure-database command on each cell in your server group by executing the following command with the migrated databases connection properties: /opt/vmware/vcloud-director/bin/cell-management-tool reconfigure-database [root@Linux-vCDSQL-DB ~]# |
DB was successfully migrated to the Destination vCD Appliance.
We need to backup and copy some files in Source Linux vCD and Destination vCD Appliance.
3. – In Destination vCD Appliance, create folders and backup files to it.
Files are: global.properties, responses.properties, truststore, certificates, proxycertificates, and certificates.ks
1 2 3 4 5 6 7 8 9 10 11 12 |
[root@Destination-vCD-Appliance [ / ]# mkdir /DestinationCerts [root@Destination-vCD-Appliance [ / ]# mkdir /SourceCerts [root@Destination-vCD-Appliance [ / ]# cp /opt/vmware/vcloud-director/etc/global.properties /DestinationCerts [root@Destination-vCD-Appliance [ / ]# cp /opt/vmware/vcloud-director/etc/responses.properties /DestinationCerts [root@Destination-vCD-Appliance [ / ]# cp /opt/vmware/vcloud-director/etc/truststore /DestinationCerts [root@Destination-vCD-Appliance [ / ]# cp /opt/vmware/vcloud-director/etc/certificates /DestinationCerts [root@Destination-vCD-Appliance [ / ]# cp /opt/vmware/vcloud-director/etc/proxycertificates /DestinationCerts [root@Destination-vCD-Appliance [ / ]# cp /opt/vmware/vcloud-director/certificates.ks /DestinationCerts |
4. – In Source Linux vCD, copy the same files to Destination vCD Appliance (do not replace them for now).
We could copy directly to the destination folder, but I prefer to copy to a temporary folder and then replace the destination files with safety.
First backup the certificates.ks file. We will need this file later on.
1 2 3 4 |
[root@Linux-vCDSQL-DB /]# mkdir CertBackup [root@Linux-vCDSQL-DB /]# cp /opt/vmware/vcloud-director/certificates.ks /CertBackup |
Now copy files to destination using scp command.
1 2 3 4 5 6 7 8 9 10 |
[root@Linux-vCDSQL-DB /]# scp opt/vmware/vcloud-director/etc/certificates opt/vmware/vcloud-director/etc/proxycertificates /opt/vmware/vcloud-director/etc/global.properties /opt/vmware/vcloud-director/etc/responses.properties /opt/vmware/vcloud-director/etc/truststore root@192.168.1.110:/SourceCerts Welcome to VMware vCloud Director VA root@192.168.1.110's password: certificates 100% 2249 2.4MB/s 00:00 proxycertificates 100% 2267 2.3MB/s 00:00 global.properties 100% 1781 1.8MB/s 00:00 responses.properties 100% 433 491.9KB/s 00:00 truststore 100% 979 1.3MB/s 00:00 |
Copy certificates.ks to transfer folder (in your previous vCD Appliance, make sure your NFS shared folder is mounted in /opt/vmware/vcloud-director/data/transfer)
1 2 3 4 5 6 7 8 |
[root@Linux-vCDSQL-DB /]# scp /CertBackup/certificates.ks root@192.168.1.110:/opt/vmware/vcloud-director/data/transfer Welcome to VMware vCloud Director VA root@192.168.1.110's password: Permission denied, please try again. root@192.168.1.110's password: certificates.ks 100% 4484 2.0MB/s 00:00 |
5. – In Destination vCD Appliance, replace files with files copied from Source vCD Linux.
1 2 3 4 5 6 7 8 9 |
[root@Destination-vCD-Appliance [ / ]# cd SourceCerts/ [root@Destination-vCD-Appliance [ /SourceCerts ]# ls global.properties responses.properties truststore certificates proxycertificates [root@Destination-vCD-Appliance [ /SourceCerts ]# cp *.properties /opt/vmware/vcloud-director/etc/ [root@Destination-vCD-Appliance [ /SourceCerts ]# cp truststore /opt/vmware/vcloud-director/etc/ [root@Destination-vCD-Appliance [ /SourceCerts ]# cp certificates /opt/vmware/vcloud-director/etc/ [root@Destination-vCD-Appliance [ /SourceCerts ]# cp proxycertificates /opt/vmware/vcloud-director/etc/ |
Just double-check files on the destination folder and check if all are own by vcloud:vcloud and date/time (to make sure files were copied and replaced)
1 2 3 |
[root@Destination-vCD-Appliance [ /SourceCerts ]# ls -la /opt/vmware/vcloud-director/etc/ |
Finally, copy certificates.ks
1 2 3 |
[root@Destination-vCD-Appliance [ / ]# cp /opt/vmware/vcloud-director/data/transfer /opt/vmware/vcloud-director/ |
Double-check the file in the destination folder if it was copied and had the proper permissions and ownership.
6. – After all files are copied and replaced is time to run the configurations cell command.
This command needs to be run with the exact parameters, or the configuration will fail.
Note: Keystore password needs to be the same as you have in Source Linux vCD (normally, the Keystore password is the root password used in the vCD install is saved with the firstboot).
If you can’t remember, you need to reset it in Source Linux vCD, restart the process, copy the file certificates.ks again from Source Linux vCD, and replace it in the Destination vCD Appliance.
Create a new Keystore password.
1 2 3 |
[root@Linux-vCDSQL-DB /]#/opt/vmware/appliance/bin/generate-certificates.sh NewKeystorePass |
Run the configuration cell command.
1 2 3 4 5 6 7 8 9 |
[root@Destination-vCD-Appliance [ / ]# /opt/vmware/vcloud-director/bin/configure --unattended-installation --database-type postgres --database-user vcloud \ > --database-password "Manager.2010" --database-host 192.168.2.110 --database-port 5432 \ > --database-name vcloud --database-ssl true --uuid --keystore /opt/vmware/vcloud-director/certificates.ks \ > --keystore-password "Manager.2010" --primary-ip 192.168.1.110 \ > --console-proxy-ip 192.168.1.110 --console-proxy-port-https 8443 .......\ Database configuration complete. |
Database configuration is complete, and now we can start the vCD service.
1 2 3 |
[root@Destination-vCD-Appliance [ / ]# service vmware-vcd start |
You can check the cell applications start with the log cell.log
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
[root@Destination-vCD-Appliance [ / ]# cat /opt/vmware/vcloud-director/logs/cell.log Bootstrap application: start All required system properties are present An unspecified error occurred during application start All required local configuration properties are present Successfully bound network port: 80 on host address: 192.168.1.110 Successfully bound network port: 443 on host address: 192.168.1.110 Successfully bound network port: 8999 on host address: 192.168.1.110 All required local configuration properties are present Successfully initialized system cryptography Successfully configured HTTP SSL Connector from certificate store: /opt/vmware/vcloud-director/etc/certificates Current locale "en" verified successfully. ...... ...... Application Initialization: 'com.vmware.vcloud.common.core' 91% complete. Subsystem 'com.vmware.vcloud.rest-api-handlers' started Application Initialization: 'com.vmware.vcloud.common.core' 95% complete. Subsystem 'com.vmware.vcloud.jax-rs-servlet' started Application Initialization: 'com.vmware.vcloud.common.core' 100% complete. Subsystem 'com.vmware.vcloud.ui-vcloud-webapp' started Application Initialization: 'com.vmware.vcloud.common.core' complete. Successfully handled all queued events. Warning: unable to verify the following cells share the transfer spooling area: 192.168.1.114 (4699a821-9410-42b4-8f8e-ee5973225bd5),192.168.1.110 (79351c13-96c5-4f66-acaa-dd00aba8c427) Cell startup completed in 1m 47s [root@Destination-vCD-Appliance [ / ]# |
When you see 100% complete and warning about the previous cell with the old IP, the system was migrated and configured with success.
7. – Now, we can open the vCD Appliance page, and we need to remove the old cell from the configuration.
Since this is vCloud Director 9.7 still uses the flash webpage version (using the beta html5 page will not have the option to remove the cells). We have a special VM with Windows 7 and an old Chrome to use flash pages in some of our old versions.
Login to vCloud Director
I double-check if my Organizations exist in the new vCD Appliance.
Next, go to Cloud Cells and remove the old Cell.
To make sure all was working ok, after a reboot, I login to one of the Organizations with Organization Local user and start some vApps to check if all was working.
With this last step, we have our Linux vCloud Director with an External SQL Server DB migrated to a new vCloud Director Appliance with embedded Postgres DB.
I hope this vCloud migration second part blog post vCloud Director Migrations: Linux vCD external SQL DB to vCD Appliance – Part 2 was useful for your migrations or upgrades on your vCloud Director infrastructures.
vCloud Director migrations series:
vCloud Director migrations series:
- vCloud Director Linux migration SQL DB to embedded PostgreSQL appliance – Part 1
- vCloud Director Migrations: Linux vCD external SQL DB to vCD Appliance – Part 2
- vCloud Director Migrations: Linux vCD to vCD Appliance – Part 3
Share this article if you think it is worth sharing. If you have any questions regarding this type of migration, or comments, comment here or contact me on Twitter.
Leave A Comment
You must be logged in to post a comment.