Thursday, March 12, 2015

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

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.

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 vCenter 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 vCenter 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

No comments:

Post a Comment