You might have wondered about how to setup Failover Cluster inside Hyper-V Virtual Machines. As you know, the major element of a cluster is the shared storage piece. Inside Hyper-V VMs, iSCSI is the only supported method of providing shared disks over virtual NICs.
Here are detailed steps on how to create Highly Available resources inside Hyper-V Windows Server 2008 R2 VM;
1. VM Preparation: Provision the following VMs on your Hyper-V server;
- One Windows Server 2008 R2 DC Virtual Machine
- At least two Windows Server 2008 R2 Virtual Machines
- Use an iSCSI target software to provide shared storage to each node
Update (04/05/2011): Microsoft product group just released Microsoft iSCSI Taget Software 3.3 for public download
If you have access to MSDN or TechNet Plus subscription downloads, you may use Windows Server 2008 Storage Server and install Microsoft iSCSI Software Target on it (Evolution version from MSDN or TechNet Plus subscription download and production version from your Windows Server 2008 Storage Server's OEM vendor )
Note: default Administrator password for Windows Server 2008 Storage Server is in the Windows Storage Server 2008 Release Notes (WSS2008_RELNOTES.DOC), which can be found in the “Tools” ISO file. Please see more information about Microsoft Storage Server 2008 at the end of this post.
In my demo case, I'm using iSCSI target software that can be installed on Windows Server 2008 R2. So, I'm using my WS08 R2 Domain Controller as my storage server as well. This saves me one VM.
You can use any other iSCSI target solution if it’s available to you. There are few free iSCSI target software such as Starwind that can also be used for this setup.
2. Virtual Network: create two virtual network switches in Hyper-V management console. One will be serving cluster Heartbeat (Private Network switch) and the other one will be for cluster communication and iSCSI traffic (Internal Virtual Switch) .
Note: Optionally you can add more virtual network switches based on your needs. If you need to access resources outside your Hyper-V server then you’ll need to create an External Virtual Switch and use that for cluster communication.
3. Configure Shared Storage: Create a Virtual Hard Disk (VHD) on your Hyper-V host machine and attach it to your iSCSI Storage VM Server via the virtual SCSI controller.
Note: all the iSCSI shared disks will be created inside this VHD, so you need to size the VHD based on the number of shared disks and their size you will need in your cluster.
In my example, I’ve created a 20GB VHD inside Hyper-V Management console (New Hard Disk…) and attached it to my storage server VM's SCSI controller.
Now, from inside the storage VM, we'll need to access Microsoft iSCSI software target (under Administrative Tools)
Start creating your shared disks (including Witness disk) under Devices.
On the next step you can add the target node(s) or just move next and add it later. We'll come back and add it later.
You can see that our iSCSI disk has been provisioned but isn't being accessed by anyone yet.
Let's repeat the last step and provision more iSCSI virtual disks for your shared disks on the cluster. (I named them SharedDisk0X)
Configure the firewall on both ends for iSCSI communication;
On the client side configure firewall exception for iSCSI Service; (you should be just fine by checking the check box for Domain communications)
On the Storage Server side configure the firewall exception on iSCSI Service and Default iSCSI Target Port;
Configure iSCSI Initiator on each node;
Select iSCSI initiator from Administrative Tools. If this is the first time using iSCSI initiator on that machine, Windows will require to start the iSCSI service.
The initiator name (screen shot below) will be used inside iSCSI Target Software to establish the connection.
Note: If you're using the Administrator account (with the same password on domain and local) for your Demo, make sure you logon to each node using DomainName\administrator user name. On Windows Server 2008 and above, using the administrator account will fall back to the local administrator account not Domain. Use can always use Whoami command to check the logged on account on your session. This could be a gatcha if your local and Domain Administrator accounts share the same password!
On the Storage Server, start the iSCSI software target console.
Under iSCSI Targets,
Add iSCSI hard disks to each Target;
Note: you can also create only one Target (i.e. Name: W2K8_Clu), add Virtual Disks to it and then logon from the iSCSI initiators from each node using the same iQN name.
Now on each cluster node, go back and try to connect to the iSCSI software Target on the storage server, using iSCSI Initiator. Quick Connect… should work fine for you.
After this all those iSCSI disks will show up in each node's Disk Management console (diskMgmg.msc)
While in there, we need to right click on each disk and bring them Online. Then initialize all the disks and assign them Drive letters. This has to be done on all nodes that are going to be joined to the cluster.
Note: As you know, in production environment you need to have a dedicated network for your iSCSI traffic but for this demo I've used the same virtual network for the iSCSI traffic.
4. Cluster Setup: Now that all the nodes are joined to the Domain and can see all the iSCSI shared disks, we need to install Failover Clustering Feature (From Server Manager Console) on each node. (No Reboot required)
After installing the Role, you’ll need to use the most awesome feature of new failover clustering in Windows Server 2008 and Windows Server 2008 R2 that is Cluster Validation Wizard.
Go to Failover Cluster Manager console from Administrative Tools.
Launch Validate a Configuration… wizard;
When the validation completes, you’ll need to review the report and address any possible issues in there.
The following report looks like a successful one;
In my demo, I got 3 warnings that are related to not having a default gateway assigned to the Ethernet adaptors. (I wouldn't worry about this since my cluster won't need public network access)
With validation report looks good here , we can form a cluster with these nodes using the Create a Cluster... Option in Failover Clustering console’s main page;
Assign a Name and IP address for the cluster itself
Congratulations, the cluster has been configured inside your virtual machines.
Now you can proceed with creating highly available resource under Services and applications such as MSDT, SQL and all the other ones.
The following screen shot was taken after MSDTC or SQL resources were installed;
And you can see the available storage and used ones in the Failover cluster console;
Microsoft iSCSI Software Target
Configuring Windows Firewall for iSCSI Software Target
iSCSI Software Target 3.2 FAQ
Known Issues and Updates for Windows Storage Server 2008
Blog: Windows Storage Server 2008 with the Microsoft iSCSI Software Target 3.2 available to MSDN and TechNet Plus subscribers
Failover Cluster Step-by-Step Guide: Configuring a Two-Node File Server Failover Cluster
Guide to Creating and Configuring a Server Cluster Under Windows Server 2003