Here are some simple instructions on setting up your Hyper-V environment for failover. You will require at least 2 physical machines running Windows Server 2012 with the Hyper-V 3.0 Role installed. For this configuration they need to be members of the same domain and connected within the same subnet.
Enable replication for the SERVER
PREREQUISITE: HYPER-V ROLE INSTALLED, DOMAIN JOINED
1. In Hyper-V Manager, select Hyper-V Settings, Replication Configuration
2. Check “Enable this computer as a Replica Server.”, “Use Kerberos (HTTP):”, and “Allow replication from any authenticated server” checkboxes
3. Specify the default location to store Replica files
Enable replication on the VM
CONFIGURE BOTH PRIMARY AND REPLICA SERVER REPLICATION AS REPLICA SERVER IN HYPER-V MANAGER -> HYPER-V SETTINGS
LINUX/UNIX SHOULD HAVE STATIC MAC ADDRESS IN VM CONFIGURATION
1. Connect to Hyper-V manager on Primary Server
2. Select Enable Replication… for the guest virtual machine you with to enable replication for
3. Follow the wizard, selecting the Replica server (For: Authentication type, Replication VHDs, Recovery History, and Initial Replication Method – default values are acceptable) and finish
Failover is now possible through the Replication sub-menu, where we can also view Replication Health and Remove Replication.
Replication must be enabled on each virtual machine that requires fail over capability – on a per case basis.
In other words, Replication is NOT a server configuration, meaning that each virtual machine could have a different Primary/Replica server pair and that each server can be failed over separately.
Perform a Planned Failover
1. Shut down virtual machine that has replication enabled (see above)
2. Select Planned Failover… from the Replication context sub-menu
3. Ensure the “Start the Replica virtual machine after failover.” check box is selected
4. Click Fail Over
5. Verify the replica server is correctly running the replica virtual machine after the Planned Failover “Failover completed successfully.” dialog box appears (i.e. network configuration)
This process will require a few minutes of downtime since the server must be powered off, replicated and powered back on.
Failover is not the same as the more expensive solution, High Availability (HA) which affords zero downtime.
Fail Over will Fail if virtual machine is not powered off or if both servers are not configured correctly
Perform a Failover
ONLY USE THIS OPTION IF THE PRIMARY SERVER HAS FAILED AS THERE IS POTENTIAL FOR DATA LOSS!
1. Select Failover… from the Replication context sub-menu
2. Specify the recovery point to use
3. Click Fail Over
Move VM back to original server
1. Perform a Planned Failover (see above) once the original server has been repaired
Note: If the original/failed server has been replaced, you will need to configure the replacement server for replication
1. Under the Replication sub-menu in Hyper-V manager, click Remove Replication
2. (OPTIONAL) Manually delete virtual machine from Replica Server
When removing replication, the replica VM will remain on the Replica server and must be manually removed. If you need to enable replication in the future, leaving the VM on the replica server will allow the “Use an existing virtual machine on the Replica server as the initial copy.” option when choosing the initial replication method in the Enable Replication wizard. This can cut down on network traffic but will not necessarily take less time as the servers still need to communicate the changes to the VHD files which can be disk IO intensive. If bandwidth is not a consideration, it usually makes more sense to start from scratch when enabling replication (“Send initial copy over the network.” option).