Skip to content

Commit 1ec9439

Browse files
authored
Update managed-instance-disaster-recovery.md
updated to add direct mode. ------- cc: @dnethi
1 parent fc371f7 commit 1ec9439

File tree

1 file changed

+108
-13
lines changed

1 file changed

+108
-13
lines changed

articles/azure-arc/data/managed-instance-disaster-recovery.md

Lines changed: 108 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ms.custom: event-tier1-build-2022
88
author: dnethi
99
ms.author: dinethi
1010
ms.reviewer: mikeray
11-
ms.date: 06/13/2022
11+
ms.date: 04/04/2023
1212
ms.topic: conceptual
1313
---
1414

@@ -24,18 +24,45 @@ Azure failover groups use the same distributed availability groups technology th
2424
> - The Azure Arc-enabled SQL Managed Instance in both geo-primary and geo-secondary sites need to be identical in terms of their compute & capacity, as well as service tiers they are deployed in.
2525
> - Distributed availability groups can be setup for either General Purpose or Business Critical service tiers.
2626
27-
To configure an Azure failover group:
27+
## Prerequisites
2828

29+
The following prerequisites must be met before setting up Azure Failover groups between two Arc enabled SQL managed instances:
30+
1. An Azure Arc data controller and an Arc enabled SQL managed instance provisioned at the primary site with `--license-type` as one of ` BasePrice` or `LicenseIncluded`.
31+
2. An Azure Arc data controller and an Arc enabled SQL managed instance provisioned at the secondary site with identical configuration as the primary in terms of CPU, memory, storage, Service tier etc. AND `--license-type` as `DisasterRecovery`
32+
33+
34+
## Deployment process
35+
Setting up Azure failover group between two Arc enabled SQL managed instances involves the following steps:
2936
1. Create custom resource for distributed availability group at the primary site
3037
1. Create custom resource for distributed availability group at the secondary site
31-
1. Copy the binary data from the mirroring certificates
38+
1. Copy the binary data from the mirroring certificates
3239
1. Set up the distributed availability group between the primary and secondary sites
40+
either in `sync` mode or `async` mode
3341

3442
The following image shows a properly configured distributed availability group:
3543

3644
![A properly configured distributed availability group](.\media\business-continuity\dag.png)
3745

38-
### Configure Azure failover group
46+
## Synchronization modes
47+
Failover groups in Arc data services supports two synchronization modes - `sync` and `async` and directly impacts how the data is synchronized between the Arc enabled SQL managed instances, and potentially the performance on the primary Arc SQL managed instance.
48+
49+
If primary and secondary sites are within a few miles of each other, `sync` mode could be configured. Otherwise `async` is recommended to avoid any performance impact on the Arc SQL managed instance at the primary site.
50+
51+
52+
## Configure Azure failover group - direct mode
53+
Follow the steps below if the Arc data services was deployed in `directly` connected mode.
54+
Once the prerequisites are met, run the below command to setup Azure failover group between the two Arc enabled SQL managed instances:
55+
56+
```azurecli
57+
az sql instance-failover-group-arc create --name sql-fog --mi sql1 --partner-mi sql2 --resource-group rg-name --partner-resource-group rg-name
58+
```
59+
60+
The above command will create the required custom resources on both primary and secondary sites, and copy the mirroring certificates and configures the failover group between the instances.
61+
62+
63+
## Configure Azure failover group - Indirect mode
64+
65+
Follow the steps below if the Arc data services was deployed in `indirectly` connected mode.
3966

4067
1. Provision the managed instance in the primary site.
4168

@@ -115,9 +142,54 @@ The following image shows a properly configured distributed availability group:
115142
az sql instance-failover-group-arc create --shared-name myfog --name secondarycr --mi sqlinstance2 --role secondary --partner-mi sqlinstance1 --partner-mirroring-url tcp://10.10.5.20:970 --partner-mirroring-cert-file $HOME/sqlcerts/sqlinstance1.pem --k8s-namespace my-namespace --use-k8s
116143
```
117144
118-
## Manual failover from primary to secondary instance
145+
## Retrieve Azure failover group health state
146+
147+
Information about the failover group such as primary role, secondary role, and the current health status can be viewed on the custom resource on either primary or secondary site.
148+
149+
Run the below command on primary and/or the secondary site to list the failover groups custom resource:
150+
151+
```azurecli
152+
kubectl get fog -n <namespace>
153+
```
154+
155+
Describe the custom resource to retrieve the failover group status, as follows:
156+
157+
```azurecli
158+
kubectl describe fog <fog cr name> -n <namespace>
159+
```
160+
161+
## Failover group operations
162+
163+
Once the failover groups is setup between two Arc enabled SQL managed instances, different failover operations can be performed depending on the circumstances.
164+
165+
Possible failover scenarios are:
166+
1. The Arc SQL managed instances at both sites are in healthy state and a failover needs to be performed:
167+
+ perform a manual failover from primary to secondary without data loss by setting `role=secondary` on the primary SQL MI.
168+
169+
2. Primary site is unhealthy/unreachable and a failover needs to be performed:
170+
171+
+ the primary Arc SQL managed instance is down/unhealthy/unreachable
172+
+ the secondary Arc SQL managed instance needs to be force-promoted to primary with potential data loss
173+
+ when the original primary Arc SQL managed instance comes back online, it will report as `Primary` role and unhealthy state and needs to be forced into a `secondary` role so it can join the failover group and data can be synchronized.
174+
175+
176+
## Manual failover (without data loss)
177+
178+
Use `az sql instance-failover-group-arc update ...` command group to initiate a failover from primary to secondary. Any pending transactions on the geo-primary instance are replicated over to the geo-secondary instance before the failover.
119179

120-
Use `az sql instance-failover-group-arc ...` to initiate a failover from primary to secondary. The following command initiates a failover from the primary instance to the secondary instance. Any pending transactions on the geo-primary instance are replicated over to the geo-secondary instance before the failover.
180+
### Directly connected mode
181+
Run the following command to initiate a manual failover, in `direct` connected mode using ARM APIs:
182+
183+
```azurecli
184+
az sql instance-failover-group-arc update --name <shared name of DAG> --mi <primary Arc SQL MI> --role secondary --resource-group <resource group>
185+
```
186+
Example:
187+
188+
```azurecli
189+
az sql instance-failover-group-arc update --name myfog --mi sqlmi1 --role secondary --resource-group myresourcegroup
190+
```
191+
### Indirectly connected mode
192+
Run the following command to initiate a manual failover, in `indirect` connected mode using kubernetes APIs:
121193

122194
```azurecli
123195
az sql instance-failover-group-arc update --name <name of DAG resource> --role secondary --k8s-namespace <namespace> --use-k8s
@@ -129,21 +201,44 @@ Example:
129201
az sql instance-failover-group-arc update --name myfog --role secondary --k8s-namespace my-namespace --use-k8s
130202
```
131203

132-
## Forced failover
204+
## Forced failover with data loss
133205

134206
In the circumstance when the geo-primary instance becomes unavailable, the following commands can be run on the geo-secondary DR instance to promote to primary with a forced failover incurring potential data loss.
135207

136-
Run the below command on geo-primary, if available:
208+
On the geo-secondary DR instance, run the following command to promote it to primary role, with data loss.
209+
210+
> [!NOTE]
211+
> If the `--partner-sync-mode` was configured as `sync`, it needs to be reset to `async` when the secondary is promoted to primary.
212+
213+
### Directly connected mode
214+
```azurecli
215+
az sql instance-failover-group-arc update --name <shared name of DAG> --mi <secondary Arc SQL MI> --role force-primary-allow-data-loss --resource-group <resource group> --partner-sync-mode async
216+
```
217+
Example:
137218

138219
```azurecli
139-
az sql instance-failover-group-arc update --k8s-namespace my-namespace --name primarycr --use-k8s --role force-secondary
220+
az sql instance-failover-group-arc update --name myfog --mi sqlmi2 --role force-primary-allow-data-loss --resource-group myresourcegroup --partner-sync-mode async
140221
```
141222

142-
On the geo-secondary DR instance, run the following command to promote it to primary role, with data loss.
223+
### Indirectly connected mode
224+
```azurecli
225+
az sql instance-failover-group-arc update --k8s-namespace my-namespace --name secondarycr --use-k8s --role force-primary-allow-data-loss --partner-sync-mode async
226+
```
227+
228+
When the geo-primary Arc SQL MI instance becomes available, run the below command to bring it into the failover group and synchronize the data:
143229

230+
### Directly connected mode
144231
```azurecli
145-
az sql instance-failover-group-arc update --k8s-namespace my-namespace --name secondarycr --use-k8s --role force-primary-allow-data-loss
232+
az sql instance-failover-group-arc update --name <shared name of DAG> --mi <old primary Arc SQL MI> --role force-secondary --resource-group <resource group>
146233
```
147-
## Limitation
148234

149-
When you use [SQL Server Management Studio Object Explorer to create a database](/sql/relational-databases/databases/create-a-database#SSMSProcedure), the application returns an error. You can [create new databases with T-SQL](/sql/relational-databases/databases/create-a-database#TsqlProcedure).
235+
### Indirectly connected mode
236+
```azurecli
237+
az sql instance-failover-group-arc update --k8s-namespace my-namespace --name secondarycr --use-k8s --role force-secondary
238+
```
239+
Optionally, the `--partner-sync-mode` can be configured back to `sync` mode if desired.
240+
241+
At this point, if you plan to continue running the production workload off of the secondary site, the `--license-type` needs to be updated to either `BasePrice` or `LicenseIncluded` to initiate billing for the vcores consumed.
242+
243+
244+

0 commit comments

Comments
 (0)