vCloud Director Linux migration SQL DB to embedded PostgreSQL appliance – Part I

/vCloud Director Linux migration SQL DB to embedded PostgreSQL appliance – Part I

vCloud Director Linux migration SQL DB to embedded PostgreSQL appliance – Part I

In this blog post about vCloud Director Linux migration SQL DB to embedded PostgreSQL appliance – Part I, I will migrate vCD DB from an external SQL DB to embedded PostgreSQL DB and upgrade a Linux vCloud Director(vCD) to 10.x after I migrate this Linux vCD to a vCloud Director appliance.

Since I need to migrate and upgrade some of the vCloud Director we have in production, I build a PoC with the same Infrastructure to do all the migrations and upgrades and make sure all works ok without any issues before I do it in some of our productions vCloud Director.

This is the source environment:

  • Linux CentOs 7
  • vCloud Director 9.7
  • SQL Server 2017
  • vCenter / vSphere 6.7
  • NSX-V 6.4.8

Destination source environment(after upgrade and migration):

  • vCloud Director 10.x Appliance
  • vCenter / vSphere 6.7
  • NSX-V 6.4.8

The final plan is to upgrade the vCD to version 10.x and migrate the SQL DB to a vCD Appliance with embedded PostgresSQL.

This task needs to be done in parts since we have a vCD in a Linux machine and an external DB.

  1. Install PostgreSQL Linux vCD
  2. Migrate SQL DB to PostgreSQL Linux
  3. Upgrade vCD 9.7 to vCD 10.x
  4. Create a new vCD 10.x Appliance
  5. Migrate external DB to an embedded database
  6. Copy data and certificates data

The above tasks need to be done in parts and also the blog posts for each part.

So that this blog post is not too big, I will divide this article into two blog posts.

  • vCloud Director Linux migration SQL DB to embedded PostgreSQL appliance – Part I

1. Install PostgreSQL Linux vCD
2. Migrate SQL DB to PostgreSQL Linux
3. Upgrade vCD 9.7 to vCD 10.x

  • vCloud Director Linux migrationSQL DB to embedded PostgreSQL appliance – Part II

4. Create a new vCD 10.x Appliance
5. Migrate external DB to an embedded database
6. Copy data and certificates data

migration

Note: You don’t need to install in the vCD Linux. You can install it on any Linux server that you may have.

Important note: Always do a backup of all your systems(SQL Server DB, vCloud Director, PostgreSQL, NSX-V, etc.) before starting this process.

1. Install PostgreSQL Linux vCD

I will not go into much detail about how to install PostgreSQL into Linux CentOS 7. I will add the main commands to install the PostgreSQL.

Add PostgreSQL Yum Repository to CentOS 7:

Check all packages:

vCloud Director Linux migrate SQL DB to embedded PostgreSQL appliance - Part I
Note: For this case, it is PostgreSQL v10 since is VMware supports the one to run with vCloud Director 9.7.
vCloud Director Linux migrate SQL DB to embedded PostgreSQL appliance - Part I
 Now select the PostgreSQL version that you want to install, and run the command to install:

Change Postgres user password.

After PostgreSQL is installed, Initialize and start database service DB.

Enable and Start PostgreSQL

Open firewall for your new PostgreSQL:

Or disable your CentOS firewall:

Note: It is not recommended we disable our firewall in a production environment. Only use if you have issues when trying to migrate the SQL DB to the installed PostgreSQL.

Since we need to do this for the migration between SQL DB and PostgreSQL, you can temporarily do it. If this task does not go against your company security policy, you should not use it.

Run the next command to prevent the firewall from starting by other services.

Change PostgreSQL remote access so that it is possible to connect to your DB outside of this Linux Server.

Login to Postgres user and DB and change password in Postgres user password.

(use the same password used for Linux Postgres user)

Now we are ready to create our vCD PostgreSQL DB to migrate from SQL Server.

For this task, I used my pgAdmin tool to launch all vCD DB commands easily. New query and run the following commands:

In the PostgreSQL command line, just login and run psql and launch each command line.

With this last part, we are done installing PostgreSQL DB and ready to start vCD DB migration from SQL Server DB to our new PostgreSQL DB.

2. Migrate SQL DB to PostgreSQL Linux

The DB migration is a simple process.

Note: Before start, do a snapshot of your VMs

First, stop vcd services.

Second, run the cell migrating tool (use the settings created in the previous task).

Note: If you do not include the “–private-key-path /vcloud/.ssh/id_rsa” option, after the migration finishes, you can connect the cells to the target database by running the reconfigure-database subcommand on each cell in the server group.

Error 01.

On my first try, I had an error: vcloud owner– Error executing command: java.lang.IllegalStateException: Task Refresh database views failed

Checking my settings, I notice that my new PostgreSQL DB had the wrong owner. Since I use pgAdmin and the default user is postgres, the DB creating did use the same user, instead of vcloud user.

I change the owner to the right user, rerun the migration tool and get a second error.

Error 02.

–Error executing command: java.lang.IllegalStateException: Error populating the temporary rights_implications table.ERROR: relation “rights_implications” does not exist

For this one, I needed to Google it and found a similar one in VMware KB.

Even is not the same process, but is close enough. And according to the VMware KB, this type of error is because when you try to upgrade more than one attempt, we need to rollback the process and try again.

Since this is not an upgrade and we cannot rollback, the best option here is to delete the vcloud DB in the PostgreSQL and recreate a new DB and restart the process.

After fixing the last error and recreate the PostgreSQL DB, I rerun the vCD migration tool.

This time all finish without any error, except one with “Error executing command: null”.

Checking the logs, I don’t see anything about this, so I think it may be the –private-key-path used. So for the save side, I decided to run the command reconfigure-database.

Running the reconfiguration command I get: “Current database connection parameters are the same as those supplied. Exiting now.”, It means all the DB settings are correct.

Next, I stop the SQL Server DB and restart vCD services.

After restarting the vCD services, I check logs to see if all is ok and if the cell is running, no issues found. I then start the browser to login to vCloud Director.

All Organizations (only one on this PoC), vApps, and VMs are running and no issues.

vCloud Director Linux migrate SQL DB to embedded PostgreSQL appliance - Part I
vCloud Director Linux migrate SQL DB to embedded PostgreSQL appliance - Part I

As we can see above, vCD DB migration was a success.

3. Upgrade vCD 9.7 to vCD 10.2.

After DB is migrated to PostgreSQL, it is time to upgrade the vCloud Director to v10.2.1.

Note: Before start, do a snapshot of your VMs.

The upgrade process is also simple and does not need much work. The upgrade process is done in two parts:

1. Upgrade vCloud Director Cell.
2. Upgrade vCloud Director DB.

As I informed you in the beginning, this vCloud infrastructure is using an NSX-V 6.4.8. So before we upgrade the vCloud Director, we need to check if PostgreSQL, NSX-V, or other VMware tools that are using this vCloud Director infrastructure is supported with the new vCloud Director v10.2.1

NSX-V and NSX-T support Matrix

vCloud Director Linux migrate SQL DB to embedded PostgreSQL appliance - Part I
vCloud Director Linux migrate SQL DB to embedded PostgreSQL appliance - Part I

As we can see above, v10.2.1 is supported with all the versions that we have.

We also need to know if the upgrade path is supported from v9.7 to v10.2.1.

Looking at the next upgrade path image, all is ok.

First, download the right image file for this upgrade. Since we are using a Linux vCloud Director, we need to download a vCD Linux binary file.

vCloud Director Linux migrate SQL DB to embedded PostgreSQL appliance - Part I

I create a new folder in /tmp/upgrade-package and use WinSCP to upload the image to my vCloud Director.

We need to change execute permissions on the file so that we can run it.

Now let us run the upgrade script file (this file includes the installation script and RPM files).

Note:  You cannot run the installation file from a directory whose pathname includes any embedded space characters.

Run the upgrade script.

Answer “y” to start the vCloud Director Cell upgrade process.

vCloud Director Linux migrate SQL DB to embedded PostgreSQL appliance - Part I

As we can see above, all files were upgraded with success.

Now we need also to upgrade vCD DB running the command:

Answer “y” to start the vCloud Director DB upgrade process.

vCloud Director Linux migrate SQL DB to embedded PostgreSQL appliance - Part I

After vCloud Director DB is upgraded, the vCloud Director is fully upgraded.

Now we will open vCloud Director GUI.

As we can see, after the upgrade, we need to indicate our organization. Since now vCD uses HTML5, URL is different.

What is the new default HTML5?

    • https://vCD-IP-FQDN/provider/
    • https://vCD-IP-FQDN/tenant/
    • https://vCD-IP-FQDN/provider/cloud/organizations/ (To see all organizations with your administrator user)

Open for the first time(or not providing a provider) just the vCD page. We need to provide an organization name.

For this case, I add my default organization.

vCloud Director Linux migrate SQL DB to embedded PostgreSQL appliance - Part I

Then login with your administrator account.

vCloud Director Linux migrate SQL DB to embedded PostgreSQL appliance - Part I

After login to upgraded vCloud Director v10.2.1, I get an error about certificates.

This error is regarding the NSX-V and vCenter certificates that need to be re-imported to the vCD. We can refresh the connections, save them, and this will fix the issues. But running a command, we can do this automatically to any VMware product connected to the vCD.

This command will download and update all certificates to the vCD

As we can see above, NSX-V and vCenter certificates were downloaded.

Also, we can check this in the vCD GUI trusted certificates.

Checking vSphere Services, we see that now all are connected.

With the above tasks, we finish our vCloud Director upgrade to v10.2.1, and also we finish this vCloud Director Linux migration SQL DB to embedded PostgreSQL appliance – Part I.

In this first blog post with three parts, we did the following tasks:

1. Install PostgreSQL Linux vCD.
2. Migrate SQL DB to PostgreSQL Linux.
3. Upgrade vCD 9.7 to vCD 10.x.

For the second part of this blog post, vCloud Director Linux migration SQL DB to embedded PostgreSQL appliance – Part II, we will have the following tasks:

4. Create a new vCD 10.x Appliance.
5. Migrate external DB to an embedded database.
6. Copy data and certificate data.

I hope this first blog post of vCloud Director Linux migration SQL DB to embedded PostgreSQL appliance was useful for your migrations or upgrades on your vCloud Director infrastructures.

Share this article if you think it is worth sharing. If you have any questions or comments, comment here, or contact me on Twitter.

©2021 ProVirtualzone. All Rights Reserved
By | 2021-01-19T19:44:02+01:00 January 19th, 2021|NSX, vCloud Director, VMware, vSphere|0 Comments

About the Author:

I am over 20 years’ experience in the IT industry. Working with Virtualization for more than 10 years (mainly VMware). I am an MCP, VCP6.5-DCV, VMware vSAN Specialist, Veeam Vanguard 2018/2019, vExpert vSAN 2018/2019 and vExpert for the last 4 years. Specialties are Virtualization, Storage, and Virtual Backups. I am working for Elits a Swedish consulting company and allocated to a Swedish multinational networking and telecommunications company as a Teach Lead and acting as a Senior ICT Infrastructure Engineer. I am a blogger and owner of the blog ProVirtualzone.com

Leave a Reply

%d bloggers like this: