Host-based backup of VMware vSphere VMs.
Post Reply
Drewskii
Novice
Posts: 6
Liked: never
Joined: Dec 20, 2012 3:00 am
Full Name: Andrew Bray
Contact:

Consolidate Replicas at Night

Post by Drewskii »

Hi guys,
Have a customer that is using replication extensively and a few VM's are replicating every 15 minutes. At night they are doing backups as well. I would like to consolidate the restore points at night (mainly for the hourly machines) to save the 2 minutes per machine applying retention policy, This way I can adjust the rentention policy to 12 (one per hour) and then in the morning when it start replicating I am not waiting for the retention policy to apply every time.

Hopefully it makes sense (does in my crazy brain). The customer doesn't have a need to be granular the day after, we replicate to keep the data up to date.

Thanks,
Andrew Bray
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Consolidate Replicas at Night

Post by veremin »

Hi, Andrew.

In the way I see it, you’re slightly misunderstanding the concept of the retention policy. Even if you set retention policy to 12, when you reach the stage of having 12 restore points, each next run of replication job will consolidate first restore point in the chain to the VM. So, it’s unlikely that you'll meet your expectations by the means of such actions.

I’d probably think about implementation of simple PowerShell script that would be run during the night time (Windows Task Scheduler). This script would set retention policy to 1 and run replication job, thus all of the hourly snapshots will be consolidated, leaving your with the latest state of your VM. After having done that, it would set retention policy back to the 12.

Or, otherwise, you can make it all manually. :D

Hope this helps.
Thanks.
dellock6
Veeam Software
Posts: 6137
Liked: 1928 times
Joined: Jul 26, 2009 3:39 pm
Full Name: Luca Dell'Oca
Location: Varese, Italy
Contact:

Re: Consolidate Replicas at Night

Post by dellock6 » 1 person likes this post

since replica retention points are simple vSphere snapshots, you can also skip at all Veeam and consolidate snapshots via PowerCLI...

Luca.
Luca Dell'Oca
Principal EMEA Cloud Architect @ Veeam Software

@dellock6
https://www.virtualtothecore.com/
vExpert 2011 -> 2022
Veeam VMCE #1
Gostev
Chief Product Officer
Posts: 31457
Liked: 6647 times
Joined: Jan 01, 2006 1:01 am
Location: Baar, Switzerland
Contact:

Re: Consolidate Replicas at Night

Post by Gostev »

What Luca suggested might indeed be a neater solution...
Drewskii
Novice
Posts: 6
Liked: never
Joined: Dec 20, 2012 3:00 am
Full Name: Andrew Bray
Contact:

Re: Consolidate Replicas at Night

Post by Drewskii »

Thanks for the suggestions. I have tweaked a script I found at http://bit.ly/TzsMHA to pull virtual machines from my VM folder that contains the replicas. Currently running now and seems to be working well.

---Script Below----

Code: Select all

Connect-VIServer -Server <Server>
 
        foreach ($vm in get-folder "Disaster Recovery"|get-vm | sort-object){
            $snaps = get-snapshot -vm $vm
            $vmname = $vm.name
                foreach ($snap in $snaps){
                $snapName = $snap.name
                    if ($snapname -ne $null){
                        #"  "
                        $strOut = "Found snapshot: $snapname on: $vmname"
                        $strOut | Out-Default
                        $snap | select-object *
                        
                        # Rem the following line to perform just inventory, leave to get the remove prompt.
           remove-snapshot -snapshot $snap -confirm:$false
                    }
                    #else {"No snapshots found on $vmname"}
                    #"  "
                }
        }
Drewskii
Novice
Posts: 6
Liked: never
Joined: Dec 20, 2012 3:00 am
Full Name: Andrew Bray
Contact:

Re: Consolidate Replicas at Night

Post by Drewskii »

*Update*
Be warned, one of my virtual machine replicas came up with the error "virtual machine disks consolidation is needed" and Hard Disk 1 was pointing to one of the snapshot disks. I have fixed it by manually mapping it to the correct disk and will be doing more testing. Just thought I would give a quick warning!

Drew
Drewskii
Novice
Posts: 6
Liked: never
Joined: Dec 20, 2012 3:00 am
Full Name: Andrew Bray
Contact:

Re: Consolidate Replicas at Night

Post by Drewskii »

*Update 2*
Do not run this script. I got the following message in my next replication job "27/12/2012 12:17:43 PM :: Latest restore point not found, deleting replica VM KEW-EXCH-02_replica" and it is now starting over again. Looks like this project is now on hold.

Does anyone know if this meant to happen?
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Consolidate Replicas at Night

Post by veremin »

Hi, Andrew.

I haven’t seen such behavior so far, but it seems to me that VB&R replication stays unaware about changes that have been made by PowerCLI, thus, replication job seeks a latest restore point created during previous run, and finding nothing starts all from the scratch.

That’s why in order to avoid unnecessary consequences I recommended to let VB&R itself handle the whole process.

This script should help you to meet your expectations. Save it and schedule it by the means of Windows Scheduler to run during the night time.

Code: Select all

Add-PSSnapin -Name VeeamPSSnapIn

$rj = Get-VBRJob -name "Name of your replication job"
$rjo = $rj.GetOptions()
$rjo.BackupStorageoptions.RetainCycles = "1"
$rj.SetOptions($rjo)

Start-VBRJob -job $rj

$rjo.BackupStorageoptions.RetainCycles = "13"
$rj.SetOptions($rjo) 
*Note: In my opinion, the second number should be 13, because 1 restore point will be created in the night, other 12 during the day. So, this number guarantees that snapshot consolidation wouldn’t occur at the last working hour.

I’ve tested it roughly in my environment; however, it’s definitely worth double-checking before implementing.

Should any questions arise, don’t hesitate to let me know.

Hope this helps.
Thanks.
Drewskii
Novice
Posts: 6
Liked: never
Joined: Dec 20, 2012 3:00 am
Full Name: Andrew Bray
Contact:

Re: Consolidate Replicas at Night

Post by Drewskii »

Thanks v.Eremin will take a look!

Regards,
Andrew Bray
Post Reply

Who is online

Users browsing this forum: No registered users and 69 guests