Backing up and restoring the vCenter Server Appliance vPostgres database (2034505)
Purpose
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:
- 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.
- When prompted, log in as the root user. The default password is vmware.
- Stop the VMware vCenter Server service by running this command:
service vmware-vpxd stop
- On the vCenter Server Appliance virtual machine, navigate to the vPostgres utility directory using this command:
cd /opt/vmware/vpostgres/1.0/bin
- To display the vPostgres database configuration file, run this command:
cat /etc/vmware-vpx/embedded_db.cfg
- 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 theEMB_DB_PASSWORD
password.
- Using WinSCP, connect to the vCenter Server Appliance and download the VCDBackUp file from /tmp/
- 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.
- 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.
- Using WinSCP, connect to the vCenter Server Appliance and upload the backup copy of the VCDBackUp file into the /tmp/ directory
- To display the new vPostgres database configuration file, run this command:
cat /etc/vmware-vpx/embedded_db.cfg
- Navigate to the vPostgres utility directory by running this command:
cd /opt/vmware/vpostgres/1.0/bin
- Stop the VMware vCenter Server service by running this command:
service vmware-vpxd stop
- 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 andEMB_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.
- 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