Virtual appliances (VAP) are fully configured virtual machines (VM) that include both an operating system and an
application. As a result, they are one of the most powerful aspects of virtual infrastructures.
Deploying a VAP is simple: create a copy of the VM and then configure it for use. Compare that to the complexity of server application configurations and you will quickly warm up to using VAPs.
For commercial applications like Microsoft SQL Server, a private VAP needs to be created. Downloadable, pre-configured VMs are not available because of licensing requirements for both the operating system (Windows Server) and the application itself.
To create a private VAP, first generate a virtual machine, then install the operating system and lastly, install the application. This is a time-consuming process. Therefore, once the VAP is complete, create a copy of it to use as a backup. This will be useful when you need to install updates in the appliance.
Typically, private VAPs targeted for Hyper-V environments include the following characteristics:
- They are based on a custom VM that runs a copy of Windows Server 2008 Enterprise Edition. Windows Server 2008 is an enlightened guest operating system for Hyper-V and as a result, it will be fully integrated with the hypervisor. Also, the Enterprise Edition allows you to scale the VM more easily than other editions and install guest failover clustering, should you need it.
- The machine includes any required patches or updates. It also includes any custom utility required for your environment.
- The machine includes at least three virtual disks: a system disk, a data disk and a logging disk.
- The machine includes SQL Server (usually SQL Server 2008) in the appropriate edition to meet your needs. It also includes a custom configuration for SQL Server -- i.e., data is stored on the data disk, logs are stored on the logging disk and other settings are modified -- as well as the appropriate updates.
- The machine has been depersonalized by the Sysprep utility.
The last step, depersonalization, is required to eliminate the security identifier (SID) and other specific components of the VM, and it turns the VM into a VAP. In Windows Server 2008, go to the %SystemRoot%\System32\Sysprep folder to launch Sysprep.exe (you'll need elevated rights to do so).
Choose the following settings (see Figure 1):
- System Cleanup Action: Enter System Out-of-Box Experience (OOBE)
- Select the Generalize checkbox
- Shutdown Options: Shutdown
Figure 1. Preparing a virtual appliance with Sysprep
Once the machine is shut down, you can use it to generate new virtual machines running SQL Server. Make sure you create a copy of this VM to use as a backup. The machine can then be stored in a Hyper-V source library.
In order to create a new VM based on this VAP:
- Make sure the virtual machine is turned off.
- Locate the source files for the VM and copy them to a new location. Create a folder using the name of the VM and store the virtual disks in this folder.
- Generate a new virtual machine in Hyper-V and attach it to the copied disks. Assign appropriate RAM, network interface cards and other settings to the new VM.
- Launch the new VM to generate a new security identifier, name it and join it to your production domain.
- Load the VM with production databases and start using it as a new machine in your infrastructure.
This process is relatively simple, however, if you manage your Hyper-V environment with System Center Virtual Machine Manager (SCVMM), then you can automate the entire process (see Figure 2) and have SCVMM both prepare the VAP and generate a new VM from the VAP template in a few easy steps.
That's it - your SQL Server VAP is now ready for deployment.
If you run virtual infrastructures and need to generate new VMs running the same applications, VAPs are the answer. Furthermore, you can -- and should -- create private VAPs of as many applications as possible since this will save you a lot of time when you need to deploy new machines.
SQL SERVER AND MICROSOFT HYPER-V
Part 1: Creating fault tolerant installations
Part 2: Maintaining high availability
Part 3: Protecting virtual databases
Part 4: Creating virtual appliances
Part 5: Deploying virtual appliances
ABOUT THE AUTHORS
Danielle Ruest and Nelson Ruest are technology futurists focused on datacenter optimization and continuous service availability. They are authors of multiple books, notably "Training Kit 70-652: Configuring Windows Server Virtualization with Hyper-V" published by Microsoft Press and "Virtualization, A Beginner's Guide" published by McGraw-Hill Osborne. For more tips, write to them at firstname.lastname@example.org