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/current/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
Note: If prompted, enter the EMB_DB_PASSWORD
password.
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.
- The /tmp/ directory is 6GB in storage space, if the database is larger then this, a different location will be needed.
- Using WinSCP, connect to the vCenter Server Appliance and download the VCDBackUp file from /tmp/
- Start the VMware vCenter 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/current/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 -U postgres -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 -U postgres -f /tmp/VCDBackUp </font>
Note: Use single-quotes (') around the password as shown in the embedded_db.cfg configuration file.
- To restart the VMware vCenter Server service for the database restore to take effect, run this command:
service vmware-vpxd start