How to build a Failover Cluster on a couple of laptops
Note: This is NOT best practice deployment advice. This is “notes from the field”. This is how to get by with what we have.
If you have been following along, you have a couple of domain joined Windows Server machines running Hyper-V and have a Failover Cluster running on one of them. Our Failover Cluster is pretty basic as it currently stands – two virtual machines accessing shared VHDX files.
Let’s build a Failover Hyper-V Cluster on laptops
OK, lots of ways to skin this – and all depending on what hardware you have access to. I’ll do it with two laptops, a gigabit switch, four USB to Ethernet dongles and a bunch of cables. If you have three laptops, just put the Domain Controller and the Storage onto the third one. If you don’t have any USB to Ethernet dongles, you can do this with just the one network. Three laptops is the best solution, as it will let you “kill” a cluster node and watch everything fail over automatically (you can do this with two laptops – you just need to be careful as to which one to switch off).
We already have two domain joined laptops, running Windows Server with the Hyper-V role enabled, so let’s start from there. We also have a Domain Controller running. So, that’s the compute part of our environment sorted.
I’m going to use two USB to Ethernet dongles in each laptop (Heartbeat and Live Migration).
It is a best practice to name your network connections – it makes your life so much easier.
I’ve configured my Heartbeat network to have 10.0.0.0/24 addresses and Live Migration has 188.8.131.52/24
This is definitely NOT a best practice and is really only for our evaluation purposes. Mind you, if you have a third laptop (or old PC or Server), then you could continue to run like this (with separate storage). If you only have two laptops, then your clustered storage will have to be on one of them – and that means the path to your storage has to go out over the network, through a virtual machine and through Hyper-V before it hits the disks (which means that it is not optimal).
There’s an easy way to do this and a hard way – we’ll do both!
Easy is a File Share, hard is an iSCSI Target.
You would think that in both cases you’d just enable that storage on one of the laptops – you would be wrong!
- Failover Clustering is clever enough to realise that the SMB File Share is on one of the nodes (and that it is therefore NOT shared storage) – try it if you like, just to see the error message.
- The iSCSI initiator can be configured to loopback onto itself, but it really doesn’t work very well at all (so I’m not going to tell you how to do it)!
You’re going to need another Virtual Machine – I’ve called mine \\STORAGE and have added the File Server and iSCSI Target Server roles.
Ideally put \\STORAGE on some fast disk – SSD or external caddy.
The easy way (an SMB File Share)
- On \\STORAGE create a share (c:\VMs). Give full control to both the laptop machine accounts.
- In Failover Cluster Manager, create a cluster.
- Add the nodes
- Give it a name (HV-Cluster)
- Give it an IP address if not using DHCP
- Make sure you un-check the Add all eligible storage to the cluster box
- Click Next
- Your cluster is built – but has a warning about the Witness
- Configure the cluster (in Failover Cluster Manager)
- Go into Networks and rename them – to match the names we gave them earlier
- Specify whether they are to be used for cluster communications and/or client
- Click on the Network Connections tab at the bottom of the page – it all makes sense!
- Right click on Networks and configure Live Migration Settings
- Configure Cluster Quorum Settings
- In Failover Cluster Manager, Right click your cluster (HV-Cluster.contoso.ie), select More and Configure Cluster Quorum Settings
- Select Advanced quorum configuration
- And Configure a file share witness and point it to the Share you created at the beginning of this section (\\STORAGE\VMs)
- Your Hyper-V Failover Cluster is ready (patients – we’ll play soon…)
The hard way (an iSCSI Target)
There is some preparation work to do before we can create our cluster:
- In Server Manager on \\STORAGE go into File and Storage Services –> iSCSI and start the New iSCSI Virtual Disk Wizard
- Enter a custom path (create a new folder to keep things tidy – c:\iSCSI)
- Create a 1GB Quorum disk (go for Dynamically expanding – we’re using laptops)
The wizard will then guide you through creating a New iSCSI target
- Give it a name (Storage)
- Add both the laptops as iSCSI initiators
- Do it by IQN (as it will work 100% of the time – I’ve had “issues” with both IP Address and DNS Name)
- For our evaluation, leave the Authentication alone (we don’t need it)
- Click Create (ignore the error)
- Create a second iSCSI Virtual Disk (30GB, Dynamically expanding)
- Assign it to the existing iSCSI target (that we created earlier)
We can now get our Hyper-V hosts to connect to the iSCSI Target
- On BOTH laptops, start the iSCSI Initiator
- Say Yes to have the service start automatically
- Type the name of the iSCSI server into the Target box (storage) and click Quick Connect
- Assuming all is well (and it connects) click on the Volumes and Devices tab and click Auto Configure
You should see two entries in the Volume List (these are the two virtual disks that the Target is presenting)
- On one of the laptops, go into Disk Management and online and initialize the two disks then create NTFS volumes (don’t assign drive letters to them).
C:\ & D:\ are the two internal SSD drives in my laptop. Disk 2 & Disk 3 are my iSCSI attached drives.
You are now ready to create your Failover Cluster
- The process is exactly the same as “The easy way” above – except DO check the Add all eligible storage to the cluster box
- Configure your Failover Cluster as “The easy way” above, but in addition:
- In Disks, you should see that the smallest shared disk has already been configured as the Disk Witness in Quorum (the 1GB drive)
- Right click on the other drive (Available Storage) and Add to Cluster Shared Volumes (this makes it available for Application and Hyper-V servers to use)
- Optionally rename the disks (as it just makes your life easier)
Let’s create highly available Virtual Machines
If you already have a bunch of VMs running on your hosts, you can make one of them highly available. You won’t be able to do it to your Guest Cluster nodes (not yet anyway – try, just to see the error) and I don’t suggest you do it to your Domain Controller as it will make things awkward later on.
- In Hyper-V Manager, right click the VM you want to make highly available and select Move
- Select to Move the virtual machine’s storage and then to Move all of the virtual machine’s data to a single location
Your VM can be running – this is a Live Storage Migration
- If your cluster is built with iSCSI, then the location for the virtual machine’s items is C:\ClusterStorage\Volume1\(optional sub folder)
- If your cluster is built with an SMB File Share, then the location is \\STORAGE\VMs\(optional sub folder)
Now you can run the Failover Clustering High Availability Wizard
To build a highly available VM from scratch, select New Virtual Machine from within Failover Cluster Manager. Select the host where it will start its life and run through the New Virtual Machine Wizard. Make sure you select the shared storage for both the Location of the virtual machine and its virtual hard disk.
You now have a two –node Hyper-V Failover cluster running on two laptops. And have at least one highly available virtual machine.
Let the learning begin! Right click the Virtual Machine and see what you can do to it (e.g. Move, Live Migration vs Quick Migration).
Part 1 in this series is here: Introduction
Part 2 in this series is here: Fabric
Part 3 in this series is here: Failover Clustering (part 1)
Part 4 in this series is here: Failover Clustering (part 2)