Step-by-step implementation of a Hyper-V cluster 2012 r2 with replication, automatic failover and load balancing
How Evidian SafeKit implements simply a Hyper-V cluster 2012 R2 with replication, automatic failover and load balancing of VMs?
The goal of this article is to explain how to implement a Hyper-V cluster 2012 R2 in two VMware VMs. After the implementation, you will be able to run the following video with real-time replication, automatic failover and load balancing of VMs.
For more information on the architecture, see Hyper-V replication automatic failover and load balancing of VMs (no shared disk).
We suppose a laptop with the following minimum hardware and the installation with VMware Player of 2 Windows 2012 R2 VMs as explained here.
Hyper-V cluster 2012 R2 configuration
The names of the 2 Windows 2012 R2 VMs are SERVER1 and SERVER2.
Note: To install the Hyper-V role inside a Windows 2012 R2 VM, a special configuration is required in VMware Player to run Hyper-V in a VM.
Else the following error is displayed: "Hyper-V cannot be installed: A hypervisor is already running."
To allow nesting of hypervisors (http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2044876):
- stop the VM in VMware Player
- start VMware Player
- select the VM (SERVER1 or SERVER2)
- edit Virtual machine settings
- click on Options tab
- in Version menu, replace "Windows Server 2012" by "Hyper-V (unsupported)"
Install the Hyper-V role in SERVER1 and SERVER2
- right click on the Windows Start logo and start Program and Features
- click on Turn Windows features on or off
- Server Manager is started and then a wizard named Add Roles and Features Wizard
- execute the wizard
- at the Server Roles step, check Hyper-V
- restart the VM
For ease of demonstration, pin Hyper-V Manager in the Taskbar
- start / Control Panel / System and security / Administrative Tools
- right-click on Hyper-V Manager and Pin to Taskbar
Create a VM named Alpha in SERVER1
- copy Windows 2012 R2 180 days ISO from host (the laptop) to guest (SERVER1) in C:\packages
- start Hyper-V Manager from the taskbar in SERVER1
- action New / Virtual Machine
- name: Alpha
- memory: 512MB
- create a virtual hard disk: 16GB
- install an operating system from a bootable CD/DVD-ROM
- image file (.iso) : c:\packages\9600.16384.WINBLUE_RTM.130821-1623_X64FRE_ENTERPRISE_EVAL_EN-US-IRM_CENA_X64FREE_EN-US_DV5
- start Alpha and install a Windows 2012 R2 x64
- connect to the Alpha display in Hyper-V Manager
- Langue US / Time French / Keyboard according your country
- choose Windows Server 2012 R2 Standard Evaluation (Server with a GUI)
- choose Custom: Install Windows only (advanced)
- create the administrator account with password safekit1234AB
- action Ctrl+Alt+Delete and login in Alpha as Administrator
- remove the start of Server Manager: Manage / Server Manager Properties / Do not start Server Manager automatically at logon
- exit Server Manager
- set autologin for demonstration purpose
- right click on Windows start logo / Command Prompt (Admin)
- right click on Windows start logo / Control panel / Appearance / Change desktop background / Choose a solid color to identify Alpha (example blue)
- Control Panel / System and Security System / Change computer name : Alpha
- restart Alpha
- check the auto-login
- righ click on Windows start logo / Sutdown or sign out / Shutdown
Create a Beta VM as a clone Alpha in SERVER1:
- goto C:\Users\Public\Public Documents\Hyper-V\Virtual hard disks
- copy/paste Alpha and rename the copy Beta
- in Hyper-V Manager, action New / Virtual Machine
- name: Beta
- memory: 512MB
- check Use an existing virtual hard disk / Browse / Beta
- start Beta VM in Hyper-V Manager
- Windows start logo / Right click / Control panel / Appearance / Change desktop background / Choose a solid color to identify Beta (example orange)
- Control panel / System / Change computer name : Beta
- restart Beta
- check the automatic login
- right click on Windows start logo / Shutdown or sign out / Shutdown
In SERVER1, start File Exporer from the taskbar and create the folder C:\HAVMs
Download and install SafeKit (at least 188.8.131.52) in SERVER1 and SERVER2: http://www.evidian.com/products/high-availability-software-for-application-clustering/cluster-test-free-download/
Add firewall rules in the Microsoft firewall ruleset to allow the SafeKit processes to communicate with their peers in the cluster. Start a command line as Administrator :
- cd C:\safekit\private\bin
- firewallcfg.cmd add
At this step, you can run the previous video and demonstrate a Hyper-V cluster 2012 R2 with replication, failover and load balancing of VMs. Before read the following notes.
Note 1: When exporting Alpha and Beta VMs to C:\HAVMs, wait until the end of export before being able to delete Alpha and Beta.
You will see the percentage of Exporting in the Status column of Hyper-V Manager (resize if necessary).
Note 2: Instead of installing Remote Desktop Services, use in Hyper-V Manager the ability to connect to the display of Alpha and Beta.
Then, you will see the automatic restart of VMs after a failover between SERVER1 and SERVER2.
Note 3 : When making a demonstration with a swap of Alpha and Beta, it is better to have a program running to observe the migration of Alpha and Beta VMs between SERVER1 and SERVER2.
A simple choice is
- for Alpha: Task Manager (Action Ctrl+Alt+Delete) / More details / Performance
- for Beta: Task Manager (Action Ctrl+Alt+Delete) / More details / Performance / Open resource monitor
Note 4: If SERVER1 and SERVER1 are running Windows 8.1 instead of Windows 2012 R2, you have to activate Powershell for the restart scripts of SafeKit Hyper-V module. For that:
- Start a Command Prompt (Administrator)
- Type powershell
- Set-ExecutionPolicy RemoteSigned
All tutorials on the SafeKit high availability and load balancing software are available here.