If the embedded vPostgres DB is used in your vCenter appliance, you should perform the VCSA 6.0 database backup on a regular basis to minimize the risk of data loss.
Performing regular database backups protect the data stored in the database because, in case of VCSA failure or replacement, without having a working DB backup, all data is lost.
Prerequisites
To backup and restore the embedded vPostgres database from your VCSA 6.0, you need two scripts provided by VMware you can download from the VMware KB:
- backup_lin.py
- restore_lin.py
In addition you need to create a folder in which you want to store the backup file verifying you have read and write permissions.
Backup the vPostgres database
Using a tool like PuTTY, SSH as root your VCSA appliance and Enable BASH access with the command:
Command> shell.set --enabled True
Launch BASH shell.
Command> shell
Create a folder backupdb in the appliance root.
# mkdir /backupdb
To copy the two script files to the VCSA you can use a tool like WinSCP. Since the default appliance shell cannot be the remote partner of WinSCP, you may receive an error message while trying to connect the VCSA with WinSCP.
To allow WinSCP to access the VCSA, you need to change the default shell to BASH running the following command (BASH shell must be enabled and active):
# chsh -s /bin/bash root
Use WinSCP to copy the script files to /backupdb folder.
Return to the appliance shell running the command:
# chsh -s /bin/appliancesh root
Make the scripts executable with the command:
# chmod 700 backup_lin.py
# chmod 700 restore_lin.py
Backup
Run the backup_lin.py script file specifying the target location and check the result.
# python /backupdb/backup_lin.py -f /backupdb/VCSA_backup.bak
# ls -l
To store the backup in a safe place, you can use WinSCP to copy the backup file to your preferred storage.
Restore
Before restoring the VCSA DB, you need to stop the vmware-vpxd and vmware-vdcs services.
# service vmware-vpxd stop
# service vmware-vdcs stop
Run the restore_lin.py script file specifying the backup location.
# python /backupdb/restore_lin.py -f /backupdb/VCSA_backup.bak
When the restore process completes successfully, start the services previously stopped.
# service vmware-vpxd start
# service vmware-vdcs start
To keep the highest level of security and avoid data loss, you should backup the database on a daily basis.
























While backing up the Postgres database is supported, please note that this should not be the primary backup / recovery mechanism for the VCSA 6.0. The only fully supported way to backup and restore a VCSA 6.0 is to perform an image-level backup and an image-level restore. The database does not contain all of the stateful information of all of the vCenter components (tags, roles & permissions, licensing, etc). Backing up of the Postgres database should only be done if required to have a separate copy of the DB.
You are right, just having a database backup is not enough to perform a correct restore in case of complete failure of vCenter. A full VM backup is the recommended method to protect the vCenter. The database backup can be used to recover "at least" some info in case a full VM backup is not available.