How to Backup vCenter Appliance 6.5 Embedded Postgres Database

In vCenter Server appliance 6.5 Management Interface (VAMI) page, We have option to backup the vCenter server appliance but it backups entire vCenter data including database but how to backup only the vCenter embedded postgres database to protects the data stored in your database. The backup of the vPostgres database is not required when performing a backup using a supported method. Image-based backup and restore is the only solution supported for performing a full, secondary appliance restore. VMware provides a Python based scripts which allows to backup  the embedded postgres database of vCenter Server appliance 6.5. In this article, I am going to explain the detailed step by step procedure to Backup vCenter Appliance 6.5 Embedded Postgres Database using the python script. I am going to taking reference of the VMware KB article 2091961.This article is only supported for backup and restore of the vPostgres database to the same vCenter Server or vCenter Server Appliance. Use of image-based backup and restore is the only solution supported for performing a full, secondary appliance restore. 

NOTE: This is tested only in Lab environment. Always consult with VMware GSS incase you need to recover your Embedded Potsgres database. VMware GSS should be consulted prior to attempting as it could result in an unusable vCenter Server Appliance.

Backup vCenter Appliance 6.5 Embedded Postgres Database

Download the python script “2091961_linux_backup_restore.zip” from VMware KB article 2091961. and copy the Zip file to the vCSA appliance using WinsCP connection to VCSA

Backup vCenter Appliance 6.5 Embedded Postgres Database

Unzip the donwloaded python script ZIP file using the below command

unzip  2091961_linux_backup_restore.zip

Backup vCenter Appliance 6.5 Embedded Postgres Database_2

Make a backup_lin.py executable using the below command

chmod 700 backup_lin.py

Backup vCenter Appliance 6.5 Embedded Postgres Database_3

Run the backup_lin.py file and provide the location for the backup file. In my case, I have provided the location for the backup file in /root/backups and file name for backup file as “vcsa_postgres_VCDB_10042017.bak”. Execute the below command to run the python script.

python /root/backups/backup_lin.py -f /root/backup/vcsa_postgres_VCDB_10042017.bak

Validate that the backup file is created in the specified location using “ls -l” command

Backup vCenter Appliance 6.5 Embedded Postgres Database_4

I hope this is informative for you. Thanks for reading !!!. Be social and share it in social media, if you feel worth sharing it.