MS SQL DR Readiness - Secondary Sales

Download as pdf or txt
Download as pdf or txt
You are on page 1of 59

Configuring a SQL Server AlwaysOn High Availability

Group

Enable Domain Controller and Active Directory in a virtual machine for SQL
Server Always On Availability Groups
Before we enable these features and roles, we need the following requirement:

● Domain Controller (Active Directory with DNS enabled): A domain controller servers all
security authentication requests for a Windows Server domain. In an organization, each
server is a member of the domain controller. We use an FQDN [ServerName].[Domain] to
connect with the server.Windows server 2019 AD with DNS setup (example.com in our case)
● Windows server 2019 with AD with witness share : Need to build one witness share
server to hold the windows clustering components .
● Primary SQL DB node
● Secondary SQL DB node

The VM named VDITest3 for the configuration of active directory (AD) and domain. Connect to the
Virtual machine for the domain controller and Active Directory configuration. Launch the server
manager -> dashboard.
Click on the Add Roles and Features. It opens the wizard with brief information. We can skip this
step.

In the next step, Select option Role-based or feature-based installation and click Next.
It shows the VM name, IP address and operating system in the destination server. You can verify the
server name before continuing with the installation.
In the server roles, enable the Active Directory Domain Services. It opens a pop-up window with
its dependency features or services. Click on Add features to install all dependencies.
Similarly, enable the DNS server as well.
Click Next, and you get an introduction page for the active directory. You can go through the
information provided to gain a basic understanding.
Similarly, you get an introduction to the DNS services as well.
In the next step, review all features and roles of installations. You should not install unnecessary
services, features, roles on a server as a best practice.

Some roles and features require a reboot of the server. Therefore I put a check on the Restart the
destination server automatically if required.

In case, you add a role or feature to an existing server, and I would recommend you reboot manually.
It starts the installation of the specified roles and features.
We can see that the features installation is completed.
In the server roles, we get a warning message, and it asks us to promote the server as a domain
controller because we installed a Domain controller feature on this server. Click on the message-
Promote this server as a domain controller.

It opens an active directory services configuration wizard, as shown below. In this deployment
configuration, select Add a new forest and specify the root domain name. Specify the root domain
as MyDemoSQL.com
Click Next. We can go with the default options for the forest functional level and functional domain
level. Specify the domain admin password. You should store this password in a safe and secure
place.
In the DNS option, skip the configuration and move towards the next page.
It shows the NetBIOS domain name. It is the domain name without .com suffix.
By default, it installs the AD database log file in the Windows directory of the root drive. We can
go-ahead for the C drive for the demo purpose.
Review your configurations and Click Next to begin active directory configuration.
First, it does the prerequisite check. We can ignore the warning messages here.
It performs the reboot of the VM.
After reboot, you can verify that the computer is part of the MyDemoSQL.com domain. At this point,
we have only one VM configured with the domain.
Network configuration for the Static IP and DNS Server

We require a static IP for the domain controller VM along with the SQL Server Always On Availability
Groups. Type ipconfig and it returns the following output.

In the output, we can note the IPv4 address, subnet mask and default gateway.
To set a static IP address, navigate to the Control Panel->Network and Internet->Network
Connections. Click on the Change adapter settings.

It opens networking options. Here, click on the Internet Protocol Version 4(TCP/IPv4) and Properties.
By default, it is configured to obtain the IP address automatically. In this case, if you reboot the
server, it might get a new IP address.

Click on the Use the following IP addresses and specify the IP address as follows.

● IP address: 10.0.2.15
● Subnet mask: 255.255.255.0
● Preferred gateway – blank
● Preferred DNS server: 127.0.0.1 ( because this server itself is a DNS server)
Click OK to save the changes. You can again type ipconfig in the command prompt to validate these
settings.
Configure Reverse lookup zones in DNS for SQL Server Always
On Availability Groups
We need to configure a reverse lookup zone in the DNS. It resolves the IP address to the server
name. In the server manager dashboard, navigate to tools -> DNS.

It opens the following DNS manager with different folders.

Open the Reverse Lookup Zones folder and right-click on it to launch a new zone wizard.
In the next zone wizard, go with the default option – Primary zone.
In the next step, select the zone replication scope- To all DNS servers running on domain
controllers in the domain: MyDemoSQL.com
Select the type of lookup zone as a Reverse lookup zone.
We are using an IPv4 address range, so select the IPv4 reverse lookup zone. In case you use an
IPv6 IP range, select the other option.
In the reverse lookup zone name, we need to enter the network ID portion of the IP address. It is the
digits before the last dot. In my case, I have an IP address in the range 10.0.2.15. Therefore, the
network SID is 10.0.2
Accept the recommended method of the dynamic update as Allow only secure dynamic updates
and click Next.
Review the configuration and click Finish to create a reverse lookup zone.
It shows the following reverse lookup zone as per our configurations.
Create an active directory user and assign domain admin permissions for

SQL Server Always On availability groups

Type DSA.msc in the run, and it launches the AD containers with all users, computer service
accounts.
To create a new AD user, right-click on the container (in this case, Users) and create a new user.

Specify the first name, last name, user login name. It should be a unique login name in an OU.
On the next page, specify the password of this AD user along with configuration options. You can
specify options such as :

● User must change password at next logon


● User cannot change password
● Password never expires
● An account is disabled

For my demo purpose, I have unchecked all user password configuration.

Review and confirm the user details to create in the Users group.
In the active directory users, double click on the Domain Admins.

It opens the domain admin properties. Click on Add, search for the AD user we created and add it
here.
Add this user as an administrator in all three VM’s as well. Add this user to the local administrator of
all three VM’s. Open the computer management from the server manager -> Tools-> Computer
management.
Verify that the quorum configuration is using Node and Disk Majority - Witness: Cluster
Disk . Since all the shared disks will be used for the SQL Server failover clustered
instance, you need to configure a file share as a witness type.

Add SQLNode1 and SQLNode2 in the domain for SQL Server Always
On availability groups
In the next step, open the network properties of SQLNode1 and SQLNode2. Enter the following
values for the IP address.

SQLNode1 network configuration


● IP address: 10.0.2.21
● Subnet mask: 255.255.255.0
● Preferred gateway – blank
● Preferred DNS server: 10.0.2.15 ( it is the IP address of our DNS server)
Validate IP configurations
SQLNode2 network configuration
● IP address: 10.0.2.22
● Subnet mask: 255.255.255.0
● Preferred gateway – blank
● Preferred DNS server: 10.0.2.15 ( it is the IP address of our DNS server)
Validate IP configurations
Add SQLNode1 in the MyDemoSQL.com domain for SQL Server

Always On availability groups


In this step, we need to join the VM to the existing domain MyDemoSQL.com. To add a server into
the domain, click on the server name in the server dashboard.

It opens the system properties. Click on the change, and you can specify the computer name and its
domain.
Click on OK, and it joins the VM into the specified domain. You need to specify the domain admin
user name and password to allow it as a member in the MyDemoSQL.com domain.
You get a welcome message, as shown below, once it adds the server successfully.
It reboots the VM.

Add SQLNode2 in the MyDemoSQL.com domain


Similarly, add the SQLNode2 VM as well in the MyDemoSQL.com domain and validate it.

MS SQL AlwaysOn Availability Groups


After SQL is installed we need to enable AlwaysOn, to do that open up the SQL Configuration manager
and click on “SQL Server Services”. In the main part of the page you should see “SQL Server
(MSSQLSERVER)” right click on it and select Properties. In the properties dialog box select the
“AlwaysOn High Availability” tab. You then need to check the “Enable AlwaysOn Availability Groups” box
and then click OK to exit the properties.
After enabling AlwaysOn you will need to restart SQL Server, to do that you can go into services or you
can simply right click on the same place you did a minute ago and restart it from within the SQL
Configuration Manager.

Now inside of SQL Management Studio you should be able to expand out the AlwaysOn section, however
there wont be anything in it yet.

Before we can create an availability group we need something to protect so create a database and make
sure the logging mode is set to Full. Also for the nodes to get in sync with each other you will need a
shared folder somewhere on your network, if you don’t already have one create one now.
After you have created your database go back down to “AlwaysOn High Availability” and right click, then
select “New Availability Group”.

Give the group a name.

Once you have all of your nodes added, make sure to select the proper options as to what you want them
to be doing, in most cases you will want them to automatically failover and be synchronous, but
remember if you select “Readable Secondary” then technically you need to fully licenses that copy of SQL
as it will no longer be considered passive.

Before clicking next select the “Listener” tab. Here you need to create a listener with a name, port, and IP
address. Then click next.

Next we will use that shared directory I was telling you about. It will be used to store a backup of the
database so that you can sync up the other nodes of the group. Select “Full” and then enter the path to
your shared folder.
Next the wizard will validate your setup, and then you will click next to start the process to setup the
group. After all has completed you can click close.
Now under AlwaysOn High Availability (after you refresh SQL Management Studio) you should see a
group.
Adserver:
server 1:
Screenshots for share drive
server 2:

You might also like