Knowledge Base

The VMware Knowledge Base provides support solutions, error messages and troubleshooting guides
 
Search the VMware Knowledge Base (KB)   View by Article ID
 

Backing up and restoring the vCenter Server Appliance vPostgres database (2034505)

Purpose

This article provides steps to back up and restore the vCenter Server Appliance's (VCSA) vPostgres database.

For vCenter Server Appliance 6.0, see Backing up and restoring the vCenter Server 6.0 embedded vPostgres database (2091961).

Note: This article is only supported for backup and restore of the vPostgres database to the same vCenter Server Appliance. Use of image-based backup and restore is the only solution supported for performing a full, secondary appliance restore.

Resolution

Before you proceed, ensure that you have these installed:
  • SSH client for connecting to the vCenter Server Appliance.
  • WinSCP (or any SCP client) for retrieving and replacing the vPostgres database recovery file.

Backing up the embedded vPostgres database

To back up the embedded vPostgres database:

  1. Connect to the vCenter Server Appliance via SSH. For more information, see Enable or Disable SSH Administrator Login on the VMware vCenter Server Appliance section in the vCenter Server and Host Management Guide.
  2. When prompted, log in as the root user. The default password is vmware.
  3. Stop the VMware VirtualCenter Server service by running this command:

    service vmware-vpxd stop

  4. On the vCenter Server Appliance virtual machine, navigate to the vPostgres utility directory using this command:

    cd /opt/vmware/vpostgres/1.0/bin

  5. To display the vPostgres database configuration file, run this command:

    cat /etc/vmware-vpx/embedded_db.cfg

  6. To back up the vCenter Server database, run this command:

    ./pg_dump EMB_DB_INSTANCE -U EMB_DB_USER -Fp -c > VCDBBackupFile

    Fill in the EMD_DB_INSTANCE and EMB_DB_USER from the embedded_db.cfg configuration information listed in Step 5. Fill in the VCDBBackupFile with the location and file name to generated, for example:

    ./pg_dump VCDB -U vc -Fp -c > /tmp/VCDBackUp

    Caution: The /tmp/ directory is reset after rebooting the vCenter Server Appliance. VMware recommends that if this location is used, backup should be moved to a persistent location.

    Note: If prompted, enter the EMB_DB_PASSWORD password.

  7. Using WinSCP, connect to the vCenter Server Appliance and download the VCDBackUp file from /tmp/
  8. Start the VMware VirtualCenter Server service by running this command:

    service vmware-vpxd start

Restoring from the backend vPostgres database file

To restore from the back up vPostgres database file:

Note
: Ensure that you take a snapshot of the vCenter Server Appliance virtual machine before proceeding. This allows you to restore the database from the snapshot if this restore procedure fails.

  1. Connect to the vCenter Server Appliance via SSH. For more information, see Enable or Disable SSH Administrator Login on the VMware vCenter Server Appliance section in the vCenter Server and Host Management Guide.
  2. Using WinSCP, connect to the vCenter Server Appliance and upload the backup copy of the VCDBackUp file into the /tmp/ directory
  3. To display the new vPostgres database configuration file, run this command:

    cat /etc/vmware-vpx/embedded_db.cfg

  4. Navigate to the vPostgres utility directory by running this command:

    cd /opt/vmware/vpostgres/1.0/bin

  5. Stop the VMware VirtualCenter Server service by running this command:

    service vmware-vpxd stop

  6. To restore the vCenter Server vPostgres database from backup, run this command:

    PGPASSWORD='EMB_DB_PASSWORD' ./psql -d EMB_DB_INSTANCE -Upostgres -f VCDBBackupFile

    Fill in the EMD_DB_INSTANCE and EMB_DB_PASSWORD from the embedded_db.cfg configuration information listed in Step 3. Fill in the VCDBBackupFile with the location and file name to be used, for example:

    PGPASSWORD='g<T4EuybGsA=kG$G' ./psql -d VCDB -Upostgres -f /tmp/VCDBackUp

    Note: Use single-quotes (') around the password as shown in the embedded_db.cfg configuration file.

  7. To restart the VMware VirtualCenter Server service for the database restore to take effect, run this command:

    service vmware-vpxd start

Additional Information

VMware introduced the VMware vPostgres database as the embedded database packaged with the vCenter Server Appliance in vCenter 5.0 Update 1a and later.

For more information on the command line options for pg_dump, see pg_dump from PostgreSQL

Note: The preceding link was correct as of February 16, 2015. If you find the link is broken, provide feedback and a VMware employee will update the link.

See Also

Update History

10/31/2012 - Added vCenter Server Appliance 5.1.x to Product Versions. 10/02/2013 - Added vCenter Server Appliance 5.5.x to Product Versions. 10/25/2013 - Added steps to Backing up section and rewrote Restoring section. 11/28/2013 - Added step 5, stop vpxd before restoring DB

Request a Product Feature

To request a new product feature or to provide feedback on a VMware product, please visit the Request a Product Feature page.

Feedback

  • 12 Ratings

Did this article help you?
This article resolved my issue.
This article did not resolve my issue.
This article helped but additional information was required to resolve my issue.
What can we do to improve this information? (4000 or fewer characters)
  • 12 Ratings
Actions
KB: