How to Configure Microsoft SQL Always On Databases using Windows 2019 and SQL Server 2019

This is a post that describes how to configure Microsoft SQL Always on databases.  We will be using SQL Server 2019 standard edition so this only gives you a read-only copy of your replica.  However this is perfect for uses such a Remote Desktop Farm where we just need a standby database to failover to.

First we need to add Windows Failover Cluster (WSFC) to each replica

On each replica, open Server Manager > click Add Roles & Features > select Add Failover Clustering > click Install. Proceed through the wizard, and when you get to the Select Features page, select the Failover Clustering checkbox.

If you do not already have .NET Framework 3.5.1 or greater installed on your server, select that checkbox as well to install. (If you do need to install the .NET Framework, you will need to reboot the server after installing).

Proceed next through the wizard and click Install to finish the wizard. You will need to do this on every replica in your AG.

Open the Add Roles and Features Wizard and add the Failover Clustering Role

How to Configure Microsoft SQL Always On Databases-2

How to Configure Microsoft SQL Always On Databases-3

How to Configure Microsoft SQL Always On Databases-4

Now we need to configure WSFC on primary replica

From Administrative Tools, open Failover Cluster Manager and click on Validate Configuration

How to Configure Microsoft SQL Always On Databases-5

Add the names of all the SQL Servers you want to configure as replicas in your AlwaysOn group

How to Configure Microsoft SQL Always On Databases-6

 

On the Testing Options page, click Run all tests (recommended). It is normal to see some warning messages. Make sure to review the warnings and correct anything necessary.

How to Configure Microsoft SQL Always On Databases-7

How to Configure Microsoft SQL Always On Databases-8

If you are using ESXi you will probably get the warning about using a single NIC.  This is fine as the test doesn’t see the multiple NICs you have running on your hypervisor.

How to Configure Microsoft SQL Always On Databases-9

After the validation and summary is complete, the Create Cluster Wizard will open. In the Access Point for Administering the Cluster dialog box, enter the virtual cluster name (not the server or instance name), and the virtual IP address of your cluster.  For this I just used an available IP in the same subnet as the primary SQL node.

How to Configure Microsoft SQL Always On Databases-10

Click Next

How to Configure Microsoft SQL Always On Databases-11

The cluster is created

How to Configure Microsoft SQL Always On Databases-13

You should get a success confirmation

How to Configure Microsoft SQL Always On Databases-14

Proceed next through the wizard, and your cluster will be created. The secondary nodes will be added to the cluster, and your cluster should now show up on all replicas (through Failover Cluster Manager). You do not have to go through these steps on the other replicas…you’re all done with setting up the cluster.

How to Configure Microsoft SQL Always On Databases-15

Next on the OU where the cluster AD account resides setup the following permissions.

Create Computer Objects

How to Configure Microsoft SQL Always On Databases-39

Read/Write all properties

How to Configure Microsoft SQL Always On Databases-40

How to Configure Microsoft SQL Always On Databases-41

We now need to configure a file share witness

Create a file share on a file server and add your cluster (computer) account with full control to the share

How to Configure Microsoft SQL Always On Databases-21

Right click on the cluster and click More Actions then Configure Cluster Quorum Settings

How to Configure Microsoft SQL Always On Databases-16

Click Select the quorum witness and click Next

How to Configure Microsoft SQL Always On Databases-17

Select Configure a file share witness and click Next

How to Configure Microsoft SQL Always On Databases-18

Enter the network path to your file share location and click Next

How to Configure Microsoft SQL Always On Databases-19

Confirm and click Next

How to Configure Microsoft SQL Always On Databases-20

Click Next

How to Configure Microsoft SQL Always On Databases-22

Open the SQL Server Configuration Manager on the primary node.   Find the SQL Server Service and go to Properties How to Configure Microsoft SQL Always On Databases-23

Check the box for Enable Always On Availability Groups

How to Configure Microsoft SQL Always On Databases-24

Login to SQL Management Studio and select the database you want to be Always On.  Set the Recovery Model to Full.  Then Take a full backup of the database.

How to Configure Microsoft SQL Always On Databases-25

Open the New Availability Group Wizard

How to Configure Microsoft SQL Always On Databases-38

Give your Availability Group a name and select Windows Server Failover Custer

How to Configure Microsoft SQL Always On Databases-28

Select the database you want to be Always On (I am choosing an RDS DB)

How to Configure Microsoft SQL Always On Databases-26

Select the replica sever, it will then ask you to login

How to Configure Microsoft SQL Always On Databases-29

Specify the replica servers

How to Configure Microsoft SQL Always On Databases-30

You will need to click the Listeners tab and create a listener.  I needed a listener so that I could create a connection string to the availability group for a Remote Desktop Farm.  I used two new IPs for this one for the subnet of Server 1 in the cluster and one for the subnet of Server 2

How to Configure Microsoft SQL Always On Databases-37

Create two DNS A records with your listener IPs and the name of your Availability Group.  This will ensure a DNS round robin of both nodes in the cluster.

How to Configure Microsoft SQL Always On Databases-36

Select Automatic Seeding and click Next

How to Configure Microsoft SQL Always On Databases-31

Run the validation checks

How to Configure Microsoft SQL Always On Databases-32

Check the Summary

How to Configure Microsoft SQL Always On Databases-33

Check the results are successful

How to Configure Microsoft SQL Always On Databases-34

The Always On Cluster is complete

Troubleshooting

Check the failover cluster manager and look at the Role properties.  Both Servers should be checked:

How to Configure Microsoft SQL Always On Databases-98

In SQL Management Studio check the Always On Dashboard

How to Configure Microsoft SQL Always On Databases-99

It should not show any issues as below, if it does your cluster can’t failover

How to Configure Microsoft SQL Always On Databases-100

Check that you have Synchronous commit set for both servers in the Availability Group properties and that Failover Mode is Automatic.

How to Configure Microsoft SQL Always On Databases-101

Ensure that the in the Availability Database that the database is not paused. If it is resume.

How to Configure Microsoft SQL Always On Databases-102

Leave a Reply

Your email address will not be published. Required fields are marked *