Put the vCenter Appliance embedded database in a consistent state

One of my customers asked me to backup and replicate their VMware vCenter 5.5 Appliance using the embedded database with Veeam Backup & Replication. To achieve this the vCenter embedded database, which is a vPostgres database, must in a consistent state before it can be backed up and replicated properly.

vCenter-Backup

There is a KB article from VMware about Backing up and restoring the vCenter Server Appliance vPostgres database. But the downside on this is that every time the backup runs the vPostgres database is dumped on the disk and the database is not consistent when it replicated. So when the replicated vCenter on the DR side is started bad things will happen…

To put the vCenter Appliance embedded database in a consistent state we need to tell the vPostgres database before the Backup / Replication job starts to prepare for performing an on-line backup. This can be done by creating 2 scripts which put the vPostgres database in a on-line backup mode and afterwards exits this state. These two scripts are triggered by the VMware tools when the Backup and Replicate job runs when the “Guest Quiescence” option is enabled.

For the VMware vCenter 6.0 Appliance this is not necessary because these scripts are already in place by default!

Let’s get started!

Fist enable SSH on the vCenter (if you’ve not done that already).

Login the VAMI of the vCenter Appliance and go to the Admin tab and change “Administrator SSH login enabled” to Yes.

Now start your favourite SSH client and login the SSH session of the vCenter Appliance.
And create the first script for “freezing” the vPostgres database.

And and the following content :

Make the script executable.

Then create the second script for “releasing” the vPostgres database.

And and the following content :

Make the script executable.

Prepare VMware vPostgres database configuration

Look for the following settings, uncomment them and change the value.

Restart de VMware vPostgres service on the VMware vCenter Appliance.

Retrieve the vPostgres database password and store it so it can be used by the scripts.

And lastly don’t forget to enable the “Guest Quiescence” option on the backup job.

vCenter-Backup01

And you are done! From now on if you run a Backup or Replication job the vPostgres database will be in a consistent state and can be safely restored.

If you run into any issues running the scripts, please check the log file /var/log/vpostgres_backup.log for more information on what’s wrong.

Marco van Baggum

Marco van Baggum

Works as a SDDC Architect for ITQ. More details can be found on the About page

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.