MS doc:
https://learn.microsoft.com/en-us/azure/azure-sql/virtual-machines/windows/availability-group-manually-configure-tutorial-single-subnet?view=azuresql
Mind Map:
Reference Notes for onprem setup:
step 1: 2 servers (part of same OU)
step 2: Activate Windows server failover clustering on both nodes
(add roles & features -> failover clustering feature)
step 3: dedicated interface for cluster comm
step 4: Use domain user accounts instead of service account for AG
step 5: Add the domain user to local admin grou[
control userpasswords2
step 6: Configure failover cluster using failover cluster manager
a.validate the cluster (select servers to be part of cluster and run checks)
b.on successful previous step, create cluster [choose nodes, assign wsfc cluster ip]
c. configure witness [configure cluster quorum settings] - choose a shared folder from AD
step 7: Launch mssql setup on node 1 (parallel do in other node as well)
a. new sql server standalone install or add feature on both nodes at same step
b. enter product key (for eval edition, no need) and click next
c. accept -> next
d. choose features to install (select db engine - mandatory)
e. set name for instance if needed else leave it to default
f. enter domain user/password , set service start to automatic for agent and db engine (browser leave it in disabled mode)
g. choose mixed mode for authentication (choose sa user)
h. allow for install to complete
step 8: Configure SQL server to function as Always on AG
a. Open config manager
b. right click on sql sever
c. choose always on ag, check "enable always on ag"
d. restart the sql server service
e. repeat this on other node
step 9: Open AD user/computer
Look for db servers - add both nodes and grant them all permissions to manage the objects[enable advanced option in view]
step 10: open ssms to setup db
a. connect to mssql node 1 sql server
b. create a new test db (set recovery model to full)
c. Secure a full backup for db (rightclick->task >full backup)
d. Go to AG -> choose new AG (give a new name)
e. select the db
f. add replica now to add the other node [choose sync commit]
g. go through the tabs
1. Choose listner tab (enter listener dns name -> port -> static ip -> Add vip)
2. choose automatic seeding
3. click next & finish
h. AG setup is complete
step 11: Perform test connection using listener
step 12: AG dashboard validation
step 13: Perform failover & failback testing
Note:
Note: In case you have (Always on AG with 2 nodes)
1) MSSQL 2017 (didnt test in later version yet)
2) you have a FW restriction between the 2 nodes of the cluster!!!
3) you restricted SQL Server to a dedicated port for TCP/IP and your sure the dynamic port of SQL Server will fail due to the FW restrictions
You attempt to perform a failover testing using your AG, you will see your "Servername" field greyed out with just the <servername>/<MSSQL instance name>
In such situation you will not be able to perform connection tests using GUI.
To work around the situation, Enable options (in GUI screen), go to "Advanced Connection Parameters"
Enter the following...
NetworkLibrary=dbmssocn;Server=<servername>\<named instance>,<nondefault port>
This should help you connect, you can generate script from here to perform failover using commands next time.
Thanks
.png)
No comments:
Post a Comment