Freigeben über


Quickly Recovering Replication on Hyper-V

Two weeks ago, I had to recover from a sizable power outage. When this happened, my first priority was to make sure that all of my virtual machines were running well. Once I had done this, my next goal was to get Hyper-V Replica back up and running - so that I would be protected against any future problems.

Now, Hyper-V Replica would have eventually sorted itself out - but I did not want to wait for this to happen organically. I wanted things fixed immediately.

Hyper-V Replica had correctly detected that was a problem, and had scheduled resynchronization for all of my virtual machines. What I did to speed up the process was to shut down all non-critical virtual machines, and then use PowerShell to run the following command:

Get-VM -ComputerName Hyper-V-1, Hyper-V-2 | ?{$_.ReplicationMode -eq "Primary" -and $_.ReplicationHealth -eq "Critical"} | Resume-VMReplication -Resynchronize

This caused replica resynchronization to start immediately for all virtual machines that were reporting that replication was in a critical state. At this stage I must give a word of caution. You may be wandering why I shut down non-critical virtual machines before doing this. The reason is that initiating a mass resynchronization like this will generate a huge amount of disk activity, as Hyper-V goes through and rechecks all of the data on disk. I shut down non-critical systems to try and minimize the amount of data churn that occurred during this process.  Even with this precautionary step, I could feel the system slow down overall while resynchronization was happening.

But after a relatively short period of time, resynchronization was complete and my computers were (almost) back to normal.

Cheers,
Ben

Comments

  • Anonymous
    June 17, 2014
    The comment has been removed
  • Anonymous
    June 17, 2014
    The comment has been removed
  • Anonymous
    November 03, 2016
    Hello,This might be just the thing I'm looking to put in task scheduler. I have several Host1 (production) and Host2(replica) servers at various locations. I rarely get a chance to look at them as I several jobs at different locations. Whenever I noticed one has gone critical - for whatever reason - server reboot, power issue, whatever, if I just right click - resume replication it works every time. I don't want to have to check on them frequently to feel assured they are always replicating. I'd like to make a generic command if possible to work on any Host1(production server) no matter the name -e.g. ACME-Host1 to Acme-Host2 or Widget-Host1 to Widget-Host2 (each server might have several vms running and each location they have very specific names)?I tried this and it doesn't work - any suggestions?Get-VM -ComputerName * | ?{$.ReplicationMode -eq “primary” -and $.ReplicationHealth -eq “Critical”} | Resume-VMReplication -Resynchronize *
  • Anonymous
    November 03, 2016
    The comment has been removed
    • Anonymous
      November 03, 2016
      The comment has been removed