Hyper-V Replica resynchronization process detailed

  

Hyper-V Replica resynchronization This topic raises people's attention, the first question you might ask is: Why do you need to synchronize the virtual machine participating in Hyper-V Replica? Need to resynchronize? If the Hyper-V primary server recognizes that the virtual machine's replication is not optimal, or if it does not know what to copy, then it needs to resynchronize.

If the virtual machine is in a critical state, or if the primary server loses control of the tracked changes and is unable to determine the starting point for replication, then it is necessary to resynchronize. In this case, the primary server needs to start from scratch, which includes deleting the recovery history content (HRL file) and creating a baseline for the VHD file to be copied.

Resynchronization is required when the following conditions are met:

? You can change the VHD file by any method other than the one available for the Hyper-V Manager. In other words, the Hyper-V replication engine must recognize any changes to the VHD files contained in the Hyper-v replication engine so that changes can be recorded in the HRL file.

? The cumulative number of HRLs (Hyper-V replication logs) exceeds 50%.

? There was a problem writing to the HRL file.

? HRL files cannot be closed successfully.

In any of the above cases, if you need to resynchronize the virtual machine, an error message will appear in the "Copy Health Status" section. The error message is displayed as: "a virtual machine<virtual machine name> needs to be resynchronized. Resume replication to begin resynchronization. " If this information is displayed, the virtual machine must be resynchronized with the help of a replica virtual machine (Replica Virtual Machine).

Please note: Before you start resynchronizing, you must first resolve any connectivity issues between the primary server and the replication server.

There are two ways to resynchronize the contents of a virtual machine: (1) by restoring the copy on the primary virtual machine in the Hyper-V Manager, or (2) by using the PowerShell cmdlet cmdlet.

From the Hyper-V Manager, you can resume replication by right-clicking on Virtual Machine > Replication > and selecting the "Resume Replication" option Or start the resynchronization process.

To start resynchronizing with PowerShell, use the Resume-VMReplication cmdlet as follows:

Resume-VMReplication -VMName "MyVM" -Resynchronize -ResynchronizeStartTime "02/11 /2014 12:00:00"

Even if you don't need to resynchronize, or if the Hyper-V copy hasn't let the virtual machine enter the "Resynchronization Required status, you can start it manually. The resynchronization process, but unless absolutely necessary, we recommend avoiding this.

Only if you think the contents of the virtual machine are not fully synchronized, you need to resynchronize to correct the problem before proceeding with manual resynchronization. During the manually triggered resynchronization process, the virtual machine is first suspended and then the resynchronization operation is turned on.

? Suspend-VMReplication -VMName "MyVM"

? Resume-VMReplication -VMName "MyVM" -Resynchronize

You can use the Hyper-V Manager for Each virtual machine schedules a resynchronization operation. Right click on the virtual machine participating in Hyper-V Replica and select "Settings". In the left panel, select the "Resynchronization" option, then in the right panel, modify the settings as needed, as shown in the screenshot below:

From this screenshot As you can see, you can configure three settings for resynchronization: (1) manual, (2) automatic, and (3) at specified intervals. It is recommended to configure and use the third option ("automatically start resynchronizing " only in the following time periods), then change the resynchronization so that it is only during off-peak hours.

You can also use the Set-VMReplication and Get-VMReplication powerShell cmdlets to configure and view the resynchronization settings, as shown in the following command:

Disable automatic resynchronization commands :

? Set-VMReplication -VMName "MyVM" -AutoResynchronizeEnabled 0

Enable automatic resynchronization:

? Set-VMReplication -VMName "RESYNC VM" -AutoResynchronizeEnabled 1 -AutoResynchronizeIntervalStart 00:00:00 -AutoResynchronizeIntervalEnd 23:59:59

To check the resynchronization settings, use the Get-VMReplication PowerShell cmdlet cmdlet as follows:

? Get-VMReplication -VMName "MyVM" |  Ft * -auto

To check the settings of all virtual machines participating in Hyper-V Replica, use this command:

? Get-VMReplication * |  Ft * -auto

In the Get-VMReplication output, look for the AutoResynchronizeEnabled, AutoResynchronizeIntervalStart, and AutoResynchronizeIntervalEnd columns and their corresponding values.

How does the resynchronization process work?

The resynchronization process goes through the following steps:

1. The resynchronization event occurs manually or automatically.

2. The VHD size of the primary and replica virtual machines is checked.

3. During the resynchronization process, the primary server begins to track changes in VHD.

4. The write operation is tracked in the HRL file and copied once the resynchronization process has completed.

5. Event number 29242 is logged, which records the virtual machine name, VHD file, the starting data block and the ending data block of the VHD file.

6. Create a differential disk for the VHD. This is because if you need to cancel the resynchronization operation, you can easily cancel it.

7. At the end of the resynchronization operation, the differential disk is incorporated into the VHD file.

8. At this stage, the VHDs are compared and then synchronized. This comparison is compared on a data block basis, and only different data blocks are sent over the network. This mechanism reduces the amount of data sent over the network.

9. Event number 29244 is logged to the primary server after the resynchronization process. Event ID ID 29244 contains information on the VHD for replication, the name of the virtual machine, the block of data sent, the time of execution, and the result of the operation.

10. At this stage, the changes have been successfully incorporated into the VHD file and the operation cannot be cancelled.

11. All recovery points and HRL files have been deleted.

As you know, resynchronization is the process of deleting all recovery points and preparing the primary virtual machine for a fresh replication. This is very similar to when you copy a virtual machine.

The overall purpose of the resynchronization process is to ensure that the primary server begins to track changes to the VHD file again, ensuring that replication can be recovered as usual. Therefore, use "manual" resynchronization:

only if the following conditions occur: If the primary server is no longer replicated to the replica server, a significant number of changes are made at the primary virtual machine.

? If you suspect that the contents of the primary virtual machine are not consistent with the contents of the replicated virtual machine.

Copyright © Windows knowledge All Rights Reserved