Schedule-CreatorX4.ps1

Continuing the X4 series which started with: SVM-CreatorX4.ps1

The next thing to do - before creating a volume which has 4 copies of the data (Production, Local Vault, DR of Production, DR of Vault) - we need to create some Cron schedules, a Snapshot policy, and SnapMirror policy (SnapVault) for the lab setup.

The Script

############################
## Schedule-CreatorX4.ps1 ##
############################

## INTRODUCTION ##
"
<<<<< Schedule-CreatorX4.ps1 >>>>>

This script creates using PowerShell, for the same four clusters, the following Cron Schedules, Snapshot and SnapMirror Policies (the Clustershell equivalent commands are presented). These will be used later when for VOL-CreatorX4 which will create 4 copies of the data with protection

1) Cron Schedules ::>

cron create -name 10min -minute 10,20,30,40,50
cron create -name 60min -hour 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23 -minute 00
cron create -name 24hrs -hour 0 -minute 00
cron create -name sm20min -minute 5,25,45
cron create -name sv60min -minute 15
cron create -name sm60min -minute 25

2) SnapShot Policy ::>

snapshot policy create  -policy 10x10min_46x60min_2x24hrs -enabled true -schedule1 10min -count1 10 -snapmirror-label1 10min -schedule2 60min -count2 46 -snapmirror-label2 60min -schedule3 24hrs -count3 2 -snapmirror-label3 24hrs
vserver modify -vserver {SVMNAME} -snapshot-policy 10x10min_46x60min_2x24hrs

3) SnapMirror Policy

snapmirror policy create -policy 92x60min_16x24hrs -vserver {CLUSTERNAME}
snapmirror policy add-rule -vserver {CLUSTERNAME} -policy 10x10min_92x60min_16x24hrs -snapmirror-label 60min -keep 92
snapmirror policy add-rule -vserver {CLUSTERNAME} -policy 10x10min_92x60min_16x24hrs -snapmirror-label 24hrs -keep 16
"

## USER INPUTS ##
$Username     = Read-Host ">>> Enter Admin User "
$Password     = Read-Host ">>> Enter Password " -AsSecureString
$Credential   = New-Object System.Management.Automation.PsCredential($username,$password)

## CLUSTER AND SVM NAMES ##
$0123 = 0,1,2,3
$Clusters = "NCA1","NCA2","NCB1","NCB2"
$SVMs = "NCA1V1","NCA2V1","NCB1V1","NCB2V1"

$0123 | foreach {

Connect-NcController $Clusters[$_] -Credential $Credential

"";">>> CONNECTED TO: " + $Clusters[$_]
"";"<<< CREATE THE CRON SCHEDULES >>>";""

Add-NcJobCronSchedule -Name 10min -Minute 10,20,30,40,50
Add-NcJobCronSchedule -Name 60min -Hour 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23 -minute 00
Add-NcJobCronSchedule -Name 24hrs -Hour 0 -Minute 00
Add-NcJobCronSchedule -Name sm20min -Minute 5,25,45
Add-NcJobCronSchedule -Name sv60min -Minute 15
Add-NcJobCronSchedule -Name sm60min -Minute 25

"";"<<< CREATE THE SNAPSHOT POLICIES AND APPLY TO THE SVMs >>>";""

New-NcSnapshotPolicy -Name 10x10min_46x60min_2x24hrs -Schedule 10min -Count 10 -SnapMirrorLabel 10min
Add-NcSnapshotPolicySchedule -Name 10x10min_46x60min_2x24hrs -Schedule 60min -Count 46 -SnapmirrorLabel 60min
Add-NcSnapshotPolicySchedule -Name 10x10min_46x60min_2x24hrs -Schedule 24hrs -Count 2 -SnapmirrorLabel 24hrs

Set-NcVserver -Name $SVMs[$_] -SnapshotPolicy 10x10min_46x60min_2x24hrs

"";"<<< CREATE THE SNAPMIRROR POLICY >>>";""

New-NcSnapMirrorPolicy -Name 92x60min_16x24hrs -VserverContext $Clusters[$_]
Add-NcSnapMirrorPolicyRule -Name 92x60min_16x24hrs -VserverContext $Clusters[$_] -SnapmirrorLabel 60min -RetentionCount 92
Add-NcSnapMirrorPolicyRule -Name 92x60min_16x24hrs -VserverContext $Clusters[$_] -SnapmirrorLabel 24hrs -RetentionCount 16

} # END $0123 | foreach

"";">>> THE END <<<";""

Comments