Skip to content

Commit b97bcb9

Browse files
Merge pull request #11 from PureStorage-OpenConnect/apruski
Merging PR
2 parents c14cd79 + f959193 commit b97bcb9

File tree

3 files changed

+206
-0
lines changed

3 files changed

+206
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ Array-based snapshots are used to decouple database operations from the size of
5252
| ----------- | ----------- | ----------- | ----------- |
5353
| **Database Test Failover** | Perform a test failover of a database between two FlashArrays using ActiveDR | [More Info](./demos-sdk2/ActiveDR/) | [Sample Code](./demos-sdk2/ActiveDR/ActiveDR%20Failover%20Test.ps1) |
5454
| **Database Full Failover** | Perform a test failover and failback of a database between two FlashArrays using ActiveDR | [More Info](./demos-sdk2/ActiveDR/) | [Sample Code](./demos-sdk2/ActiveDR/ActiveDR%20Full%20Failover.ps1) |
55+
| **SQL Server FCI + ActiveDR** | Perform a test failover and failback of a SQL Server Failover Cluster Instance between two FlashArrays using ActiveDR | [More Info](./demos-sdk2/ActiveDR/SQL%Server%FCI%+%ActiveDR) | [Sample Code](./demos-sdk2/ActiveDR/SQL%Server%FCI%+%ActiveDR/ActiveDR-FCI-Testing.ps1) |
5556

5657

5758
**Examples from the previous PowerShell SDK repository are available in this repository's [demos-archive](./demos-archive/) folder.**
Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
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+
19+
##
20+
####################################################################################################################
21+
####################################################################################################################
22+
23+
24+
25+
# import powershell modules
26+
Import-Module FailoverClusters
27+
Import-Module PureStoragePowershellSDK2
28+
29+
30+
31+
####################################################################################################################
32+
#
33+
# Performing failover to node on same storage array
34+
#
35+
####################################################################################################################
36+
37+
38+
39+
# set variables
40+
$ClusterName = "WindowsClusterName"
41+
$ClusterRole = "SQL Server (MSSQLSERVER)"
42+
$NodeSameArray = "NodeOnSameArray"
43+
44+
45+
46+
# confirm cluster
47+
Get-Cluster $ClusterName
48+
49+
50+
51+
# confirm cluster nodes
52+
Get-Cluster $ClusterName | Get-ClusterNode
53+
54+
55+
56+
# confirm clustered SQL Server service
57+
Get-ClusterGroup -Cluster $ClusterName -Name $ClusterRole
58+
59+
60+
61+
# test failing over clustered service to node on same storage array
62+
Move-ClusterGroup -Cluster $ClusterName -Name $ClusterRole -Node $NodeSameArray
63+
64+
65+
66+
# confirm clustered SQL Server service
67+
Get-ClusterGroup -Cluster $ClusterName -Name $ClusterRole
68+
69+
70+
71+
################################################################################################################
72+
#
73+
# Performing failover to node on remote storage array
74+
#
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-Credentials
87+
88+
89+
90+
# connect to source flasharray
91+
$SourceFlashArray = Connect-Pfa2Array -EndPoint $SourceFlashArrayIp -Credential $PureCred -IgnoreCertificateError
92+
93+
94+
95+
# confirm pod replication status
96+
Get-Pfa2PodReplicaLink -Array $SourceFlashArray -LocalPodName $SourcePodName
97+
98+
99+
100+
# confirm clustered SQL Server service
101+
Get-ClusterGroup -Cluster $ClusterName -Name $ClusterRole
102+
103+
104+
105+
# stop clustered service - taking volumes offline
106+
Stop-ClusterGroup -Cluster $ClusterName -Name $ClusterRole
107+
108+
109+
110+
# confirm clustered service offline
111+
Get-ClusterGroup -Cluster $ClusterName -Name $ClusterRole
112+
113+
114+
115+
# demote Production Pod with Quiesce
116+
Update-Pfa2Pod -Array $SourceFlashArray -Name $SourcePodName -Quiesce $True -RequestedPromotionState "demoted"
117+
118+
119+
120+
# confirm Production Pod status - PromotionStatus : demoted
121+
Get-Pfa2Pod -Array $SourceFlashArray -Name $SourcePodName
122+
123+
124+
125+
# set target array details
126+
$TargetFlashArrayIp = "TargetFlashArrayIpAddress"
127+
$TargetPodName = "PodNameOnTargetArray"
128+
129+
130+
131+
# connect to target flasharray
132+
$TargetFlashArray = Connect-Pfa2Array -EndPoint $TargetFlashArrayIp -Credential $PureCred -IgnoreCertificateError
133+
134+
135+
136+
# promote pod
137+
Update-Pfa2Pod -Array $TargetFlashArray -Name $TargetPodName -RequestedPromotionState "promoted"
138+
139+
140+
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"
148+
149+
150+
151+
# move clustered role to node on target array
152+
Move-ClusterGroup -Cluster $ClusterName -Name $ClusterRole -Node $NodeSameArray2
153+
154+
155+
156+
# start the clustered role
157+
Start-ClusterGroup -Cluster $ClusterName -Name $ClusterRole
158+
159+
160+
161+
# confirm role status
162+
Get-ClusterGroup -Cluster $ClusterName -Name $ClusterRole
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<p align="center"></p>
2+
3+
# SQL Server Failover Cluster Instance and ActiveDR
4+
5+
**Files:**
6+
- ActiveDR-FCI-Testing.ps1
7+
8+
9+
**Scenario:**
10+
11+
Testing failover of a 4 node SQL Server Failover Clustered Instance with nodes hosted on two separate FlashArrays.
12+
Failover between nodes on the same cluster will provide high availabiliy and failover between nodes on separate arrays provides disaster recovery.
13+
14+
This demo script runs through two scenarios: -
15+
1. Failover of the failover cluster instance between nodes on the same array (no ActiveDR involvement)
16+
2. Failover of the cluster instance between nodes on separate arrays (requiring ActiveDR involvement)
17+
18+
**Prerequisites:**
19+
1. Windows Cluster needs to be created, with four nodes...two on different FlashArrays
20+
2. ActiveDR pod needs to be configured to replicate between the arrays
21+
3. Volumes of the cluster hosting SQL Server databases (User and System) need to be added to the pod
22+
23+
24+
**Recording**
25+
A recording of this demo is available here: -
26+
https://youtu.be/NgeDeOs-C_Y?si=ggYBpvCjI_xYXv8-
27+
28+
29+
These scripts are meant to be run in chunks. Each Part represents an independent workflow in the greater context of a DR manual failover and manual failback. DO NOT run everything at once!
30+
31+
These examples are provided **AS-IS** and meant to be a building block examples to be adapted to fit an individual organization's infrastructure.
32+
33+
<!-- wp:separator -->
34+
<hr class="wp-block-separator"/>
35+
<!-- /wp:separator -->
36+
37+
We encourage the modification and expansion of these scripts by the community. Although not necessary, please issue a Pull Request (PR) if you wish to request merging your modified code in to this repository.
38+
39+
<!-- wp:separator -->
40+
<hr class="wp-block-separator"/>
41+
<!-- /wp:separator -->
42+
43+
_The contents of the repository are intended as examples only and should be modified to work in your individual environments. No script examples should be used in a production environment without fully testing them in a development or lab environment. There are no expressed or implied warranties or liability for the use of these example scripts and templates presented by Pure Storage and/or their creators._

0 commit comments

Comments
 (0)