Since the future direction of VMware for the vCenter server is to supply vCenter only as a vCenter Server Appliance it is important to know how to backup and restore a VMware vCenter Server Appliance (VCSA). There are several methods available to backup and restore a VMware vCenter Server appliance.
File-based backup and restore
General
The vCenter Server Appliance supports a file-based backup and restore mechanism that helps you to recover your environment after failures. In vSphere 6.5 you can use the vCenter Server Appliance Management Interface to create a file-based backup of the vCenter Server Appliance and Platform Services Controller appliance. After you create the backup, you can restore it by using the GUI installer of the appliance.
You use the vCenter Server Appliance Management Interface to perform a file-based backup of the vCenter Server core configuration, inventory, and historical data of your choice. The backed up data is streamed over FTP, FTPS, HTTP, HTTPS, or SCP to a remote system. The backup is not stored on the vCenter Server Appliance.
You can perform a file-based restore only for a vCenter Server Appliance that you have previously backed up by using the vCenter Server Appliance Management Interface. You can perform such restore operation by using the GUI installer of the vCenter Server Appliance. The process consists of deploying a new vCenter Server Appliance and copying the data from the file-based backup to the new appliance. You can also perform a restore operation by deploying a new vCenter Server Appliance and using the vCenter Server Appliance management interface to copy the data from the file-based backup to the new appliance.
Important to know is that the backup operation only backs up the primary vCenter Server instance. Before restoring a vCenter Server Appliance High Availability cluster, you must power off the active, passive, and witness nodes. The restore operation restores the vCenter Server in non-vCenter Server High Availability mode. You must reconstruct the cluster after the restore operation completes successfully.
If you use a distributed virtual switch, you must export and import separately the distributed virtual switch configuration. For detailed steps, see the VMware knowledge base article at http://kb.vmware.com/kb/2034602.
Backup a vCenter Server Appliance by using the vCenter Server Appliance Management Interface
The VMware vCenter Server Appliance Management Interface can be used to back up the vCenter Instance. Within the GUI, you can select whether or not to include historical data, such as stats, events and tasks in the backup file, the inventory and core configuration information is always backed-up.
The procedure is described at https://docs.vmware.com/en/VMware-vSphere/6.5/com.vmware.vsphere.install.doc/GUID-8C9D5260-291C-44EB-A79C-BFFF506F2216.html
Restore a vCenter Server Appliance from a File-Based Backup
The VMware vCenter Server Appliance Management Interface can be used to restore the vCenter Instance to an ESXi host or a vCenter Server Instance. The restore procedure has two stages. The first stage deploys a new vCenter Server Appliance. The second stage populates the newly deployed vCenter Server Appliance with the data stored in the file-based backup.
The procedure is described in https://docs.vmware.com/en/VMware-vSphere/6.5/com.vmware.vsphere.install.doc/GUID-3EAED005-B0A3-40CF-B40D-85AD247D7EA4.html
Image-Based Backup and Restore of a vCenter Server Environment
General
You can use vSphere Data Protection or a third-party product that is integrated with VMware vSphere Storage APIs Data Protection to back up and restore a virtual machine that contains vCenter Server, a vCenter Server Appliance, or a Platform Services Controller.
VMware vSphere Data Protection is a disk‐based backup and recovery solution that is powered by EMC. VMware vSphere Data Protection is fully integrated with vCenter Server and lets you manage backup jobs while storing backups in de-duplicated destination storage locations. After you deploy and configure vSphere Data Protection, you can access vSphere Data Protection by using the vSphere Web Client interface to select, schedule, configure, and manage backups and recoveries of virtual machines. During a backup, vSphere Data Protection creates a quiesced snapshot of the virtual machine. Deduplication is automatically performed with every backup operation.
You can use vSphere Data Protection to perform a full image backup of a virtual machine that contains vCenter Server, a vCenter Server Appliance, or a Platform Services Controller. The virtual machine must use a fully qualified domain name (FQDN) with correct DNS resolution, or the hostname must be configured to be an IP address. If the hostname is configured as an IP address, the IP address cannot be changed.
If you use a distributed virtual switch, you must export and import separately the distributed virtual switch configuration. The export should be after every change in the virtual switch configuration. And the exported file should be saved in a safe location. For detailed steps on how to do this operation, see the VMware knowledge base article at http://kb.vmware.com/kb/2034602.
Back up a vCenter Server Environment using vSphere Data Protection
The procedure is described in https://docs.vmware.com/en/VMware-vSphere/6.5/com.vmware.vsphere.install.doc/GUID-2552EAA8-867D-4832-860D-D0857914A18C.html
Restore a vCenter Server Environment using vSphere Data Protection
The procedure is describe in https://docs.vmware.com/en/VMware-vSphere/6.5/com.vmware.vsphere.install.doc/GUID-1EE61D5C-EDE5-4D19-8F9C-520BE65248E1.html
Backup the embedded PostgreSQL database
It is possible to backup solely the embedded PostgreSQL database of the VMware vCenter Appliance by creating a cron job which runs the following command. In order to create this form of backup, the vpxd service does not have to be stopped.
Make sure the destination folder already exists and there are read and write permissions on this folder. This folder can reside on a network drive.
- Log in to the vCenter Server Appliance Linux console as root.
- Download the Linux backup and restore package and extract it on the Linux machine.
- Make a backup_lin.py executable.
- For example to save the file as /tmp/backup_lin.py , run this command:
- chmod 700 /tmp/backup_lin.py
- For example to save the file as /tmp/backup_lin.py , run this command:
- Run the backup_lin.py file and provide the location for the backup file.
- For example, if you want to save the file as /tmp/backup_VCDB.bak, run this command:
- python /tmp/backup_lin.py -f /tmp/backup_VCDB.bak
- When the backup completes, you see a message that the backup completed successfully.
- For example, if you want to save the file as /tmp/backup_VCDB.bak, run this command:
Restore a backup of the Embedded PostgreSQL database
- Log in to the vCenter Server Appliance Linux console as root.
- Download the Linux backup and restore package and extract it on the Linux machine.
- Make a restore_lin.py executable,
- for example /tmp/restore_lin.py
- chmod 700 /tmp/restore_lin.py
- for example /tmp/restore_lin.py
- Stop the vmware-vpxd and vmware-vdcs services
- run these commands:
- service vmware-vdcs stop
- service vmware-vpxd stop
- run these commands:
- Run the restore_lin.py file and provide the location for the backup file.
- For example, if the backup file is saved to /tmp/backup_VCDB.bak, run this command:
- python /tmp/restore_lin.py -f /tmp/backup_VCDB.bak
- When the restore completes, you see a message that the restore completed successfully.
- For example, if the backup file is saved to /tmp/backup_VCDB.bak, run this command:
- Start the vmware-vpxd and vmware-vdcs services
- run these commands:
- service vmware-vpxd start
- service vmware-vdcs start
- run these commands:
References
- https://www.brianjgraf.com/2016/10/20/vsphere-6-5-vcsa-backup/
- https://www.brianjgraf.com/2016/10/20/vsphere-6-5-restore-vcsa-from-backup/
- https://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2091961
- https://communities.vmware.com/thread/568365
- http://pubs.vmware.com/vsphere-6-5/index.jsp?topic=%2Fcom.vmware.vsphere.vcsapg-rest.doc%2FGUID-222400F3-678E-4028-874F-1F83036D2E85.html