I found the need to do some failover testing, so built a cluster out of virtual machines. Could not do so using Virtual PC 2004 (VPC 2004) as a shared drive resource is a requirement to a cluster, and VPC could not share a VHD. However, Microsoft Virtual Server 2005 (VS 2005) release candidate has a virtual SCSI adapter in its bag of tricks that worked nicely.
You'll need:
- System with 1 GB RAM, 10 GB HDD.
- Windows Server 2003 ISO or CD.
- Virtual Server 2005 RC (note: the current RC will stop functioning on 12/31/2004).
- Access to an Active Directory Forest.
- Domain user account for the cluster service.
Here's a chunk of a whitepaper I wrote to do the rest. Apologies for the formatting; wanted to get it posted straight away:
This section creates the nodes that will make up the cluster.
I had challenges using the Virtual Server 2005 web interface to create virtual disks; on my machine, VS complained about inadequate disk space on the host. This did not seem correct, as I was creating the VHDs on an external storage device, and not the host. This may be a defect in the build I used, or some internal requirement that VS checks when creating disks. At the time of the error, I had 11 GB free and was creating 4 GB VHD files.
To work around this, I used VPC 2004 to create the VHD files. If you have plenty of disk space, and don’t see the error, use either product to create the VHDs (you can save a step later if you se VS 2005, however).
Important: All VHDs must be “Fixed Size Hard Disks”; virtual clustering will not support dynamic disks.
The following steps will prepare the components to create a two-node cluster. For file and VM names, I am using “appclnodex” for “application cluster node number” and “appclx” for the cluster. The quorum file is named “appclquorum.vhd”.
I used VPC for the following steps:
- Create a 4000 MB (4 GB) fixed-size VHD file called “appclnode1.vhd”.
- Create a VMC file called “appclnode1.vmc”. Use 192 MB for RAM and point to the VHD created in the step above.
- Start the VM.
- Install Windows Server 2003.
- Accept defaults for networking components (I used a single, DHCP-enabled NIC as I want to apply patches from Windows Update).
- Once patched, shut the VM down.
I used VPC for the following steps:
- Create a 200 MB fixed-size VHD file called “appclquorum.vhd” for the quorum drive.
Both VMs will share the quorum drive via a virtual SCSI device as part of clustering.
It is far faster to copy and rename the VHD, rather than rebuilding Windows Server 2003. With the first node shut down I copy the file and then rename it using VPC:
- In Windows Explorer, copy “appclnode1.vhd” to “appclnode2.vhd”.
- In Windows Explorer, copy “appclnode1.vmc” to “appclnode2.vmc”.
- Edit “appclnode2.vmc”, modifying the “” node to point to “appclnode2.vhd”.
- Double-click “appclnode2.vmc”.to start the VM and log in.
- Change the name of the system to “appclnode2” and shut the VM down.
Component preparation is now complete.
With the components created, we will now associate them with the Virtual Server environment. While we can use the VMC files created in the VPC 2004 environment, VS throws errors. These errors do not seem to prevent a VM from starting, but may cause problems later. In the next section, we create VMC files in the VS environment.
This step recreates VMS so the VMs will be properly available to VS:
- Open Windows Explorer
- Navigate to the location of your VHD and VMC files.
- Delete or rename the VPC VMC files for the clustered nodes.
- Open the Virtual Server web interface.
- Under Virtual Machines, click “Create”.
- Type in the name of your node.
- Under “Memory” set RAM to 192 MB.
- Under “Virtual Hard Disk” select “Use an existing virtual hard disk” and navigate to your node VHD file.
- Under “Virtual Network Adapter”, select your host adapter.
- Click “Create”.
Repeat the above steps for “appclnode2”.
These sections configure the components of the VMs (created above) to support the cluster.
Complete the steps in this section for each node in the cluster.
Add a virtual SCSI adapter to support the quorum disk VHD. In the Virtual Server web interface:
- Mouse over “appclnodex” and click “Edit Configuration”.
- Click on “SCSI Adapters”.
- Click “Add SCSI Adapter”.
- Click “Share SCSI bus for clustering”.
- Select “7” for the first “SCSI Adapter ID” (select “6” for the second, and so on).
- Click on “OK”.
The interface will return you to “appclnodex Status” (where x is the node number).
Note: do not connect the quorum drive at this time.
From the “appclnodex Status” view (where x is the node number):
- If the first NIC is not connected, set “Connected to” to the host NIC.
- Click “Add Network Adapter” to add a second NIC.
- Set “Connected to” to the “Internal Network” on the second NIC.
- Click on “OK”.
The interface will return you to “appclnodex Status” (where x is the node number).
Virtual Machine Additions provide a variety of additional support to the nodes.
Note: If you used VPC to create the VHD files, you may have installed the VPC VM Additions. You will need to upgrade them to the VS version as described in this section.
From the “appclnodex Status” view (where x is the node number):
- Start the VM (the VM must be running to mount the CD that loads the additions).
- When the thumbnail indicates the machine is running, click it and log in to the VMRC session.
- Log on to the VM console.
- When logged in, scroll down and click the “Configure appclnodex” link in the web window. This returns you to the status page for the node.
- Click the “Virtual Machine Additions” link.
- Click the “Install Virtual Machine Additions” check box.
- Click “OK”. You are returned to the “Master Status” window.
- Click the thumbnail of the node and log in again.
- Answer “Yes” to the “Install/Upgrade Virtual Machine Additions” dialog.
- Reboot the node when prompted.
Return to the “Master Status” view.
You must first determine which of the NICs is external. As a NIC is emulated as a standard type in a VM, the only way to detect I to disconnect the VS NIC, open the VM and identify the disconnected NIC as the external NIC. In the VS interface:
- Select a node to configure.
- Under “Network Adapters”, set the adapter currently connected to the host NIC to “not connected”.
From the “Master Status” view:
- Start the VM (if it is not already started).
- Log in to the VMRC session.
- Log on to the VM console.
- Open “Network Properties”.
- Right-click the “disconnected” NIC and click “Rename”.
- Rename to “External”.
- Right-click the other NIC and click “Rename”.
- Rename to “Internal”.
You can now reconnect the External NIC to the host NIC in the VS interface. Once you do this, it should show as “connected” in the VMRC session.
To perform the following steps, you must know the IP addresses you will be using for each node. Consult your system administrator for assistance:
- Right-click the “Internal” NIC and select TCP/IP properties.
- Set the IP address to a different subnet that the subnet you’ll use for the external card. Do not set a DNS reference or a Default Gateway.
- Save the settings for the internal card.
- Right click the “External” NIC and select TCP/IP properties.
- Set the IP address to the same subnet as the AD network.
- Set the subnet mask and default gateway for the network.
- Set the DNS entry for the network.
- Click “Advanced” and set the WINS configuration for your network.
Apply the steps in this section (Section 6.2) to all nodes of the cluster.
Using standard practices, join all the nodes to the Active Directory domain. Reboot each node when prompted.
The quorum disk is a disk that all the nodes in the cluster will share to maintain state. In this section, we will connect the quorum disk to both nodes.
Important: I was warned the quorum disk can become corrupt if multiple systems are not clustered when the disk is accessed. Be sure you do not start subsequent nodes until the cluster is configured on the first node.
You cannot attach a VHD to a VM that is running, so shut down all nodes. In the VS interface, select each node and follow the steps below:
- Click on “Hard Disks”.
- Click on “Add Hard Disk”.
- In “Attachment”, Select “SCSI 0 ID 0”.
- In “Known virtual hard disks”, select “appclquorum.vhd” (or type the physical path) of the quorum drive you created.
- Click on “OK”.
The interface will return you to status window for each node.
This section configures the disks in the first node of the cluster.
We want to place the quorum drive on a standard drive letter in the cluster, and on a drive letter that won’t be affected by the addition of additional disks. In Computer Management:
- Select the disk of the quorum drive (if created from this document, it will be Disk 1 and 200 MB).
- Accept dynamic disk defaults.
- Create a primary partition and accept the defaults.
- Assign the drive letter to Q:\.
- Format the drive as NTFS, accept the default allocation unit size and set the label to “quorum”.
- Perform a “quick format” and click “Next”.
Note: If there is only one VHD attached to the system at the time of this operation, the Virtual Machine Additions virtual CD will be the D:\ drive on the system and labeled “VMAdditions”.
In this section, we create the cluster and add nodes.
Using the VMRC, pointing to the first node of the cluster:
- Start the Cluster Administrator (Start, Programs, Administrative Tools, Cluster Administrator).
- Select “Create New Cluster” and click “OK”. The “New Server Cluster Wizard” opens.
- Select the appropriate AD domain.
- Type the cluster name (this is the virtual name of the cluster; the name by which other systems will reference the clustered nodes) and click “Next”.
- Enter the name of the first node of the cluster.
The wizard will analyze the configuration of the first node and report on feasibility of the cluster.
Note: I got a “best practices” error in the “Finding common resources on nodes”. The wizard located the quorum resource and confirmed the 200 MB capacity was sufficient. However, it complained it didn’t meet the best-practice requirements for quorum resources.
- Resolve any errors and click “Next”.
- Enter the IP address you will be using for the virtual cluster and click “Next”.
- Enter the domain service account and password. Click “Next”.
The wizard displays a “Proposed Cluster Configuration” pane. In this pane:
- Click the “Quorum” button and ensure Drive Q:\ is assigned as the quorum resource.
- Review the configuration settings (IPs, nodes and service account) and click “Next”.
- The system displays a “Creating the Cluster” pane and reports any detected errors. Click “Next”.
The wizard produces a log and if successful, opens the Cluster Administrator window with the new cluster in focus.
Using the VMRC, point to the first node of the cluster:
- Open the Cluster Administrator.
- Select the cluster to which you wish to add nodes.
- Click File, New, Node. The “Add Nodes” wizard opens.
- In the “Select Computers” button, add the name of the computer you wish to add or click “Browse” to browse for the specific system. Note that the browse will look only in the AD domain to which the first node belongs.
- Click “Next”. The wizard will re-analyze the cluster with the new node and advise any errors.
- Once any errors are resolved, click “Next” to complete adding the node.
Once all nodes are added, the cluster is complete. Use standard cluster methodologies to install software.