Udostępnij za pośrednictwem


Windows Server 2012 – Part3: Virtualization Enhancements “Mobility”– Hyper-V Replica

In this post series I started here with a release date announced in Windows Server Blog (by the way it was announced yesterday (1st of August) that Windows Server 2012 is RTM today), then I start highlighting the main areas of enhancements that I will focus on in this series starting from Virtualization Enhancements started from scalability & flexibility and shown how to host Virtual Machine on Windows Server 2010 file server here.

Today I am going to move to different area which is Hyper-V Mobility, and will cover one of my favorite features in Windows Server 2012 which is Hyper-V Replica, Hyper-V Replica is new functionality added to the Hyper-V Role in Windows Server 2012 that allow virtual machines running on a host or cluster in a primary site to be replicated to a server or cluster in secondary site using available network bandwidth. Hyper-V Replica replication is efficient, periodic, and asynchronous over IP-based networks and allows a system administrator, in the event of a failure at a primary site (e.g. disaster, server failure, etc.), to execute a failover of production workloads to replica servers at a secondary location within a very short time, let me show you how to configure Hyper-V Replica.


Consider that you have a very simple Hyper-V environment consists of consists of one Domain Controller “DC” and two Hyper-V Hosts “HV1” & “HV2” in the same Active Directory Domain “contoso.com”, and the high level steps to configure and test Hyper-V Replica are as follows:

  1. Configure the Firewall to allow Hyper-V Replication.
  2. Create Virtual Network and a Virtual Machine to Replicate.
  3. Configure Hyper-V Replication Settings on the two Hosts HV1 & HV2.
  4. Configure Guest IP Injection.
  5. Test Failover (Planned and Unplanned).
  6. View Replication Status Health.

Let us start showing you how it is easy to configure and test this amazing feature Smile.


Configure the Firewall to Allow Hyper-V Replication

  • On HV1 login as Domain Administrator and click Server Manager.
  • From Tools menu click Windows Firewall with Advanced Security.

1-3_thumb[2]

  • In the Console Tree pane, click Inbound Rules.
  • Right-click the Hyper-V replica HTTP listener (TCP-In) rule, and the click Enable Rule, and close the Windows Firewall with Advanced Security console.

1-3_thumb[5]

  • Switch to HV2, and repeat the same above steps.

Create Virtual Network and a Virtual Machine to Replicate

  • On DC login as Domain Administrator and click Server Manager.
  • On the Tools menu, click Hyper-V Manager.
  • In the Console Tree pane, right-click Hyper-V Manager, and then click Connect to Server, and in Another computer, type HV1, and then click Virtual Switch Manager.
  • Ensure External is selected, and then click Create Virtual Switch.
  • In Name, Type TestNet, and then click Ok, and in Apply Networking Changes dialog box, click Yes.

1-3_thumb[8]

  • Repeat steps above using HV2 as target server to create a virtual network on HV2.
  • Then from Hyper-V Manager create new virtual machine and name it TestVM.

Configure Hyper-V Replication Settings on the two Hosts HV1 & HV2:

  • On DC, in the Hyper-V Management console, in the console tree pane, click HV1.
  • Right-click TestVM, and click Enable Replication, and click Next.

1-3_thumb[10]

  • On the Specify Replica page, type HV2.contoso.com, and then click Next, and you should expect error stating that the specified Replica server is not configured to receive replication from this server.

1_thumb[2]

  • Click Configure Server to configure HV2 as replica server.
  • On the Hyper-V Settings for HV2 page, check the Enable this computer as a Replica server check box.
  • In the Authentication and Ports section, check the Use Kerberos (HTTP) check box, and then ensure the port is 80.
  • In the Authentication and storage section, click Allow replication from any authenticated server, and click Ok.

2_thumb[1]

  • On the Specify Server page, ensure hv2.contoso.com is in the Replica server field, and click Next.
  • On the Connection Parameters page, ensure the replica server is hv2.contoso.com, the Replica server port is 80, and Use Kerberos authentication (HTTP) is selected, and also ensure that the Compress the data that is transmitted over the network check box is checked, and click Next.

3_thumb[3]

  • On the Choose Replication VHDs page, ensure that C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks\TestVM.vhdx check box is checked, and click Next, and then click Next on the Configure Recovery History page.
  • On the Choose Initial Replication Method page, select to Send initial copy over the network and Start replication immediately, then click Finish.
  • Now from Hyper-V console right-click HV1, and then click Hyper-V Settings.
  • In the Hyper-V Settings for HV1 windows, click Replication Configuration.
  • Check the Enable this computer as a Replica server check box.
  • In Authentication and Ports section, check the User Kerberos (HTTP) check box, and ensure that the port is 80.
  • In the Authentication and storage section, click Allow replication from any authenticated server, and then click Ok.

Configure Guest IP Injection:

Let me explain more why we need guest IP Injection, when a virtual machine is replicated from a primary server to a replica server, all the machine properties, including its IP address, are replicated. Hyper-V allows an administrator to place a new IP address on the replica of the virtual machine so that when it starts, it is configured with an IP address suitable to the network where the replica server is located.

  • On DC login as Domain Administrator, and in the Hyper-V Manager console, in the Console Tree pane, click HV2.
  • In the Details pane, right-click TestVM, and then click Settings.
  • Click Network Adapter, and the expand it.
  • Click Failover TCP/IP, and in IPV4 settings area, check the User the following IPv4 address schema for the virtual machine check box.
  • Configure the address from IP range same as Replica Server HV2 range, and click Apply.

1_thumb[5]

  • Under the Network Adapter, click Test Failover.
  • In the Virtual Switch drop-down menu, click TestNet, and click Ok.

Test Failover (Planned and Unplanned):

Hyper-V allows an administrator to test whether or not a virtual machine is successfully replicating by starting it on the replica server. The test is done by starting the virtual machine on a replica server and ensuring a successful start. In the test, the virtual machine does not connect to the network; therefore it will not interfere with the original virtual machine running on the primary server. In addition, replication from the primary server to the replica server is not interrupted.

  • On DC login as Domain Administrator.
  • In the Hyper-V Manager console, in the Console Tree pane, click HV2.
  • In the details pane, right-click TestVM, click Replication, and then click Test Failover.

t1_thumb[2]

  • In the Test Failover dialog box, click Test Failover.

T2_thumb[1]

  • Notice that in the Hyper-V details window, a new virtual machine named TestVM-Test is displayed.

T3_thumb[1]

  • In the Hyper-V Manager console, right-click TestVM, click Replication, click Stop Test Failover, and then in the Stop Test Failover dialog box, click Stop Test Failover.

And to execute a planned failover such as during hardware upgrades or during a planned disaster recover test follow the below steps:

  • On DC, in Hyper-V Manager console, in the Console Tree pane, click HV1.
  • In the Details pane, right-click TestVM, click Replication, and then click Planned Failover, and click Failover.

1

2

  • Wait for the Planned Failover dialog box to appear indicating a failover.

3

  • In the Planned Failover dialog box, click Close.
  • In Hyper-V Manager console, in the Console Tree pane, click HV2, and note that HV2 is now the primary server and HV1 is now the replica server for the TestVM.

And now let us simulate unplanned failover, something that can happened if primary datacenter failed.

  • On DC, in the Hyper-V Manager console, in the Console Tree pane, click HV2.
  • In the details pane, right-click TestVM, and click Shut Down., and wait until the virtual machine completely shuts down.
  • In the Hyper-V Manager console, in the Console Tree pane, click HV1.
  • In the Details pane, right-click TestVM, click Replication, and then click Failover.

U1

  • In the Failover dialog box, click Fail Over, and you should note that HV2.contoso.com become the current Primary Server for TestVM.

U2

  • In the Hyper-V Manager console, right-click TestVM, click Replication, and then click Reverse Replication.

U3

  • In the Reverse Replication Wizard for TestVM, click Next.
  • On the Specify Replica page, ensure that the replica server failed contains HV2.contoso.com.
  • Click Next four times, accepting the default values on each page in the wizard, and then click Finish.
  • In the Reverse Replication Wizard for TestVM, click Close, and note that now HV1 is the primary server and HV2 is replica server for the TestVM.

View Status Replication Health:

Hyper-V Replication provides information as to the status and health of the replicated virtual machines, in this step we will determine the replication health of a virtual machine, and then we will determine the primary and replica servers for a virtual machine.

Determine the replication health of a virtual machine:

  • In Hyper-V Manager console, in the Console Tree pane, click HV1.
  • In the Details pane, in the Virtual Machine pane, right-click any of the column headers, for example, Name, State, CPU Usage, etc., and then click Add/Remove Column.
  • In the Available Columns list, click Replication Health, and then click Add, and click Ok.
  • Adjust the column sizes so as to view the Replication Health column in the window.
  • In the Details pane, right-click TestVM, click Replication, and then click View Replication Health.

V1

  • Review the information found in the Replication Health window, and then click Close.

V2

 

I did not decide yet about what I am going to cover in the next post, but almost I will keep digging into Virtualization Enhancements specially Mobility area that has a lot of new good features and capabilities that put Microsoft Hyper-V Virtualization Platform on top of Virtualization technologies, stay tuned, get ready, get excited.


Related Posts: