0% found this document useful (0 votes)
36 views

SQL 2019 Active

clustering do c

Uploaded by

yidegbi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views

SQL 2019 Active

clustering do c

Uploaded by

yidegbi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 13

SQL 2019 Active-Active-Cluster

Domain Controller & DNs Server

(Ecxs.local)

SAN

Ecx-DC-1

SQL instance-ECXDB SQL instance-DBECX

Active Ecx-node-1 Ecx-node-2


Active
How to configure SQL server 2019 Active/Active Cluster. Following are the pre requisite for that

Software Needed

1. Windows server 2019 evaluation edition and SQL 2019 server


2. Virtualization software like VMWare/Hyper-V

Configuring windows server cluster

First step in configuring SQL server 2019 cluster is to have windows cluster first. Now there are
many steps involved while creating windows cluster itself. Following are the steps which you
can follow in-order to configure windows server cluster.

1. Installation of Windows Server 2019 Server


1) Install Windows Server 2019 by creating a Virtual Machine
2) Change machine name
3) Allocate IP Address

Computer Name
1. This PC --> Properties --> Advanced System Settings --> Computer Name(Ecx-DC-1)

IP Addresses

1. Control panel …networks & internet


IP address: 192.168.80.10
Subnet mask: 255.255.255.0
Default gateway: 192.168.80.2
Preferred DNs server: 192.168.80.10
Alternate DNs server: 192.168.80.2

Disable firewall
1. Control Panel --> System and Security --> Windows Defender Firewall --> Turn Off
Windows Defender Firewall

2. Domain Controller Configurations


Installation of Active Directory

1. Open Server Manager


2. Local Server --> Manage --> Add Roles & Features
3. Installation Type --> Role Based Installation

4. Select local server - this is a default option

5. Server Roles --> Select - Active Directory Domain Services

6. Install

Configuring Active Directory Domain Service


1. Click on AD-DS Role at Server Manager

2. Click More

3. Select Action - Promote server to domain controller

4. Add a new forest (Since we don't have any existing domain)

5. Give domain name as - Ecx.local [you can give any name which you want eg. abc.xyz.pqr]

6. Click Next

7. Specify DSRM (directory service recovery mode) password

8. No need to create DNS delegation

9. NetBIOS domain name -- keep it default (it will appear as Ecx as we had mentioned domain
as Ecx.local)

10. Paths - Keep it default

11. Install

12. Restart & Login with Domain User this time

Validating Active Directory


1. Open "Active Directory Users and Computers"

3. Installation of 2 Nodes
Installation of node-1

1. Install Windows Server 2019 by creating a Virtual Machine


2. Change machine name
3. Allocate IP Address
Computer Name
1. This PC --> Properties --> Advanced System Settings --> Computer Name (Ecx-node-1)

IP Addresses
1. Control Panel --> Network & Internet -->

Static IP Address: 192.168.80.15

Subnet Mask: 255.255.255.0

Default Gateway: 192.168.80.2

Preferred DNS Server: 192.168.80.10

Alternate DNS Server: Keep blank

Disable Firewall

1. Control Panel --> System and Security --> Windows Defender Firewall --> Turn Off
Windows Defender Firewall

Installation of node-2

1. Install Windows Server 2019 by creating a Virtual Machine


2. Change machine name
3. Allocate IP Address

Computer Name
1. This PC --> Properties --> Advanced System Settings --> Computer Name (Ecx-node-2)

IP Addresses
1. Control Panel --> Network & Internet --> Network and Sharing

Static IP Address: 192.168.80.20


Subnet Mask: 255.255.255.0
Default Gateway: 192.168.80.2
Preferred DNS Server: 192.168.80.10
Alternate DNS Server: Keep blank

Disable Firewall
1. Control Panel --> System and Security --> Windows Defender Firewall --> Turn off
Windows Defender Firewall
4. Adding nodes to Domain
1. Validate if you can ping to Domain from both the nodes - ping Ecx.local
2. Assign domain name for both nodes
o This PC --> Properties --> Advanced System Settings --> Member Of
Domain - Ecx.local
o Specify credentials for Domain Admin - Ecx\Administrator &
P@ssword#123
o Restart server
o Follow same steps for both nodes
o While logging you should be able to login as Domain Administrator
user instead of local Administrator
o Validate nodes in Domain Controller using "Active Directory Users and
Computers"

5. Installation of iScassi Target


DC Server / Node will also act as Storage or SAN. We will create 6 drives there as
below

1. 2 Data Drives (5 GB Each) - Data01 (G) & Data02 (H)


2. 2 Log Drives (3 GB Each) - Log01 (L) & Log02 (M)
3. 2 Temp Drives (2 GB Each) - Temp01 (T) & Temp02 (U)
4. Quorum Drive (1 GB)

These drives will share with other nodes, wherein we will actually install & configure SQL
Server 2019 Active \ Active Cluster.

Now, in order to create & share \ present these drives (iscasi luns) to other nodes, we need to
follow following steps

a. Installation of iSCSI Target Server


1. Open Server Manager
2. Local Server --> Manage --> Add Roles & Features
3. Installation Type --> Role Based Installation
4. Select local server - this is a default option
5. Server Roles --> Select - File & Storage Services --> iSCSI Target Server
6. Install

b. Add NIC Cards to all 3 nodes in network for iSCSI communication


1. Player --> Manage --> Virtual Machine Settings
2. Click Add --> Select Network Adapter
3. Assign static IP Address for all 3 nodes as below
For DC -- 10.0.0.10
For Ecx-node-1 -- 10.0.0.15
For Ecx-node-2 -- 10.0.0.20
4. Disable Windows Firewall
5. Check the connectivity from DC

c. Creating Shared Disks on Domain Controller

1. Open Server Manager


2. Select "File & Storage Services"
3. Select "iSCSI"
4. Tasks --> "New iSCSI Virtual Disk"
5. Specify Disk Name
6. Specify Disk Size
7. Add Target IP Address 10.0.0.15 & 10.0.0.20
8. Repeat process for all drives which needs to be added

d. Configuring Shared Drives on Ecx-node-1 & Ecx-node-2


1. Open "iSCSI initiator"
2. Specify target - 10.0.0.10
3. Click on Volumes & Devices --> Auto Configure
4. To format disk - Open "Disk Management"
5. Select disks and make online (Right click on each disk)
6. Once its online -- right click --> Initialize Disk
7. Select "GPT - GUID Partition Table" -->
8. Click on Drive (once its online) & click "New Simple Volume"
9. Specify Drive Letter
10. Specify following settings
o File System – NTFS
o Allocation Unit Size -- 64 KB (server-64kb-allocation-unit-size/)
o Volume Label
o Select "Perform Quick Format"
o Finish
11. Repeat same for all available drives
12. Once node-1 configuration is finished, make all drives offline
13. Open "iSCSI Initiator" on 2nd node
14. Specify target - 10.0.0.10
15. Click on Volumes & Devices --> Auto Configure
16. Open "Disk Management"
17. Select disks and make online (Right click on each disk)
18. Right click on each drive --> Select "Change Drive Letter" & match it exactly what we
had given for Node1
6. Installing & Configuring Windows
Server 2019 Cluster
In order to configure SQL Server 2019 Cluster we should first have Windows
Server 2019 cluster. This Windows Cluster 2019 will be between Ecx-node-1 &
Ecx-node-2, as Domain Controller node is not required now.

a. Add new Network Adapter Cards


1. First step of this process is to add 2 separate NIC Cards to each node
2. Assign IP Address to each of them as below
o Ecx-node-1 - 172.16.0.15
o Ecx-node-2 - 172.16.0.20
3. Disable Firewall
4. Restart both nodes

b. Install fail-over cluster feature on both nodes


1. Open Server Manager
2. Local Server --> Manage --> Add Roles & Features
3. Features --> Select "Failover Clustering"
4. Click "Add Features"
5. Install
6. Restart the machine
7. Do it for both the nodes

c. Configure Windows Cluster


1. Open "Failover Cluster Manager"
2. Select "Create Cluster"
3. Add both nodes Ecx-node-1 & Ecx-node-2
4. Perform validation by selecting all required tests
5. Validate the report and check the status
6. Specify cluster name – WinServerCluster
7. Specify IP Address - 192.168.80.25
8. Select "Add all eligible storage to cluster"
9. Click Finish

d. Validate witness / quorum disk


1. Right click on "WinServerCluster" --> More Actions --> Configure Cluster Quorum Settings
2. Next --> select quorum witness
3. Configure a disk witness
4. Select witness disk (Q) from available disk
e. Validate Cluster Failover

7. SQL Server 2019 Installation -


Prerequisite
a. Creating Service Accounts
1. Open "Active Directory Users and Computers"
2. Create AD Group "SQL PRD ADMIN" for all Admins, and give Domain Admin or Local Admin
access to this group.
3. Add individual Domain Accounts to "SQL PROD ADMIN". e.g. Add Ecxs\DBECX or Ecxs\
ECXDB to group "SQL PRD ADMIN"
4. Make AD Group "SQL PRD ADMIN" as a Local Admin to each node
o Open "Edit Local Users and Groups"
o Under Groups section, select "Administrator" group and add "SQL PRD
ADMIN" in it.
5. Create separate Service Accounts for each SQL Service as below
o SQL.PRD.SERVER
o SQL.PRD.AGENT

b. Grant Windows Rights to SQL Server Service


account
1. Open "Local Group Policy Editor"
2. Add above listed SA accounts to following listing - https://www.sqlshack.com/perform-
volume-maintenance-tasks-security-policy/
o Perform volume maintenance tasks
o Lock pages in memory

c. Benchmarking LUNs or Speed Checks of Shared


Drives
1. Download & Install "Crystal Disk" software from
https://osdn.net/projects/crystaldiskmark/downloads/71859/CrystalDiskMark7_0_0h.exe/
2. How to read "Crystal Disk" results - https://www.brentozar.com/archive/2012/03/how-fast-
your-san-or-how-slow/
3. Use Microsoft DiskSpd from -
https://docs.microsoft.com/en-us/azure-stack/hci/manage/diskspd-overview

d. Changing to CSVFS (Cluster Shared Volume File


System) format
1. Sharing Disks between 2 nodes

o Open Administrative Tools --> Failover Cluster Manager


o Create 2 Empty Roles - Node1 & Node2
o Assign Preferred Owner as Node1, Node2 & vice versa
o Assign Storage to each node
2. Or instead use CSVFS - Why it’s needed?
3. More information on https://docs.microsoft.com/en-us/windows-server/failover-
clustering/failover-cluster-csvs

8. SQL Server 2019 Installation


1. SQL Server Editions &
Licencing https://download.microsoft.com/download/6/6/0/66078040-
86d8-4f6e-b0c5-e9919bbcb537/SQL%20Server%202019%20Licensing
%20guide.pdf
You can validate the cores by
I. Control Panel\System and Security\System and check
Processors
II. Or Open task manager --> Open Resource Monitor -->
Click on CPU
III. Or Advanced System Settings --> Hardware --> Device
Manager --> Processors

2. Download SQL Server Developer Edition


from https://www.microsoft.com/en-us/sql-server/sql-server-
downloads

I. Once download, run the installer and choose "Download


Media" option
II. Select following options on next screen
o Choose ISO image for download
o Location as G:\Softwares\SQLServer2019
o Click download
III. Once download finishes, copy ISO image to respective node
where you want to install SQL Server
IV. Click on ISO, and you can start SQL Server Installation by
running Setup.exe
3. Installation Steps
I. Create directories as below
o C:\ClusterStorage\Volume1\MSSQL\Data01
o C:\ClusterStorage\Volume2\MSSQL\Data02
o C:\ClusterStorage\Volume3\MSSQL\Log01
o C:\ClusterStorage\Volume4\MSSQL\Log02
o C:\ClusterStorage\Volume5\MSSQL\Temp01
o C:\ClusterStorage\Volume6\MSSQL\Temp02
II. Re-Name Network
o Cluster Network 1 --> Cluster Nodes
o Cluster Network 2 --> Shared Drives
o Cluster Network 3 --> Heartbeat [This will
verify if both nodes are up & running; if
one of the node is down, it will start
failover]
III. Choose "Installation" --> "New SQL Server Failover
Cluster Installation"
IV. Specify Edition --> (Developer)
V. Accept License Agreement
VI. Feature Selection - We are going to install only
"Database Engine Service".
VII. Select installation directories as follows

o Instance Root Directory - C:\Program Files\


Microsoft SQL Server\
o Shared Feature Directory - C:\Program Files\
Microsoft SQL Server\
o Shared Feature Directory (x86) - C:\Program
Files (x86)\Microsoft SQL Server\
VIII. Specify SQL Server Network Name – ECXDB
IX. This will be used to connect to SQL Server, you can
skip named
X. instance and keep default instance
XI. Specify Disks which you want to allocate to that SQL
Server
XII. Instance. In our case Disk 1, 3,5 are for first instance &
Disk 2,4,6 are for second instance
XIII. Specify IP Address for SQL failover cluster - this has to
be of same range \ network of your node - which is
192.168.80.30
XIV. Specify Service Accounts & Change startup type to
Automatic - SQL Server Agent - SQL.PRD.AGENT &
Specify Password - SQL Server Database Engine -
SQL.PRD.SERVER & Specify Password - Select "Grant
Perform Volume Maintenance Tasks privileges to SQL
Server Database Engine Services"
XV. Select "Mixed Mode" Authentication - Specify password
for SA account as "P@ssword#123" - Add group "SQL
PRD ADMIN" as SQL Administrator
XVI. Specify Data Directories
- Select data root directory as "C:\ClusterStorage\
Volume1\MSSQL\Data01" - Select User database
directory as "C:\ClusterStorage\Volume1\MSSQL\
Data01\MSSQL15.ECXDB\MSSQL\Data" - Select User
database log directory as "C:\ClusterStorage\Volume3\
MSSQL\Log01\MSSQL15.ECXDB TE\MSSQL\Data
XVII. Temp DB

o As per microsoft documentation "The number


of secondary data files depends on the number
of (logical) processors on the machine. As a
general rule, if the number of logical
processors is less than or equal to eight, use
the same number of data files as logical
processors. If the number of logical processors
is greater than eight, use eight data files. Then
if contention continues, increase the number
of data files by multiples of four until the
contention decreases to acceptable levels, or
make changes to the workload/code." which is
available as below
o https://docs.microsoft.com/en-us/sql/relational-
databases/databases/tempdb-database?
view=sql-server-ver15
o Since in our case - logical processors are 2,
SQL installer intelligently took "No. of Files" as
2
o What Size you would select? check that
at https://www.brentozar.com/archive/2016/01
/cheat-sheet-how-to-configure-tempdb-for-
microsoft-sql-server/
o Since we are going to have 3 GB of Temp drive
for each node, select "Initial Size (MB)" as 1 GB
(1024 MB)
o Select data directory as - C:\ClusterStorage\
Volume5\MSSQL\Temp01
o Select log directory as - C:\ClusterStorage\
Volume5\MSSQL\Temp01
o Keep "Temp log file Size configuration" as
default
XVIII. MaxDOP
Total no of logical processors we have are 2 so based on
o
that it got selected as 2 by default. Please see
documentation as below
o https://www.mssqltips.com/sqlservertip/6211/sql-server-
2019-installation-enhancements-for-maxdop-and-max-
memory/
XIX. Memory
o Click on "Recommended"
o Since we have total 2 GB available for VM,
change max memory to 1024 MB / 1 GB
o Select "Click here to accept the recommended
memory configurations for the SQL Server
Database Engine"
o More information is available
at https://www.mssqltips.com/sqlservertip/621
1/sql-server-2019-installation-enhancements-
for-maxdop-and-max-memory/
XX. FileStream
o This is required if you are going to use un-structured
data. we will ignore this
o https://docs.microsoft.com/en-us/sql/relational-
databases/blob/filestream-sql-server?view=sql-server-
ver15
XXI. Click Next & the Install
XXII. Installation will fail with error as below if you specify Temp
directory directly as C:\ClusterStorage\Volume3. So, make
sure you will create directory inside a drive before
installation "Updating permission settings for folder "C:\
ClusterStorage\Volume3" failed. Please check blog
- https://blog.sqlauthority.com/2017/11/11/sql-server-
installation-error-updating-permission-setting-file-failed/
XXIII. Cancel installation, create a new directory under Volume3
and re-start installation
4. Download SSMS
5. Installing failover cluster
i. Copy installer to 2nd node
ii. Choose "Installation" --> "Add a node to a SQL Server Failover Cluster"
iii.Select "Developer" Edition
iv. Accept "License Agreement"
v. All validations should be Ok
vi. Specify SQL Server Instance - in our case it’s a default instance, name
of node2, Cluster Network Name (ECXDB) & name of node1. This is all
default and no need to modify anything here.
vii.IP Address of SQL Instance will appear automatically
viii. SQL Server & Agent Services and corresponding Service
Accounts will appear; specify password. Select check box for volume
maintenance task
ix. Install
6. Validation of SQL Server failover cluster

i. Validate the ownership of LUNs / Disks - it’s not mandatory


ii. Create a Dummy database and create a table in that. Run a sql
query to validate the data
iii. Turn off one node
iv. You should still be able to connect to SQL Server from 2nd node
and execute same query
7. Use Local SSD instead of Shared Drives / SAN for TempDB
i. Create directories under C:\MSSQL\Temp01
ii. Move existing TempDB from Shared Drive to Local Drive

o How to move DBs from one drive to


another? https://docs.microsoft.com/en-us/sql/relational-
databases/databases/move-system-databases?view=sql-
server-ver15

iii. Bring one of the node and validate

You might also like