VMware VCSA 6.0 database backup

vcsa60dbbackup01

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

vcsa60dbbackup02

Launch BASH shell.

Command> shell

vcsa60dbbackup03

Create a folder backupdb in the appliance root.

# mkdir /backupdb

vcsa60dbbackup04

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.

vcsa60dbbackup05

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

vcsa60dbbackup06

Use WinSCP to copy the script files to /backupdb folder.

vcsa60dbbackup07

Return to the appliance shell running the command:

# chsh -s /bin/appliancesh root

vcsa60dbbackup08

Make the scripts executable with the command:

# chmod 700 backup_lin.py
# chmod 700 restore_lin.py

vcsa60dbbackup09

 

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

vcsa60dbbackup10

To store the backup in a safe place, you can use WinSCP to copy the backup file to your preferred storage.

vcsa60dbbackup11

 

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

vcsa60dbbackup12

Run the restore_lin.py script file specifying the backup location.

# python /backupdb/restore_lin.py -f /backupdb/VCSA_backup.bak

vcsa60dbbackup13

When the restore process completes successfully, start the services previously stopped.

# service vmware-vpxd start
# service vmware-vdcs start

vcsa60dbbackup14

To keep the highest level of security and avoid data loss, you should backup the database on a daily basis.

firma

2 Comments

  1. Adam Eckerle 25/01/2016
    • Paolo Valsecchi 26/01/2016