1- # ###################################################################################################################
2- # ###################################################################################################################
3- # #
4- # # ActiveDR failover testing for SQL Server Failover Cluster Instance
5- # #
6- # # This demo script runs through two scenarios: -
7- # # 1. Failover of clustered SQL Server role to node on same array
8- # # 2. Failover of clustered SQL Server role to node on remote array
9- # #
10- # # The second test involves the following steps: -
11- # ##### Stop clustered SQL Server role in FCI
12- # ##### Demote source pod
13- # ##### Promote target pod
14- # ##### Move clustered role to node on target array
15- # ##### Start up clustered SQL Server role
16- # #
17- # # Author - Andrew Pruski
18- # # apruski@purestorage.com
19- # #
20- # ###################################################################################################################
21- # ###################################################################################################################
1+ # #############################################################################################################################
2+ # ActiveDR Failover Testing for SQL Server Failover Cluster Instance
3+ #
4+ # Scenario:
5+ # This demo script runs through two scenarios:
6+ # 1. Failover of a clustered SQL Server role to a node on the same storage array
7+ # 2. Failover of a clustered SQL Server role to a node on a remote storage array
8+ #
9+ # The remote array failover involves the following steps:
10+ # - Stop the clustered SQL Server role in the FCI
11+ # - Demote the source pod
12+ # - Promote the target pod
13+ # - Move the clustered role to a node on the target array
14+ # - Start the clustered SQL Server role
15+ #
16+ # Disclaimer:
17+ # This example script is provided AS-IS and meant to be a building block to be adapted to fit an individual
18+ # organization's infrastructure.
19+ # #############################################################################################################################
2220
2321
2422
25- # import powershell modules
23+ # Import PowerShell modules
2624Import-Module FailoverClusters
27- Import-Module PureStoragePowershellSDK2
25+ Import-Module PureStoragePowerShellSDK2
26+
27+
28+
29+ # Variables
30+ $ClusterName = " WindowsClusterName"
31+ $ClusterRole = " SQL Server (MSSQLSERVER)" # Clustered SQL Server role name
32+ $NodeSameArray = " NodeOnSameArray" # Cluster node on the same storage array
33+ $NodeRemoteArray = " NodeOnRemoteArray" # Cluster node on the remote storage array
34+ $SourceFlashArrayIp = " flasharray1.example.com" # Source FlashArray endpoint
35+ $SourcePodName = " PodNameOnSourceArray" # Pod name on the source FlashArray
36+ $TargetFlashArrayIp = " flasharray2.example.com" # Target FlashArray endpoint
37+ $TargetPodName = " PodNameOnTargetArray" # Pod name on the target FlashArray
38+
39+
40+
41+ # Set credentials
42+ $PureCred = Get-Credential
2843
2944
3045
@@ -36,124 +51,95 @@ Import-Module PureStoragePowershellSDK2
3651
3752
3853
39- # set variables
40- $ClusterName = " WindowsClusterName"
41- $ClusterRole = " SQL Server (MSSQLSERVER)"
42- $NodeSameArray = " NodeOnSameArray"
43-
44-
45-
46- # confirm cluster
54+ # Confirm cluster
4755Get-Cluster $ClusterName
4856
4957
5058
51- # confirm cluster nodes
59+ # Confirm cluster nodes
5260Get-Cluster $ClusterName | Get-ClusterNode
5361
5462
5563
56- # confirm clustered SQL Server service
64+ # Confirm clustered SQL Server service
5765Get-ClusterGroup - Cluster $ClusterName - Name $ClusterRole
5866
5967
6068
61- # test failing over clustered service to node on same storage array
69+ # Test failing over clustered service to node on same storage array
6270Move-ClusterGroup - Cluster $ClusterName - Name $ClusterRole - Node $NodeSameArray
6371
6472
6573
66- # confirm clustered SQL Server service
74+ # Confirm clustered SQL Server service
6775Get-ClusterGroup - Cluster $ClusterName - Name $ClusterRole
6876
6977
7078
71- # ###############################################################################################################
79+ # ###################################################################################################################
7280#
7381# Performing failover to node on remote storage array
7482#
75- # ###############################################################################################################
76-
77-
78-
79- # set source array details
80- $SourceFlashArrayIp = " SourceFlashArrayIpAddress"
81- $SourcePodName = " PodNameOnSourceArray"
82-
83-
84-
85- # set Pure credentials
86- $PureCred = Get-Credential
83+ # ###################################################################################################################
8784
8885
8986
90- # connect to source flasharray
87+ # Connect to the source FlashArray
9188$SourceFlashArray = Connect-Pfa2Array - EndPoint $SourceFlashArrayIp - Credential $PureCred - IgnoreCertificateError
9289
9390
9491
95- # confirm pod replication status
92+ # Confirm pod replication status
9693Get-Pfa2PodReplicaLink - Array $SourceFlashArray - LocalPodName $SourcePodName
9794
9895
9996
100- # confirm clustered SQL Server service
97+ # Confirm clustered SQL Server service
10198Get-ClusterGroup - Cluster $ClusterName - Name $ClusterRole
10299
103100
104101
105- # stop clustered service - taking volumes offline
102+ # Stop clustered service - taking volumes offline
106103Stop-ClusterGroup - Cluster $ClusterName - Name $ClusterRole
107104
108105
109106
110- # confirm clustered service offline
107+ # Confirm clustered service offline
111108Get-ClusterGroup - Cluster $ClusterName - Name $ClusterRole
112109
113110
114111
115- # demote Production Pod with Quiesce
112+ # Demote the source pod with quiesce
116113Update-Pfa2Pod - Array $SourceFlashArray - Name $SourcePodName - Quiesce $True - RequestedPromotionState " demoted"
117114
118115
119116
120- # confirm Production Pod status - PromotionStatus : demoted
117+ # Confirm source pod status - PromotionStatus : demoted
121118Get-Pfa2Pod - Array $SourceFlashArray - Name $SourcePodName
122119
123120
124121
125- # set target array details
126- $TargetFlashArrayIp = " TargetFlashArrayIpAddress"
127- $TargetPodName = " PodNameOnTargetArray"
128-
129-
130-
131- # connect to target flasharray
122+ # Connect to the target FlashArray
132123$TargetFlashArray = Connect-Pfa2Array - EndPoint $TargetFlashArrayIp - Credential $PureCred - IgnoreCertificateError
133124
134125
135126
136- # promote pod
127+ # Promote the target pod
137128Update-Pfa2Pod - Array $TargetFlashArray - Name $TargetPodName - RequestedPromotionState " promoted"
138129
139130
140131
141- # confirm pod promoted - PromotionStatus : promoted
142- Get-Pfa2Pod - Array $FlashArray - Name $TargetPodName
143-
144-
145-
146- # set node name on remote array
147- $NodeSameArray2 = " NodeOnRemoteArray"
132+ # Confirm pod promoted - PromotionStatus : promoted
133+ Get-Pfa2Pod - Array $TargetFlashArray - Name $TargetPodName
148134
149135
150136
151- # move clustered role to node on target array
152- Move-ClusterGroup - Cluster $ClusterName - Name $ClusterRole - Node $NodeSameArray2
137+ # Move clustered role to node on the target array
138+ Move-ClusterGroup - Cluster $ClusterName - Name $ClusterRole - Node $NodeRemoteArray
153139
154140
155141
156- # start the clustered role
142+ # Start the clustered role
157143Start-ClusterGroup - Cluster $ClusterName - Name $ClusterRole
158144
159145
0 commit comments