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.


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.
Read More