Quickly Recovering Replication on Hyper-V

Quickly Recovering Replication on Hyper-V

  • Comments 2

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

Leave a Comment
  • Please add 5 and 1 and type the answer here:
  • Post
  • Ben,

    Would it wise to schedule this one-liner as to run once or more a day so that that if the replication gets out of whack it fixes itself without intervention? We have an environment that has Replica that will from time to time get out of sync and needs manual intervention.

  • wasserja, you could - and I would see no reason not to. The only problem is that I cannot think of a programmatic way of making it conditional (i.e only run if replication gets out of whack).

Page 1 of 1 (2 items)