Lab Information
Add a new member in Always On availability groups
1. We will add 2 new server (DB03 & DB04) in Always On availability groups
2. DB03 locat in same subnet
3. DB04 locat in different subnet
4. In this lab, DB04 simulate the server in different location.
5. DB04 can use 1 network for cluster and AlwaysOn Availability groups communication
6. In production environment, we can use “AlwaysOn Distributed Availability Groups” instead of “AlwaysOn Availability Groups”
Perparation
1. Change Service Account’s PrincipalsAllowedToRetrieveManagedPassword
a. Create a Security Group named “CDB”
b. Add DB01, DB02, DB03 & DB04 to CDB groups
c. Restart DB01~04 to apply membership information
d. Verify the membership information
I. Open “Command Prompt” with administrative privileges and run “gpresult /v”
II. We will find “cdb” under “The computer is a part of the following security groups”
e. Change Service Account setting
2. Install “gMSA-CDB” to DB03, DB04 — Group managed service accounts
3. Install MSSQL in DB01 & DB02 — Building MS SQL for Lab
4. Add Group managed service account (gMSA-CDB) to local administrators group in DB03 & DB04
5. Add Group managed service account (gMSA-CDB) to Logins and grant it “Connect SQL” permission
6. In “Server Configuration”, we enter group managed service accounts (joechoice\gMSA-CDB$) in “SQL Server Agent” & “SQL Servicer Database Engine” service
7. In “Local Security Policy”, we need to grant Group managed service account (gMSA-CDB) the following permission: “Log on as a service“, “Replace a process-level token“, “Bypass traverse checking” & “Adjust memory quotas for a process”
8. In “AD01”, we use the following command to register SPN
9. Install “Failover Clustering” feature on DB03 & DB04
10. Verify Cluster hardware and settings of DB03 & DB04
11. Add DB03 & DB04 in to failover cluster “CDB.joeschoice.com”
12. “Enable AlwaysOn High Availability Groups” and restart on DB03 & DB04
13. Open Firewall on DB03 & DB04
a. Open Port 1433 and 7022
b. Open “Windows Management Instrumentation (DCOM-In)” and “Windows Management Instrumentation (WMI-In)“
Add a new member in Always On availability groups in same subnet (DB03)
1. Create the Availability Group endpoint on DB03
2. Grant group managed service account (gMSA-CDB) CONNECT permissions to the endpoint
3. Create Availability Replica and add it to Availability Group
4. Joins secondary replica on DB03 to AG1
5. Grant create database permission on availability group to DB03
6. Full Backup database “AlwaysOn1” to shared folder
7. Create Database AlwaysOn1 on DB03
8. Backup transcation log on DB01
9. Restore transaction log on DB03
10. Join database (AlwaysOn1) on DB03 to the availability group
Add a new member in Always On availability groups in different subnet (DB04)
1. Create the Availability Group endpoint on DB04
2. Grant group managed service account (gMSA-CDB) CONNECT permissions to the endpoint
3. Create Availability Replica and add it to Availability Group
a. Before SQL Server 2019 (15.x), the maximum number of synchronous replicas is 3.
b. This replica is forth replica, we need to change AVAILABILITY_MODE from “SYNCHRONOUS_COMMIT” to “ASYNCHRONOUS_COMMIT” and change FAILOVER_MODE from “AUTOMATIC” to “MANUAL”
4. Add new subnet to Availability Listener
a. Since DB04 is in different subnet, we need to add this subnet to availability listener
5. Joins secondary replica on DB04 to AG1
6. Grant create database permission on availability group to DB04
7. Full Backup database “AlwaysOn1” to shared folder
8. Create Database AlwaysOn1 on DB04
9. Backup transcation log on DB01
10. Restore transaction log on DB04
11. Join database (AlwaysOn1) on DB04 to the availability group