Solved

Scheduling replication Hyper-v

Posted on 2014-01-15
8
819 Views
Last Modified: 2016-10-25
HI All,

I have two hyperv servers with the following VMs:

SERVER: Hyperv1
VM: Alice
VM: FreePBX2

SERVER: Hyperv3
VM: TeaCup

I have replication enabled for the Hyperv1 server VMs (Alice and FreePBX2) to replicate to Hyperv3 and for TeaCup to replicate to Hyperv1.

However they are in separate offices connected by a 2mb pipe.  If replication happens all the time, which is the default setting, then there is too much bandwidth used and everything else between the offices is too slow.  

I don;t need a sync every 5 minutes and would like to schedule the replication to happen between 8pm and 7am every night and 24 hours a day on Sundays.

I looked around and found the following link to do this in powershell, but i have never used powershell and so I am really concerned about messing something up.  Is there a better way to do this?  Or otherwise a step by step on powershell?  Maybe a scheduled task that can be created?

Appreciate your help.
0
Comment
Question by:colin911
  • 3
  • 3
8 Comments
 
LVL 37

Expert Comment

by:Mahesh
ID: 39783114
Hyper-V Replica sends the log files or write changes for a virtual machine (VM) to the replica Hyper-V server for merging to the target virtual hard disk (VHD) every five minutes, and this interval can't be changed. If you want to have more granular control of the bandwidth used by Hyper-V Replica, you have two options.
•Change the port used for the Hyper-V Replica from the default 80 or 443 (which can be done in the GUI or via Windows PowerShell), then use Quality of Service (QoS) to limit bandwidth at different times of the day for that port. This effectively throttles the transmission of the write logs. If insufficient bandwidth was allocated, then the logs would build up until the QoS policy allocated more bandwidth, such as at night, when the logs could be transmitted and catch up.
Check below link for PowerShell command
http://blogs.technet.com/b/tommypatterson/archive/2012/10/10/replication-with-hyper-v-replica-part-ii-restricted-bandwidth-replication-step-by-step.aspx
Also in Replica properties you can vary VSS copy replication interval.

OR

•Use a script to pause replication at certain times, then resume when desired.

Both options need care, because if too much change occurs, the transaction log queue could be very large, taking a long time to send. If if the log size is more than 50 percent of the total VHD sizes, then a full resync operation will be performed. This takes additional IO and time as a block-by-block comparison is performed.

My suggestion is, its not good idea to replicate hyper-v replica over 2 Mbps link
Hyper-V replica if I understand correctly, it should be used in DR scenarios where bandwidth is never a constraint.
You should setup one more Hyper-V server at each location and setup replica locally
OR you can just implement complete VM Backup solution hopefully.

Mahesh
0
 

Author Comment

by:colin911
ID: 39786304
thank you Mahesh.  I'd be interested in the script option.  The replication size will not be big because the replication will not occur on the storage HD's.  Those are backed up separately.  so the only change will be in the OS config, and there are very rarely any changes on these.  But since they hold AD, I want to have a spare copy i can turn on.  Not even really a problem if it is dated a few days normally...

however i have no idea how to perform the script option.  I'm more familiar with GUI interfaces rather than scripting...

Would it be a script that I would use for a scheduled task?
0
 
LVL 37

Expert Comment

by:Mahesh
ID: 39786371
you can enable a scheduled job that suspends and resumes a VM replication. The following Cmdlets can be used:

Suspend-VMReplication
Resume-VMReplication

Just check below blog posts for actual commands, it might help
http://vniklas.djungeln.se/2012/11/30/schedule-hyper-v-vm-replication-for-non-office-hours-with-powershell/
http://vniklas.djungeln.se/2012/06/17/using-powershell-v3-scheduling-for-off-hours-hyper-v-vm-maintenanceconfiguring/

Mahesh
0
Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 

Author Comment

by:colin911
ID: 39786449
Yes, this was the link i already saw (sorry did not paste in into my original post).  I don;t have any familiarity with Powershell so was hoping to not have to go this way.  I started entering some of these values but quickly encountered errors and was a bit concerned, which is why I was looking for a way to do it without having to use powershell.

Granted I can use copy and paste and if there is no other way then I will try again i guess, but I really won't know if I have made a mistake or not and if so don't know how to use powershell to fix the mistake.

Is there a batch file I can create and have the scheduled task run that batch at a certain time to enable or stop the replication?  might not be the best method but I would be more comfortable with that...
0
 
LVL 37

Accepted Solution

by:
Mahesh earned 500 total points
ID: 39786633
In the 1st article PowerShell commands are very straight forward and self explanatory

It works with VMName, so you can create test VM, build its replica and start playing around it to get comfort
OR
Test below
Start by creating two batch files on your Hyper-v RECEIVING host.
c:\SuspendReplication.cmd  which contains the command:  powershell suspend-vmreplication *
 c:\ResumeReplication.cmd which contains the command:  powershell resume-vmreplication *

Now, you can create sc tasks through GUI or in the dos window, enter the following commands to schedule the tasks:

schtasks /create /tn “SuspendReplication” /tr c:\SuspendReplication.cmd /sc daily /st 08:00
schtasks /create /tn “ResumeReplication” /tr c:\ResumeReplication.cmd /sc daily /st 17:00

The first suspends replication at 8am and the second resumes at 5pm.
Choose whatever times you prefer to suit your needs.

Additional links
http://technet.microsoft.com/en-us/library/hh848510.aspx
http://blogs.technet.com/b/virtualization/archive/2013/05/10/resynchronization-of-virtual-machines-in-hyper-v-replica.aspx

Hope that helps

Mahesh
0
 

Author Comment

by:colin911
ID: 39788785
Thank you!  That helps a lot.
0
 

Expert Comment

by:steven freitas
ID: 41858299
@Mahesh

Hi I'm pretty new to coding and PowerShell and CMD commands and all that stuff. Could you please clarify what you mean in this line:

"sc tasks through GUI or in the dos window"

SC??
What GUI?
DOS??

Many thanks :)
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Will try to explain how to use the VMware feature TAGs in the VMs and create Veeam Backup Jobs using TAGs. Since this article is too long, I will create second article for the Veeam tasks.
Veeam Backup & Replication has added a new integration – Veeam Backup for Microsoft Office 365.  In this blog, we will discuss how you can benefit from Office 365 email backup with the Veeam’s new product and try to shed some light on the needs and …
In this Micro Tutorial viewers will learn how to restore single file or folder from Bare Metal backup image of their system. Tutorial shows how to restore files and folders from system backup. Often it is not needed to restore entire system when onl…
This tutorial will walk an individual through the process of installing of Data Protection Manager on a server running Windows Server 2012 R2, including the prerequisites. Microsoft .Net 3.5 is required. To install this feature, go to Server Manager…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question