Distributed Availability Groups
1. It is an availability group of availability groups
2. It is used for 2 availability groups to communicate
3. It does not has availability listener
4. Underlying availability groups must have a listener
5. After failover, we need to change our DNS or application connection to the secondary availability group
Lab Information
Reference Links
1. Create Failover Cluster
2. Create Group Managed Service Accounts
3. Create Always On Availability Group
Perpare for Distributed Availability Groups
1. Create 2 Group Managed Service Account, add to local adminstrators group, add to Logins and grant “Connect SQL” permission to them
a. First GMSA names gMSA1 for DB01 & DB02
b. Second GMSA names gMSA2 for DB03 & DB04
2. Create 2 failover cluster
a. First names CDB1 with 2 nodes (DB01, DB02)
b. Second names CDB2 with 2 nodes (DB02, DB04)
3. In “AD01”, we use the following command to register SPN
[script]
setspn -s MSSQLSvc/db01.joeschoice.com joeschoice\gMSA1$
setspn -s MSSQLSvc/db01.joeschoice.com:1433 joeschoice\gMSA1$
setspn -s MSSQLSvc/db02.joeschoice.com joeschoice\gMSA1$
setspn -s MSSQLSvc/db02.joeschoice.com:1433 joeschoice\gMSA1$
setspn -s MSSQLSvc/db03.joeschoice.com joeschoice\gMSA2$
setspn -s MSSQLSvc/db03.joeschoice.com:1433 joeschoice\gMSA2$
setspn -s MSSQLSvc/db04.joeschoice.com joeschoice\gMSA2$
setspn -s MSSQLSvc/db04.joeschoice.com:1433 joeschoice\gMSA2$
# SPN for Always On availability group listener
setspn -s MSSQLSvc/AG1.joeschoice.com:1433 joeschoice\gMSA1$
setspn -s MSSQLSvc/AG2.joeschoice.com:1433 joeschoice\gMSA2$
[/script]
4. Enable SQLCMD mode in SSMS
a. If we does not enable SQLCMD mode, we will not allow to run “:CONNECT” cmd
b. Open “SSMS”, select “Tools” > “Options”
c. In “Options” box, select “Query Execution” > “SQL Server” > General”
d. Click “By default, open new queries in SQLCMD mode” > Click “OK”
5. Create Database in DB01
6. Take a Full backup of AlwaysOn1
a. Create shared folder on AD01
b. Grant read/write permission to gMSA1$, gMSA2$ & mssql-admin on shared folder
7. “Enable AlwaysOn High Availability Groups” and restart on DB01, DB02, DB03 and DB04
8. On DB01, DB02, DB03 and DB04, add gMSA1 and gMSA2 to Logins and grant it “Connect SQL” permission
Create Distributed Availability Groups
1. Create Frist AlwaysOn Availability Group on DB01 & DB02
a. Create endpoint which listen all IP
b. Grant group managed service account (gMSA1$ and gMSA2$) CONNECT permissions to the endpoint
c. Create availability group with replica
d. Joins secondary replica on DB02 to AG1 and Grant create database permission on availability group to DB02
e. Create Availability group listener (AG1L)
2. Create Second Availability Group on DB03 & DB04
a. Create endpoint which listen all IP
b. Grant group managed service account (gMSA2$) CONNECT permissions to the endpoint
c. Create availability group with replica
d. Joins secondary replica on DB04 to AG2 and Grant create database permission on availability group to DB04
e. Create Availability group listener (AG2L)
3. Create Distributed Availability Group on first availability group on DB01
a. URL in the LISTENER_URL is the Listener URL of AG1 and AG2
b. Port in the LISTENER_URL is the Port of AG1’s and AG2’s endpoint
4. Join Distributed Availability Group to second availability group on DB03