Introduction
Backing up a VMware Horizon View environment configuration is one of the most important parts of running a virtual desktop infrastructure. Most administrators already know how to back up virtual desktops, but, unfortunately, very few pay enough attention to backing up Horizon View configurations. That’s not smart! If you have any problems with a large View Manager configuration, it can take several hours or even days to set up pools and policies, configure entitlements, and perform other tasks. Sounds tough, I guess. That’s why you need to have a safe harbor for Horizon View configurations too.
Order Matters
To create a consistent copy of VMware Horizon infrastructure configuration, you need to back up all View Manager components in the following order:
- View Manager ADAM database (Connection Server database)
- View Composer database (which can reside on a dedicated Composer Server or on a vCenter Server)
- VMware vCenter database
Accordingly, these components also have to be restored at the same time, so that your entire infrastructure remains consistent.
Backup & Recovery of View Manager: Connection Server database
Backup of Connection Server configuration
First, make sure that there are no active create, recompose, or delete operations. To avoid any synchronization problems, you also need to suspend provisioning of virtual machines. To do that, go to View Administrator > View Configuration > Servers. Next, in Servers, select the vCenter server and click Disable provisioning in Settings (do not forget to enable this feature back after backing up).
A database backup can be made in View Manager GUI. In View Administrator, go to View Configuration > Servers. In the Connection Servers tab, select any server of the replicated group and click the “Backup Now…” button. It stores the Connection Server and Composer databases (but not the vCenter database).
Remember that even if you have several Connection Servers in the same replicated group, you still need to make backups regularly. If there was something wrong with the configuration of just one server, it would be replicated to all servers in the group. Well, obviously, it is the last thing you want, so it is good to have a backup at hand just in case.
By default, all backups are stored at the following path:
C:\ProgramData\VMware\VDM\backups
If you want to tune backup frequency (from 1 hour to 2 weeks), retention policies, and the ability to set a password for the output file, click “Edit…” in Connection Server settings.
You can also export View Connection Server LDAP database using vdmexport console utility located here:
C:\Program Files\VMware\VMware View\Server\tools\bin\vdmexport.exe
Files are exported to LDAP data interchange format (LDIF). There are 3 ways to use the utility:
- vdmexport -f configuration_data.LDF (by default, this file is encrypted with a password, see the screenshot above)
- vdmexport -f configuration_data.LDF -v (data export in plain text format)
- vdmexport -f configuration_data.LDF -c (cleansed, data export in open text format, but without sensitive information – passwords, etc.)
It is not recommended to back up the configuration in the cleansed format since you might lose some critical information in the restored configuration during the recovery process.
Make a Connection Server database backup using this cmdlet:
1 |
vdmexport -f C:\conn_server_backups\Backup_1.LDF |
Note that this command does not back up the Composer database!
Recovery of Connection Server configuration
Before restoring the Connection Server configuration, you need to make sure that you have all the necessary files to recover the configuration. Here’s how you back up the Connection Server configuration:
- Stop VMware Horizon Security Server service on Security Server.
- Stop View Composer service on Composer / vCenter Server.
- Delete VMware Horizon Connection Server and AD LDS Instance VMwareVDMDS components on the servers.
- Install one Connection Server instance and stop VMware Horizon Connection Server service there.
Restoring View Connection Server database includes the following steps:
1. Decrypt the backup file (if you made a plain text backup, skip this step):
1 |
vdmimport -d -p mypassword -f C:\conn_server_backups\Backup_1.LDF > Decrypted_Backup_1.LDF |
2. Import View Manager configuration (Connection Server):
1 |
vdmimport -f Decrypted_Backup_1.LDF |
3. Delete VMware Horizon Connection Server component only and reinstall it for the new database configuration. Then, open Horizon Administrator and make sure that the settings are restored.
4. Start View Composer servers. After that, install and configure all replicas of Connection Server.
5. Eventually, start all Security Servers instances.
If Security Servers are in a non-consistent state after Connection Servers recovery, you will have to reinstall them.
This process is detailed in KB 1008046 and Horizon 7 Administration Guide.
Backup & recovery of View Manager: Composer database
Backup of Composer configuration
Before backing up View Composer, make sure that you do not have any active recompose / refresh operations. You also need to halt the View Composer services (Start > Administrative Tools > Services, stop the VMware View Composer service).
View Composer backup files have the *.svi name extension and are kept by default in the same folder as Connection Server ones:
C:\ProgramData\VMware\VDM\backups
Here’s the typical name for Composer backup files:
Backup-YearMonthDayCount-vCenter Server Name_Domain_Name.svi
To back up a View Composer database, you need to run the following command:
1 |
sviconfig -operation=exportdata -DsnName=LinkedClone -username=Admin -password=Pass -outputfilepath="C:\Program Files\VMware\VMware View Composer\backup_1.svi" |
The DsnName parameter in this command stands for the DSN used for connecting to the database.
The sviconfig exportdata operation returns one of the following codes:
Code | Description |
---|---|
0 | Exporting data ended successfully. |
1 | The supplied DSN name cannot be found. |
2 | The supplied credentials are invalid. |
3 | Unsupported driver for the provided database. |
4 | An unexpected problem has occurred. |
18 | Unable to connect to the database server. |
24 | Unable to open the output file. |
Find more about the utility here. The sviconfig.exe utility is located in the Composer installation folder.
Run the Composer service once you are done with the backup.
Recovery of Composer configuration
To restore the View Composer database, run the following cmdlet:
1 |
sviconfig -operation=restoredata -DsnName=LinkedClone -username=Admin -password=Pass -backupfilepath="C:\Program Files\VMware\VMware View Composer\backup_1.svi" |
The sviconfig restoredata command may return one of the following codes:
Code | Description |
---|---|
0 | Exporting data ended successfully. |
1 | The supplied DSN name cannot be found. |
2 | Invalid database administrator credentials were provided. |
3 | The driver for the database is not supported. |
4 | An unexpected problem occurred, and the command failed to complete. |
14 | Another application is using the VMware Horizon View Composer service. Shut down the service before executing the command. |
15 | A problem occurred during the restore process. Details are provided in the onscreen log output. |
Find more details about the command here.
Once you recover the Composer configuration, start the View Composer service. Keep in mind that after the View Composer database recovery there may be some discrepancies with the View Connection Server configuration that are to be fixed manually.
Backup & recovery of vCenter Server database.
Just follow KB 2091961 to back up and recover VMware vCenter Server Appliance (vCSA) and vCenter Server for Windows databases. There, the process is described really good.
While recovering Connection Server and Composer configurations, keep in mind that they must correspond the ones on the vCenter server. In other words, virtual machine names, objects, and so on should be the same. Do not neglect the vCenter configuration recovery process.
Conclusion
Today’s article sheds light on how to back up and recover a VMware Horizon View configuration. All its components should be backed up and recovered just as it is written here. This gives a chance to have the environment running smoothly after recovery.