Tuesday, 21 June 2011

SQL Server Private Cloud Demo Infrastructure

In a previous article, I posted a video of Darmadi Komo’s session at TechEd in which he showcased SQL Server in the Microsoft Private Cloud. The demo environment for this session was created by technologists at Content Master, and I thought it might be useful to share some of the “behind the scenes” details of the demo infrastructure. The important point to make about this is that this is a real, working private cloud environment – there are no smoke and mirrors for demo purposes. You might make some different hardware and architectural choices in a production scenario, but the demo environment works and could be used to implement a fully-functional self-service provisioned private cloud solution.

When we started designing a demo environment for the Microsoft Private Cloud, we set ourselves the challenge of ensuring that the entire demo could be run on a single laptop computer, and that it could be easily replicated on another computer if necessary. We selected a Dell XPS 15 laptop with 8GB of RAM, an Intel Core i5 CPU, and a 500GB hard disk as our development machine and started to think about how to design the software environment. Fundamentally, the environment requires the following components:

  • An Active Directory domain
  • A Hyper-V host
  • A Virtual Machine management server running:
  • A virtual machine template consisting of:
    • A sysprepped installation of Windows Server 2008 R2
    • A prepared installation of SQL Server 2008 R2
    • An ASP.NET application for the “Point of Sale” application shown in the demonstration
    • A batch file script to complete the prepared SQL Server installation when the server is first started
  • A couple of virtual machines based on the template to use as existing POS servers in the demonstration
  • A few more virtual machines based on the template to use as workstations for different users during the demonstration
  • Some instances of SQL Server (various versions and editions) and Oracle for the MAP tool to discover

Our initial starting point for building the environment was the “Build Your Own” section of the Microsoft Private Cloud page, which includes a number of deployment guides. Then we struck gold and found Alan le Marquand’s excellent blog article on creating a private cloud. However, we soon discovered that while Alan’s approach is indeed a great way to try out Microsoft’s private cloud solution for yourself, it assumes that the bulk of the software – including the Active Directory domain and System Center components are installed on the physical host. This would satisfy our goal of building the entire demo environment on a single computer, but it wouldn’t meet our portability goal of being able to easily replicate the environment on another computer. Essentially, we’d have to install most of the software again.

Our preferred approach was to deploy as many of the components of the demo infrastructure as possible in virtual machines, so they can be easily copied to another physical computer and used to recreate the demo environment with a few reconfiguration steps. To achieve this, we came up with a high-level design that looks like this:

Demo Environment

The host computer (HV-SRV-01) was straightforward enough to set up. We just installed Windows Server 2008 R2, applied updates until SP1 was installed, and then enabled the Hyper-V role. The SP1 update was required because we wanted to show the Dynamic Memory feature it adds to Hyper-V. We then configured a virtual network and changed the default folder for Virtual machines and VHDs to C:\VMs.

Next up was the domain controller (VM-DC-01). This is a virtual machine, which we created on the HV-SRV-01 host using Hyper-V Manager. We installed Windows Server 2008 R2 and used dcpromo to create an Active Directory domain named lucerne.msft. Since the domain controller would play a fairly minimal role in the demo, we also installed Oracle XE and SQL Server Express on it (so they could be discovered by the MAP toolkit during the demo). We added the DNS and DHCP roles and configured a scope of IP addresses that will be used by the various computers in the demo environment. Then we added the host (HV-SRV-01) to the lucerne.msft domain. It may seem somewhat counter-intuitive to add a physical host to a domain where the domain controller is running in a virtual machine, but it’s required because we want to be able to add HV-SRV-01 as a host to System Center Virtual Machine Manager on VM-VMM-01, and it’s a lot easier to do that if the host is in the same domain as the VMM server (you can add a non-domain joined host to VMM, but it requires installing and configuring the VMM agent on the host – which would affect the portability of the demo environment). In terms of running the demo, you can log onto the host as a local user that has permissions to start the virtual machines – so domain membership of the host had no real effect other than to make the laptop’s boot process a little slower as the host looks for a domain controller that isn’t running (because it’s a virtual machine defined on the host itself!)

The installation of VM-VMM-01 was the biggest task in creating the demo environment. We created the virtual machine for it with Hyper-V Manager, installed Windows Server 2008 R2, applied updates to SP1, and added it to the lucerne.msft domain. We enabled the Application Server role and ensured that Windows Authentication was enabled in IIS.  Then we installed SQL Server 2008 R2 Developer Edition, Microsoft Office 2010 Standard (only Word and Excel are required) and the MAP toolkit. Next we installed System Center Virtual Machine Manager 2008 R2 SP1 and attempted to add HV-SRV-01 as a host. At this point, we hit our first major blocker. When attempting to add the host, we encountered the following error:

Error (2923)
A malformed response was received while trying to contact the VMM agent on hv-srv-01.lucerne.msft. (Unspecified error (0x80004005))

After some troubleshooting, we figured out the cause of the problem. The Dell laptop we used came with an Intel wireless network card, and the driver installation included some WMI-based management and monitoring software. For some reason, this was causing WMI to return spurious data to the VMM server when installing and connecting to the VMM agent on the host. We removed the management software (but not the network card driver), and were able to successfully add our physical laptop as a Hyper-V host to SC VMM on our virtual machine.

Now that we had a working SC VMM installation, we set about installing the VMM Self-Service Portal 2.0 solution accelerator, and this is where we hit our second blocker. The installer for the self-service portal checks for a pre-requisite of SQL Server 2008 Enterprise edition. We had installed Developer edition, which while being functional identical to Enterprise edition did not meet the prerequisite requirements enforced by the portal setup program. So a little back-tracking later (thank heavens for Hyper-V snapshots) we had replaced SQL Server Developer edition with Enterprise edition and could continue. The self-service portal has two main components, each installed using a separate setup program. The self-service portal itself is basically a database back-end with an ASP.NET Web application through which users can request infrastructure resources. However, there is also an optional reporting dashboard for the self-service portal that requires a SharePoint site. To satisfy this requirement, we installed SharePoint Foundation 2010 as a front-end Web, and then configured a site to use the existing SQL Server 2008 R2 Enterprise instance on the virtual machine as a back-end database. Then we were able to install the VMM self-service portal reporting dashboard.

The next task was to create a virtual machine template for the “Point of Sale” server used in the demo. To accomplish this, we created a virtual machine on which we installed Windows Server 2008 R2 (with the Application Server role enabled) and deployed our demo application (a simple ASP.NET Web application that provides a point-of-sale system for selling books) in an IIS virtual directory. We then used SQL Server 2008 R2s “SQL Sysprep” feature to install a prepared instance of SQL Server on the virtual machine – this is in effect a partial installation of SQL Server with no server identity dependencies (so the server can be renamed, and the SQL Server installation completed at a later time). To automate the completion of the SQL Server installation, we ran the setup wizard as if completing the prepared instance manually, and then cancelled on the final screen and copied the .ini file that had been created by the setup program. We could then create a batch file that runs the SQL Server setup program (from a locally stored copy of the installation media) and specifies the .ini file to perform a silent, automated installation. We also created a simple Transact-SQL script to create the point-of-sale application database in the local SQL Server instance after its installation has completed and called that from the same batch file.

With everything now in place, we used System Center Virtual Machine Manager to create a virtual machine template from the virtual machine we had built. Essentially, this creates a Sysprepped image of the virtual machine that can be customized the first time it is started. Then, we configured the template by specifying the virtual hardware settings and default computer name, license key, domain membership etc. to be used to customize the image when started. We also specified that the batch file we had included in the image should be run automatically the first time the computer was started and logged into – completing the installation of SQL Server and the application database.

We then used the template as the basis for two virtual machines – VM-POS-NY and VM-POS-TechEd. These were created in System Center VMM from the template, and serve as pre-existing point-of-sale servers in the demo.

Finally, we created three simple virtual machines that included Windows Server 2008 R2 with Internet Explorer 9. We added the Desktop Experience feature, enabled the Themes service, and customized the desktop to use the Aero theme (so the user interface looks like Windows Vista/7 rather than the traditional Windows Server UI). We named these computers VM-WKSTN-Admin, VM-WKSTN-Operator, and VM-WKSTN-User, an they’re used in the demo to represent the workstations of the various user roles involved in a self-service provisioning scenario.

At TechEd, Darmadi presented the demo on a Dell Precision laptop with 16GB of RAM. To move the completed demo environment to this laptop, we simply:

  1. Installed Windows Server 2008 R2 SP1 and named the computer HV-SRV-01
  2. Copied all of the virtual machines to C:\VMs on the new laptop
  3. Started VM-DC-01, removed the old HV-SRV-01 from the domain and added the new HV-SRV-01 to the domain
  4. Started VM-VMM-01 and removed the old HV-SRV-01 host, and then added the new HV-SRV-01 host

I’ve missed out a few details, and I may return to the subject of using SQL Server prepared instances in VM templates in a future post; but for now, hopefully this has given you an insight into the single-computer private cloud environment we built for the TechEd demo.

No comments: