Data Backup and Recovery

Snapcenter Vault Cascade

amayacitta
2,683 Views

Hi guys,

 

We're having fun with Snapcenter and snap vault's - they work fine when using a fan-out configuration but when doing a cascade there is no support as per the below link.

 

Currently we are thinking of adding a post job script to add the snapmirror-label and using this to do a snap vault cascade outside of snap center.

 

Does anyone know if cascade support is coming?

 

https://docs.netapp.com/ocsc-42/topic/com.netapp.doc.ocsc-gsg/GUID-D6F0DD8F-3E54-465E-B141-726639AFB1B5.html

1 ACCEPTED SOLUTION

amayacitta
2,567 Views

Hope someone finds this useful, the only was I found to do cascade was to sort the labels and transfers manually. Here is an example script with some identity stuff removed. I'd be interested to know how others do this sort of thing, I think the challenge now is to get this working with Data broker - the script would need to sit on the data broker itself (according to docuemtnation) so i'll need a bash script I guess rather than PowerShell. Will be trying to sort that out later this week.

 

If the product management team at NetApp could add cascade support into the GUI that would be great, it should be totally possible to add/tag particular SVM's to the job so SnapCenter can be specifically told what SVM relates to the first then second relationship. Or I guess some sort of discovery could take place.

 

The script is placed as a post on the agent (just happens to be the database of SnapCenter in this case) and will perform the following:

 

  1. Inject snapmirror labels into daily, weekly, monthly snaps
  2. Perform snapmirror update to second system
  3. Wait for snapmirror update to complete
  4. Perform snapmirror update to third vault cascade system
  5. Bin out logs older than 30 days for the scripting

 

# Script to add SnapMirror Labels to source snapshots
# After adding labels a SnapMirorr Update will be performed
# After SnapMirror update is complete the cascaded SnapVault will also be updated
# Amayacitta Gill - Simplify IT
# Last edited 16/12/19

# Start logging
$CurrentDate = Get-Date
$CurrentDate = $CurrentDate.ToString('MM-dd-yyyy_hh-mm-ss')
$Logpath = "D:\Scripts\Logs\dc1_lun_snapcenter_db01_iscsi"
Start-Transcript -Append -Path $Logpath\$currentdate.log

# Import Data ONTAP PoSH Module 
Import-Module "C:\Program Files (x86)\NetApp\NetApp PowerShell Toolkit\Modules\DataONTAP\DataONTAP.psd1"

# Set general variables
$nausername = "snapcenter"
$scserver = "DC1VSNAP01"

# Set NetApp source variables
$sourcenacontroller = "DC1PNETAPP01"
$sourcevolname = "dc1_lun_snapcenter_db01_iscsi"
$sourcenapssword = Get-Content D:\Scripts\Credentials\DC1PNETAPP01.txt | ConvertTo-SecureString
$sourcenacred = New-Object System.Management.Automation.PsCredential($nausername, $sourcenapssword)

# Set NetApp Mirror destination variables
$mirrornacontroller = "DC3PNETAPP01"
$mirrorvolname = "dc1_lun_snapcenter_db01_iscsi_mirror"
$mirrorsvmname = "DC3VSVM01"
$mirrornapssword = Get-Content D:\Scripts\Credentials\DC3PNETAPP01.txt | ConvertTo-SecureString
$mirrornacred = New-Object System.Management.Automation.PsCredential($nausername, $mirrornapssword)
$snapmirrordst = [System.String]::Concat($mirrorsvmname,":",$mirrorvolname)

# Set NetApp Vault destination variables
$vaultnacontroller = "DC3PNETAPP02"
$vaultvolname = "dc1_lun_snapcenter_db01_iscsi_vault"
$vaultsvmname = "DC3VSVM03"
$vaultnapssword = Get-Content D:\Scripts\Credentials\DC3PNETAPP02.txt | ConvertTo-SecureString
$vaultnacred = New-Object System.Management.Automation.PsCredential($nausername, $vaultnapssword)
$snapvaultdst = [System.String]::Concat($vaultsvmname,":",$vaultvolname)

# Connect to source NetApp using secure encrypted password
Connect-NcController -Name $sourcenacontroller -Port 443 -HTTPS -Credential $sourcenacred

# Set snapmirror labels for snapvault
Get-NcVol $sourcevolname | Get-NcSnapshot | ? Name -like *daily* | Set-NcSnapshot -SnapmirrorLabel daily
Get-NcVol $sourcevolname | Get-NcSnapshot | ? Name -like *weekly* | Set-NcSnapshot -SnapmirrorLabel weekly
Get-NcVol $sourcevolname | Get-NcSnapshot | ? Name -like *monthly* | Set-NcSnapshot -SnapmirrorLabel monthly

# ZAPI bug doesn't show labels using PoSH, use the below command if you want to check labels manually from PoSH
# Get-NcVol $sourcevolname | Get-NcSnapshot -Attributes @{ "snapmirrorlabel" = "" } | Select-Object Name,SnapmirrorLabel

# Connect to mirror NetApp using secure encrypted password
Connect-NcController -Name $mirrornacontroller -Port 443 -HTTPS -Credential $mirrornacred

# Perform Snap Mirror update, will update based on policy on mirror destination
Invoke-NcSnapmirrorUpdate -Destination $snapmirrordst

# Track completion of snapmirror update
# Make sure SnapCenter policy has adequate time to complete before it timesout
# This could be tricky with bandwdith issues so set faily high
$snapmirrorstate = get-ncsnapmirror -Destination $snapmirrordst | ? MirrorState -like snapmirrored | select mirrorstate
while ($snapmirrorstate -like "snapmirrored") 
    {
     $snapmirrorstate = get-ncsnapmirror -Destination $snapmirrordst | ? MirrorState -like snapmirrored | select mirrorstate
     Write-Host "SnapMirror is $snapmirrorstate waiting for completion"
     Start-Sleep 5
    }
Write-Host "SnapMirror is $snapmirrorstate continuing script"

# Connect to vault NetApp using secure encrypted password
Connect-NcController -Name $vaultnacontroller -Port 443 -HTTPS -Credential $vaultnacred

# Perform Snap Vault update, will update based on policy on vault destination
Invoke-NcSnapmirrorUpdate -Destination $snapvaultdst

# Stop logging
Stop-Transcript

# Retain 30 days of logs
Get-ChildItem –Path "$Logpath" -Recurse | Where-Object {($_.LastWriteTime -lt (Get-Date).AddDays(-30))} | Remove-Item

View solution in original post

1 REPLY 1

amayacitta
2,568 Views

Hope someone finds this useful, the only was I found to do cascade was to sort the labels and transfers manually. Here is an example script with some identity stuff removed. I'd be interested to know how others do this sort of thing, I think the challenge now is to get this working with Data broker - the script would need to sit on the data broker itself (according to docuemtnation) so i'll need a bash script I guess rather than PowerShell. Will be trying to sort that out later this week.

 

If the product management team at NetApp could add cascade support into the GUI that would be great, it should be totally possible to add/tag particular SVM's to the job so SnapCenter can be specifically told what SVM relates to the first then second relationship. Or I guess some sort of discovery could take place.

 

The script is placed as a post on the agent (just happens to be the database of SnapCenter in this case) and will perform the following:

 

  1. Inject snapmirror labels into daily, weekly, monthly snaps
  2. Perform snapmirror update to second system
  3. Wait for snapmirror update to complete
  4. Perform snapmirror update to third vault cascade system
  5. Bin out logs older than 30 days for the scripting

 

# Script to add SnapMirror Labels to source snapshots
# After adding labels a SnapMirorr Update will be performed
# After SnapMirror update is complete the cascaded SnapVault will also be updated
# Amayacitta Gill - Simplify IT
# Last edited 16/12/19

# Start logging
$CurrentDate = Get-Date
$CurrentDate = $CurrentDate.ToString('MM-dd-yyyy_hh-mm-ss')
$Logpath = "D:\Scripts\Logs\dc1_lun_snapcenter_db01_iscsi"
Start-Transcript -Append -Path $Logpath\$currentdate.log

# Import Data ONTAP PoSH Module 
Import-Module "C:\Program Files (x86)\NetApp\NetApp PowerShell Toolkit\Modules\DataONTAP\DataONTAP.psd1"

# Set general variables
$nausername = "snapcenter"
$scserver = "DC1VSNAP01"

# Set NetApp source variables
$sourcenacontroller = "DC1PNETAPP01"
$sourcevolname = "dc1_lun_snapcenter_db01_iscsi"
$sourcenapssword = Get-Content D:\Scripts\Credentials\DC1PNETAPP01.txt | ConvertTo-SecureString
$sourcenacred = New-Object System.Management.Automation.PsCredential($nausername, $sourcenapssword)

# Set NetApp Mirror destination variables
$mirrornacontroller = "DC3PNETAPP01"
$mirrorvolname = "dc1_lun_snapcenter_db01_iscsi_mirror"
$mirrorsvmname = "DC3VSVM01"
$mirrornapssword = Get-Content D:\Scripts\Credentials\DC3PNETAPP01.txt | ConvertTo-SecureString
$mirrornacred = New-Object System.Management.Automation.PsCredential($nausername, $mirrornapssword)
$snapmirrordst = [System.String]::Concat($mirrorsvmname,":",$mirrorvolname)

# Set NetApp Vault destination variables
$vaultnacontroller = "DC3PNETAPP02"
$vaultvolname = "dc1_lun_snapcenter_db01_iscsi_vault"
$vaultsvmname = "DC3VSVM03"
$vaultnapssword = Get-Content D:\Scripts\Credentials\DC3PNETAPP02.txt | ConvertTo-SecureString
$vaultnacred = New-Object System.Management.Automation.PsCredential($nausername, $vaultnapssword)
$snapvaultdst = [System.String]::Concat($vaultsvmname,":",$vaultvolname)

# Connect to source NetApp using secure encrypted password
Connect-NcController -Name $sourcenacontroller -Port 443 -HTTPS -Credential $sourcenacred

# Set snapmirror labels for snapvault
Get-NcVol $sourcevolname | Get-NcSnapshot | ? Name -like *daily* | Set-NcSnapshot -SnapmirrorLabel daily
Get-NcVol $sourcevolname | Get-NcSnapshot | ? Name -like *weekly* | Set-NcSnapshot -SnapmirrorLabel weekly
Get-NcVol $sourcevolname | Get-NcSnapshot | ? Name -like *monthly* | Set-NcSnapshot -SnapmirrorLabel monthly

# ZAPI bug doesn't show labels using PoSH, use the below command if you want to check labels manually from PoSH
# Get-NcVol $sourcevolname | Get-NcSnapshot -Attributes @{ "snapmirrorlabel" = "" } | Select-Object Name,SnapmirrorLabel

# Connect to mirror NetApp using secure encrypted password
Connect-NcController -Name $mirrornacontroller -Port 443 -HTTPS -Credential $mirrornacred

# Perform Snap Mirror update, will update based on policy on mirror destination
Invoke-NcSnapmirrorUpdate -Destination $snapmirrordst

# Track completion of snapmirror update
# Make sure SnapCenter policy has adequate time to complete before it timesout
# This could be tricky with bandwdith issues so set faily high
$snapmirrorstate = get-ncsnapmirror -Destination $snapmirrordst | ? MirrorState -like snapmirrored | select mirrorstate
while ($snapmirrorstate -like "snapmirrored") 
    {
     $snapmirrorstate = get-ncsnapmirror -Destination $snapmirrordst | ? MirrorState -like snapmirrored | select mirrorstate
     Write-Host "SnapMirror is $snapmirrorstate waiting for completion"
     Start-Sleep 5
    }
Write-Host "SnapMirror is $snapmirrorstate continuing script"

# Connect to vault NetApp using secure encrypted password
Connect-NcController -Name $vaultnacontroller -Port 443 -HTTPS -Credential $vaultnacred

# Perform Snap Vault update, will update based on policy on vault destination
Invoke-NcSnapmirrorUpdate -Destination $snapvaultdst

# Stop logging
Stop-Transcript

# Retain 30 days of logs
Get-ChildItem –Path "$Logpath" -Recurse | Where-Object {($_.LastWriteTime -lt (Get-Date).AddDays(-30))} | Remove-Item
Public