Skip to content

Commit b5f7abd

Browse files
initial commit after adding scripts for ActiveDR FCI demo
1 parent 5dc790b commit b5f7abd

File tree

3 files changed

+200
-0
lines changed

3 files changed

+200
-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: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
####################################################################################################################
2+
####################################################################################################################
3+
##
4+
## ActiveDR failover testing for SQL Server Failover Cluster Instance
5+
##
6+
## Script actions: -
7+
### Perform failover of clustered SQL Server role to node on same array
8+
### Then perform failover of clustered SQL Server role to node on remote array: -
9+
###### Stop clustered SQL Server role in FCI
10+
###### Demote source pod
11+
###### Promote target pod
12+
###### Move clustered role to node on target array
13+
###### Start up clustered SQL Server role
14+
##
15+
## Author - Andrew Pruski
16+
17+
##
18+
####################################################################################################################
19+
####################################################################################################################
20+
21+
22+
23+
# import powershell modules
24+
Import-Module FailoverClusters
25+
Import-Module PureStoragePowershellSDK2
26+
27+
28+
29+
####################################################################################################################
30+
#
31+
# Performing failover to node on same storage array
32+
#
33+
####################################################################################################################
34+
35+
36+
37+
# set variables
38+
$ClusterName = "WindowsClusterName"
39+
$ClusterRole = "SQL Server (MSSQLSERVER)"
40+
$NodeSameArray = "NodeOnSameArray"
41+
42+
43+
44+
# confirm cluster
45+
Get-Cluster $ClusterName
46+
47+
48+
49+
# confirm cluster nodes
50+
Get-Cluster $ClusterName | Get-ClusterNode
51+
52+
53+
54+
# confirm clustered SQL Server service
55+
Get-ClusterGroup -Cluster $ClusterName -Name $ClusterRole
56+
57+
58+
59+
# test failing over clustered service to node on same storage array
60+
Move-ClusterGroup -Cluster $ClusterName -Name $ClusterRole -Node $NodeSameArray
61+
62+
63+
64+
# confirm clustered SQL Server service
65+
Get-ClusterGroup -Cluster $ClusterName -Name $ClusterRole
66+
67+
68+
69+
################################################################################################################
70+
#
71+
# Performing failover to node on remote storage array
72+
#
73+
################################################################################################################
74+
75+
76+
77+
# set source array details
78+
$SourceFlashArrayIp = "SourceFlashArrayIpAddress"
79+
$SourcePodName = "PodNameOnSourceArray"
80+
81+
82+
83+
# set Pure credentials
84+
$PureCred = Get-Credentials
85+
86+
87+
88+
# connect to source flasharray
89+
$SourceFlashArray = Connect-Pfa2Array -EndPoint $SourceFlashArrayIp -Credential $PureCred -IgnoreCertificateError
90+
91+
92+
93+
# confirm pod replication status
94+
Get-Pfa2PodReplicaLink -Array $SourceFlashArray -LocalPodName $SourcePodName
95+
96+
97+
98+
# confirm clustered SQL Server service
99+
Get-ClusterGroup -Cluster $ClusterName -Name $ClusterRole
100+
101+
102+
103+
# stop clustered service - taking volumes offline
104+
Stop-ClusterGroup -Cluster $ClusterName -Name $ClusterRole
105+
106+
107+
108+
# confirm clustered service offline
109+
Get-ClusterGroup -Cluster $ClusterName -Name $ClusterRole
110+
111+
112+
113+
# demote Production Pod with Quiesce
114+
Update-Pfa2Pod -Array $SourceFlashArray -Name $SourcePodName -Quiesce $True -RequestedPromotionState "demoted"
115+
116+
117+
118+
# confirm Production Pod status - PromotionStatus : demoted
119+
Get-Pfa2Pod -Array $SourceFlashArray -Name $SourcePodName
120+
121+
122+
123+
# set target array details
124+
$TargetFlashArrayIp = "TargetFlashArrayIpAddress"
125+
$TargetPodName = "PodNameOnTargetArray"
126+
127+
128+
129+
# connect to target flasharray
130+
$TargetFlashArray = Connect-Pfa2Array -EndPoint $TargetFlashArrayIp -Credential $PureCred -IgnoreCertificateError
131+
132+
133+
134+
# promote pod
135+
Update-Pfa2Pod -Array $TargetFlashArray -Name $TargetPodName -RequestedPromotionState "promoted"
136+
137+
138+
139+
# confirm pod promoted - PromotionStatus : promoted
140+
Get-Pfa2Pod -Array $FlashArray -Name $TargetPodName
141+
142+
143+
144+
# set node name on remote array
145+
$NodeSameArray2 = "NodeOnRemoteArray"
146+
147+
148+
149+
# move clustered role to node on target array
150+
Move-ClusterGroup -Cluster $ClusterName -Name $ClusterRole -Node $NodeSameArray2
151+
152+
153+
154+
# start the clustered role
155+
Start-ClusterGroup -Cluster $ClusterName -Name $ClusterRole
156+
157+
158+
159+
# confirm role status
160+
Get-ClusterGroup -Cluster $ClusterName -Name $ClusterRole
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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 SQL Server Failover Clustered Instance with nodes hosted on two separate FlashArrays.
12+
13+
14+
**Prerequisites:**
15+
1. Windows Cluster needs to be created, with four nodes...two on different FlashArrays
16+
2. ActiveDR pod needs to be configured to replicate between the arrays
17+
3. Volumes of the cluster hosting SQL Server databases (User and System) need to be added to the pod
18+
19+
20+
**Recording**
21+
A recording of this demo is available here: -
22+
https://youtu.be/NgeDeOs-C_Y?si=ggYBpvCjI_xYXv8-
23+
24+
25+
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!
26+
27+
These examples are provided **AS-IS** and meant to be a building block examples to be adapted to fit an individual organization's infrastructure.
28+
29+
<!-- wp:separator -->
30+
<hr class="wp-block-separator"/>
31+
<!-- /wp:separator -->
32+
33+
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.
34+
35+
<!-- wp:separator -->
36+
<hr class="wp-block-separator"/>
37+
<!-- /wp:separator -->
38+
39+
_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)