You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/database-engine/availability-groups/windows/configure-distributed-availability-groups.md
+32-23Lines changed: 32 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
title: "Configure distributed Availability Groups (Always On Availability Groups) | Microsoft Docs"
2
+
title: "Configure distributed availability group (Always On Availability Group) | Microsoft Docs"
3
3
ms.custom: ""
4
4
ms.date: "07/12/2017"
5
5
ms.prod: "sql-server-2016"
@@ -18,15 +18,17 @@ manager: "jhubbard"
18
18
19
19
# Configure distributed availability group
20
20
21
-
To create a distributed availability group, you must create an availability group and listener on each WSFC. You then combine these into a distributed availability group. The following steps provide a basic example in Transact-SQL. This example does not cover all of the details of creating availability groups and listeners; instead, it focuses on highlighting the key requirements.
21
+
To create a distributed availability group, you must create an availability group and listener on each Windows Server Failover Cluster (WSFC). You then combine these into a distributed availability group. The following steps provide a basic example in Transact-SQL. This example does not cover all of the details of creating availability groups and listeners; instead, it focuses on highlighting the key requirements.
22
22
23
-
For a technical overview of distributed availability groups, see [Distributed Availability Groups](distributed-availability-groups.md).
23
+
For a technical overview of distributed availability groups, see [Distributed availability groups](distributed-availability-groups.md).
24
24
25
-
## Set the endpoint listeners to listen to all IP addresses
25
+
## Prerequisites
26
26
27
-
On each server that will host a replica in the distributed availability group, configure the listener to `LISTENER_IP = ALL`. The listeners on each server cannot listen to a specific IP address because the endpoint listener must listen to traffic coming over the server IP address as well as the listener IP address.
27
+
### Set the endpoint listeners to listen to all IP addresses
28
28
29
-
### Create a listener to listen to all IP addresses
29
+
Make sure the endpoints can communicate between the different availability groups in the distributed availability group. If one availability group is set to a specific network on the endpoint, the distributed AG will not work properly. On each server that will host a replica in the distributed availability group, configure the listener to `LISTENER_IP = ALL`.
30
+
31
+
#### Create a listener to listen to all IP addresses
30
32
31
33
For example, the following script creates a listener endpoint on TCP port 5022 that listens on all IP addresses.
32
34
@@ -42,7 +44,7 @@ FOR DATA_MIRRORING (
42
44
GO
43
45
```
44
46
45
-
### Alter a listener to listen to all IP addresses
47
+
####Alter a listener to listen to all IP addresses
46
48
47
49
For example, the following script changes a listener endpoint to listen on all IP addresses.
48
50
@@ -52,8 +54,9 @@ ALTER ENDPOINT [aodns-hadr]
52
54
GO
53
55
```
54
56
57
+
## Create first availability group
55
58
56
-
## Create the primary availability group on the first cluster
59
+
###Create the primary availability group on the first cluster
57
60
Create an availability group on the first WSFC. In this example, the availability group is named `ag1` for the database `db1`.
58
61
59
62
```tsql
@@ -77,7 +80,7 @@ GO
77
80
78
81
Note that this example uses direct seeding, where **SEEDING_MODE** is set to **AUTOMATIC** for both the replicas and the distributed availability group. This means that once established, the secondary replicas and secondary availability group will be automatically populated without requiring a manual backup and restore of primary database.
79
82
80
-
## Join the secondary replicas to the primary availability group
83
+
###Join the secondary replicas to the primary availability group
81
84
Any secondary replicas must be joined to the availability group with **ALTER AVAILABILITY GROUP** with the **JOIN** option. Because direct seeding is used in this example, you must also call **ALTER AVAILABILITY GROUP** with the **GRANT CREATE ANY DATABASE** option. This allows the availability group to create the database and begin seeding it automatically from the primary replica.
82
85
83
86
In this example, the following commands are run on the secondary replica, `server2`, to join the `ag1` availability group. The availability group is then permitted to create databases on the secondary.
@@ -88,7 +91,7 @@ ALTER AVAILABILITY GROUP [ag1] GRANT CREATE ANY DATABASE
88
91
GO
89
92
```
90
93
91
-
## Create a listener for the primary availability group
94
+
###Create a listener for the primary availability group
92
95
93
96
Next add a listener for the primary availability group on the first WSFC. In this example, the listener is named `ag1-listener`. For detailed instructions on creating a listener, see [Create or Configure an Availability Group Listener (SQL Server)](../../../database-engine/availability-groups/windows/create-or-configure-an-availability-group-listener-sql-server.md).
94
97
@@ -98,7 +101,8 @@ ALTER AVAILABILITY GROUP [ag1]
98
101
GO
99
102
```
100
103
101
-
## Create the secondary availability group on the second cluster
104
+
105
+
## Create second availability group
102
106
Then on the second WSFC, create a second availability group, `ag2`. In this case, the database is not specified, because it will be automatically seeded from the primary availability group.
103
107
104
108
```tsql
@@ -122,7 +126,7 @@ GO
122
126
> [!NOTE]
123
127
> Note that the secondary availability group must use the same database mirroring endpoint (in this example port 5022). Otherwise, replication will stop after a local failover.
124
128
125
-
## Join the secondary replicas to the secondary availability group
129
+
###Join the secondary replicas to the secondary availability group
126
130
In this example, the following commands are run on the secondary replica, `server4`, to join the `ag2` availability group. The availability group is then permitted to create databases on the secondary to support direct seeding.
127
131
128
132
```tsql
@@ -131,7 +135,7 @@ ALTER AVAILABILITY GROUP [ag2] GRANT CREATE ANY DATABASE
131
135
GO
132
136
```
133
137
134
-
## Create a listener for the secondary availability group
138
+
###Create a listener for the secondary availability group
135
139
Next add a listener for the secondary availability group on the second WSFC. In this example, the listener is named `ag2-listener`. For detailed instructions on creating a listener, see [Create or Configure an Availability Group Listener (SQL Server)](../../../database-engine/availability-groups/windows/create-or-configure-an-availability-group-listener-sql-server.md).
136
140
137
141
```
@@ -140,7 +144,7 @@ ALTER AVAILABILITY GROUP [ag2]
140
144
GO
141
145
```
142
146
143
-
## Create the distributed availability group on the first cluster
147
+
## Create distributed availability group on first cluster
144
148
On the first WSFC, create a distributed availability group (named `distributedag` in this example). Use the **CREATE AVAILABILITY GROUP** command with the **DISTRIBUTED** option. The **AVAILABILITY GROUP ON** parameter specifies the member availability groups, `ag1` and `ag2`.
145
149
146
150
```tsql
@@ -167,7 +171,7 @@ GO
167
171
> [!NOTE]
168
172
> The **LISTENER_URL** specifies the listener for each availability group along with the database mirroring endpoint of the availability group. In this example, that is port `5022` (not port `60173` used to create the listener).
169
173
170
-
###Join the distributed availability group on the second cluster
174
+
## Join distributed availability group on second cluster
171
175
Then join the distributed availability group on the second WSFC.
172
176
173
177
```tsql
@@ -241,9 +245,10 @@ Only manual failover is supported at this time. The following Transact-SQL state
241
245
ALTER AVAILABILITY GROUP distributedag SET (ROLE = SECONDARY);
242
246
```
243
247
244
-
Note: at this point, the distributed availability group is not available.
248
+
>[NOTE!]
249
+
>At this point, the distributed availability group is not available.
245
250
246
-
1. Test the failover readiness. Run the following quey:
251
+
1. Test the failover readiness. Run the following query:
247
252
248
253
```tsql
249
254
SELECT ag.name,
@@ -262,7 +267,9 @@ Only manual failover is supported at this time. The following Transact-SQL state
262
267
```tsql
263
268
ALTER AVAILABILITY GROUP distributedag FORCE_FAILOVER_ALLOW_DATA_LOSS;
264
269
```
265
-
Note: After this step, the distributed availability group is available.
270
+
271
+
>[NOTE!]
272
+
>After this step, the distributed availability group is available.
266
273
267
274
After completing the steps above, the distributed availability group fails over without any data loss. Microsoft recommends changing the availability mode back to ASYNCHRONOUS_COMMIT if the availability groups are across a geographical distance that causes latency.
268
275
@@ -273,7 +280,7 @@ After completing the steps above, the distributed availability group fails over
273
280
DROP AVAILABILITY GROUP [distributedag]
274
281
```
275
282
276
-
## Create a Distributed Availability Group with Failover Cluster Instances
283
+
## Create distributed availability group on failover cluster instances
277
284
278
285
You can create a distributed availability group using an availability group on a failover cluster instance (FCI). In this case, you don't need an availability group listener. Use the virtual network name (VNN) for the primary replica of the FCI instance. The following example shows a distributed availability group called SQLFCIDAG. One availability group is SQLFCIAG. SQLFCIAG has 2 FCI replicas. The VNN for the primary FCI replica is SQLFCIAG-1, and the VNN for the secondary FCI replica is SQLFCIAG-2. The distributed availability group also includes SQLAG-DR, for disaster recovery.
279
286
@@ -303,11 +310,12 @@ CREATE AVAILABILITY GROUP [SQLFCIDAG]
303
310
);
304
311
```
305
312
306
-
Note that the listener URL is the VNN of the primary FCI instance.
313
+
>[NOTE!]
314
+
>The listener URL is the VNN of the primary FCI instance.
307
315
308
-
## Manually Failover FCI in Distributed Availability Group
316
+
## Manually fail over FCI in distributed availability group
309
317
310
-
To manually failover the FCI availability group, update the distributed availability group to reflect the change of listener URL. For example, run the following DDL on both the primary AG and the secondary AG of SQLFCIAG:
318
+
To manually fail over the FCI availability group, update the distributed availability group to reflect the change of listener URL. For example, run the following DDL on both the primary AG and the secondary AG of SQLFCIAG:
311
319
312
320
```tsql
313
321
ALTER AVAILABILITY GROUP [SQLFCIDAG]
@@ -318,7 +326,8 @@ ALTER AVAILABILITY GROUP [SQLFCIDAG]
318
326
)
319
327
```
320
328
321
-
## See Also
329
+
## Next steps
330
+
322
331
[CREATE AVAILABILITY GROUP (Transact-SQL)](../../../t-sql/statements/create-availability-group-transact-sql.md)
323
332
[ALTER AVAILABILITY GROUP (Transact-SQL)](../../../t-sql/statements/alter-availability-group-transact-sql.md)
0 commit comments