Search This Blog

Showing posts with label MS SQL FAILOVER CLUSTER. Show all posts
Showing posts with label MS SQL FAILOVER CLUSTER. Show all posts

MS SQL FAILOVER CLUSTER (Complete reference)

Before getting hands on experience in SQL server on failover cluster , I used to read many article about failover clustering. Unfortunately I was not able to digest the concept till I wet my hands.I will keep this point in my mind while explaining the failover cluster in this post.

What is a windows Cluster ? A cluster is a group of independent computer systems, referred to as nodes, working together as a unified computing resource. When we say unified computing , it does not mean that a single application can access the resources (cpu/memory) of multiple computer at any point of time. A cluster provides a single name for clients to use it services.There are two type of cluster:

Network Load Balancing Cluster : A Network Load Balancing Cluster (NLB) distribute the load (request from the client)  to the different nodes which are part of the cluster based on predefined rules.The  client application has to communicate to a single cluster IP address (virtual server)  and client does not know which node in the cluster exactly serving its request.Network Load Balancing cluster helps to enhance the the availability and scalability of  application. We are not going to talk much about this on this post.

Fail over Cluster:  Failover cluster is a collection of servers that by working together increase the availability of applications and services that run on the cluster. It can be  described as a technology that automatically allows one physical server to take over the tasks and responsibilities of another physical server that has failed.A failover cluster provides high availability for cluster aware application like SQL server ,exchange server,etc. The major difference between NLB cluster and failover cluster is, failover cluster will not help to improve the scalability of the application. It can only support high availability.

There are many misunderstanding among people about the advantage of having SQL server on a failover cluster environment. Below table will give a clear picture about the capability of SQL server on cluster environment.


To understand the failover cluster it is important to familiar with the terminologies. Let us have look on the terminologies used in the windows clustering.

Server Node: Physical node with operating system that support windows clustering. Each server node should have minimum two network card for public and private network.Minimum one local hard disk is required for OS and other application binaries.

Private Storage: Local disks are referred as private storage. There will be minimum of one private disk for OS and SQL binaries.Server node can have a additional local disk for bigger page file.
Shared Disk Array: Each server needs to be attached to the shared external storage.In non-clustered SQL server instance, databases (system/user/resource) are store on locally attached disk storage but in clustered SQL server instances databases are store data on a shared disk array.That mean all the server nodes in the cluster setup are physically connected to the disk array.This shared storage configuration allow application to failover between server in the cluster.

Quorum Disk: Quorum is the cluster's configuration file.This file (quorum.log) resides in the the quorum disk (one disk from shared disk array).Quorum is the main interpreter between all nodes. It stores latest cluster configuration and resource data. This helps the other nodes to take ownership when one node goes down.
In real life, it is like emergency contact number and other medical information in your wallet which help others to take action in case of emergency.

Public Network and Private Network: Each server needs at least two network cards. Typically, one is the public network and the other is a private network between the nodes. The private network is used for internal communication of cluster.This is referred as heart beat. Public network is used to connect the external world or intranet.

Heart Beat: Heart beat is health check mechanism in cluster A single UDP packet sent between nodes in the cluster via the private network to confirm that  nodes are still online. By default cluster service will wait five seconds(one heart beat sent in every second)  before considering a cluster node to be unreachable.

Looks Alive check:Looks alive check is a basic resource health check to verify that the service(SQL service in our context) is running properly.To perform this , cluster service queries the windows service control manager to check the status of the service.By default looks alive check will happen in every five seconds.

Is Alive checkAn exhaustive check to verify that a resource is running properly. If this check fails, the resource is moved offline and the failover process is triggered. During the Is alive check  the cluster service connects to the SQL server instance and execute select @@SERVERNAME.It will check only the SQL server instance availability and does not check the availability of user databases.

Failover: Clusters service monitor the health of the nodes in the cluster setup and the resources in the cluster. In the event of a server/resource failure, the cluster service  re-starts the failed server's workload on one of the remaining servers based on possible owners settings. The process of detecting failures and restarting the application on another server in the cluster is known as failover .


Virtual Server:Virtual server consist of a network name and IP address to which the client connect.This helps the client to connect the service  which hosted in the cluster environment with out knowing the details of the server node on which the service is running.In simple word , virtual server helps the client application to connect the SQL server  instance with out changing the connection string in case of failover of SQL instance.


Possible Owners :Possible owners are the server nodes on which cluster group (in our context SQL instance) can failover

Preferred Owner: Preferred owner is the server node which best suited to running an application or group.

Cluster Setup: Below schema diagram will give a clear picture about the windows cluster setup.


























This picture depicts  two  node cluster setup.At this stage Node A and Node B will have only OS and windows cluster service.One of the disk from cluster disk will be designated as the quorum disk. This setup basically done by windows administrators and storage specialists.On top of this,  DBA's install  and configure the SQL instances. We are not going talk about the SQL server installation on cluster environment on this post.

To make it more clear, let us describe our cluster environment as given below.

















Let us look into the pictorial representation current setup.

Fig 1






















From the Fig-1, we can see that INST1 and INST2 are installed on both physical node , but at any point of time one instance will be online only in one node.At this stage INST1 is running on physical node Pnode-A and INST2 is running on node Pnode-B.The cluster disk D and E will be visible in the node Pnode-A and F and G will be visible in the node Pnode-B.The request from the App1 will be routed through the virtual server A and landed in Pnode-A where the INST1 is running.In the same way the request from the App2 will be routed through the virtual Server B and landed in Pnode-B where the INST2 is running.

Let us see what will happen if there is a hardware/network failure in Pnode-A. Fig 2 depicts the failover of  scenario of INST1 to Pnode-B.

Fig 2





















Now the INST1 went offline in Pnode-A and came online Pnode-B.The connection from the App1 will be routed through the same virtual Server A and landed in Pnode-B.All four cluster disk will be visible in Pnode-B and only C (Local disk) will be accessible from Pnode-A. Note that even after the failover of INST1,App1 will be connecting to the virtual server A.It helps to make the failover transparent to the application.

MS SQL Server 2008 Fail over cluster installation on Windows Server 2008 R2

Following article describes steps for installing MS SQL Server 2008 two node failover cluster on Windows Server 2008 R2.

For instructions on setting up MS SQL Server 2008 failover cluster on Windows Server 2003 please read the articlehere

MS SQL 2008 instance must be installed on one (1) node of the cluster and after the installation completes successfully, other nodes have to be added to the SQL 2008 clustered installation. 

With SQL 2005, the installation program was able to install the SQL instance to all the nodes of the cluster but with the SQL 2008 installation program, it is not possible anymore i.e. it has to be installed to a node (first node) and then other nodes needs to be added to the SQL 2008 clustered instance.

Following videos illustrate steps for installing MS SQL Server 2008 failover cluster on Windows Server 2008 R2. For step by step instruction read through the information below.

Initiate MS SQL Server 2008 installation on the first node (Eg: Machine Name: WIN2K8005):
Add second node (Eg: Machine Name: WIN2K8006) to the SQL Server 2008 failover cluster
Step by step installation instructions:

Before we begin the installation make sure the following prerequisites are in place


1. Servers in domain

  • Verify that servers are part of the domain.
  • Validate virtual names and IPs are not in use (for cluster, MSDTC and SQL instance)
2. Operating System & Service Pack
  • Verify OS version and Service Pack level. All servers in failover cluster must be running same OS version and service pack level. 
3. Host name
  • Check hostname on each node.
  • At a command prompt, type: hostname
4. Drive format
  • Ensure partitions used by SQL Server are created with offset=64k and formatted using 64K block size.
5. Drive letters
  • Check drive letter assignments.
  • Correct assignments for each node.
  • Correct size for each drive.
For cluster
  • Validate all disk resources to be used by SQL instance have been added to the cluster.
  • SQL installation needs to be executed from the node owning the cluster resources.
6. Disk permissions
  • For cluster installation, use mount points to minimize a number of drive letters required. 
  • For a standalone installation, using drive letters is fine unless there will be an issue with too many drive letters to use in which case, you have to use mount points.
  • Set the right permissions on the drives to be mounted. The permissions should be (Full Control):
7. NIC configuration
  • Check NIC setup
  • Ping each node of the cluster using the Public and Private networks.
  • Repeat on each server. 
8. MSDTC Service
  • Ensure MSDTC Network access is configured.  For MSDTC configuration click here

Note: “Enable SNA LU 6.2 Transactions” (Property in blue) is valid for Windows Server 2008 R2 only.

If Standalone

  • Ensure Distributed Transaction Coordinator service is enabled and running.
  • Ensure Task Scheduler service is running.
  • Ensure both COM+ services are running.
For Cluster
  • Ensure MSDTC is clustered.
  • Ensure Task Scheduler service is running on all the nodes of the cluster.
  • Ensure both COM+ services are running on ALL nodes of the cluster.
9. AD object and local policies requirements for SQL Service Account & Group

The AD group is not required for a standalone installation but is mandatory for a cluster installation. 

For standalone installation:

  • The installation program will create a local group on the server to be used by SQL. The created local group must be added to the security policy settings that are pushed through GPO.
  • The required local policies will be granted automatically by the setup program to the AD group during the installation. 
For cluster installation:
  • Domain Security Groups for SQL Services and SQL DBA's must be created
  • Created local group must be added to the security policy settings that are pushed through GPO. 
Important: (New for SQL Server 2008) The account running cluster installation MUST HAVE “Bypass traverse checking” privilege. The GPO has to be updated to have the DBA with this privilege. To enable this, the Administrators group should be added to “Bypass traverse checking” and the 'SQLAdministrators' AD group should be a member of the OS Administrators group.

Local Policies:
  • ‘Perform volume maintenance’  policy will be set by GPO from OU level:
  • Standalone: Add the SQL Group created during the SQL installation.
  • Clustered: Add the AD ‘SQL Service’. This policy is required to enable the use of “Instant File Initialization” feature.
IMPORTANT:

1. For Cluster Installation: The computer account for the SQL Virtual Name MUST BE created in proper OU before attempting the installation and DISABLED. 
If the computer account for the SQL Virtual Name is not created or not disabled– installation will FAIL!  It will be required to uninstall all the components and perform clean install.

2. (New for 2008) The SQL 2008 installation creates the SQL Name cluster resource with Kerberos authentication enabled. If the computer account is not created in AD prior to installation, the setup will fail. 

3. The AD group for the SQL instance & AD service account(s) for the SQL instance are NOT a member of the Local administrators group

10. Windows Locale Setting
  • Confirm Windows Locale Setting – use Control Panel. 
  • Regional and Language Options, 
  • Standards and formats= English (United States)
  • Location = Canada

With the Windows Locale setting as above, a default SQL install will require SQL collation as: SQL_Latin1_General_CP1_CI_AS.

11. User Account running setup

Ensure user account running setup has following privileges:
  • Bypass Traverse Checking
  • Debug Programs
For clustered installation the privileges mentioned above should be added on Each Node of the cluster.

12. .Net Framework 3.5 SP1

.Net Framework 3.5 SP1 is mandatory prerequisite for SQL 2008 and SQL 2008 R2.

Windows Server 2008 R2 has .Net Framework 3.5.1 as a component of OS. There is no installation required, but .Net Framework 3.5.1 needs to be enabled on Windows Server 2008 R2

13. Windows Installer 4.5

SQL 2008 requires Windows Installer version 4.5.

Windows Server 2008 and Windows Server 2008 R2 already have Windows Installer 4.5 version as part of the OS. 

Installation Steps:


1. Run Setup

Use the software from the DSL or from the CD-ROM
Double-click the file: setup.exe

2. SQL Server Installation left
Click  “Installation”
Click on “New SQL Server failover cluster installation”


3. Setup Support Rules
Setup will verify prerequisites for installing “Setup Support Files”.


Click Ok

4. Setup Support Files - Install
Click Install

Setup Support Files installation will proceed.  It may take a few seconds.

5. Setup Support Rules – SQL Server 
Setup will validate readiness for SQL Server installation


Note: “Microsoft .NET Application Security” Rule might generate warning due to the fact that there is no access to the Internet.


6. Product Key
Enter product key. Click Next


7. License Agreement
Check “I accept the license terms.”.
Click Next


8. Feature Selection
Select following components/features to install:
Database Engine Services
SQL Server Replication (will be selected automatically)
Full-Text Search (will be selected automatically)
N.B.: Both options are mandatory i.e. they cannot be removed for a cluster installation. 
Client Tools Connectivity
Integration Services
Client Tools Backwards Compatibility (optional)
SQL Server Books Online
Management Tools – Basic
Management Tools – Complete

Note: Marked in Blue “Shared feature directory (x86)” will appear in 64-bit versions only.
Leave “Shared Feature Directory” and “Shared feature directory (x86) unchanged.
Click Next


9. Instance configuration
Provide instance configuration and review currently installed features, if any.
Specify Virtual SQL Server name

If named instance:
Select “Named Instance” and specify instance name  

DO NOT change “Instance ID”
Keeping the instance Name and Instance ID the same will make it easier to support 
Leave “Instance root directory” unchanged
Click Next


10. Disk Space Summary
Setup will show the amount of space required to install selected features.
Click Next


11. Cluster Resource Group
The list of the cluster resource groups present on the cluster will be displayed. You need to specify which groups can be used for SQL 2008 installation.  If group was already created in the cluster, select the cluster group you want to install SQL 2008 into. Click Next


12. Cluster Disk 
The list of cluster shared disks present on the cluster will be displayed. Select disks that can be used for SQL 2008 installation. 
Select the disks that you want to be included in the SQL Server resource cluster group. Setup will configure SQL Server resource dependency on the disks automatically.
Click Next

13. Cluster Network Configuration
List of networks, available to be configured for the Virtual SQL Server IP resource will be displayed.
Check the network to use and specify IP address of the Virtual SQL instance.
Click Next

14. SQL Service Domain Groups
Specify AD group for SQL Services. You can specify seperate group for Database Engine and SQL Server Agent or use the same AD group.
Eg: AD Group: SQL2K8CL2_SQLServices
Click Next


15. Server Configuration
Unless specified otherwise use the same account for all SQL services.
Click "Use the same account for all SQL Services"  button
Specify AD service account to be used as the SQL service account.
Eg: srvSQL2K8CL2
Click Ok


For the Full-Text search service in SQL Server 2008: the service will be using ‘Local Service’ and will be enabled & started.

Select the “Collation” tab.  
Change Collation setting if required, else Click Next
At this point Setup will validate the service account, its password and AD group membership.


16. Database Engine Configuration
On the “Account Provisioning” tab specify:
Authentication mode


Select Mixed Mode
Specify password for “sa” account

In Specify SQL Server Administrators, click Add
Specify groups/users you want to be added to “sysadmin” server role
Eg: AD Group: SQL2K8CL2_SQLAdmin

Go to “Data Directories” tab and specify:

Data root directory (it should be the root of the SQL system drive)
Directories for the database files, database log files and backups. Following logic to applied:

Go to  “FILESTREAM” tab:

You can choose to configure FILESTREAM during installation or do it post installation 
Click Next


17. Error and Usage Reporting
Click Next


18. Cluster Installation Rules
Setup will verify the readiness for the failover cluster installation.
Click Next



19. Ready to install
The list of all the features and configuration to be installed will be displayed.
Click Install


Installation in progress
You will see water rise for a while, have patience – it will take a quite sometime to complete.


Click Next


Click Close


Congratulations! This completes SQL 2008 installation on first node of the failover cluster.
We still have to install instance on other nodes.

In order to add a new node to an existing SQL Server 2008 clustered instance, the installation must be executed from the node that will be added to the SQL clustered instance i.e.  node cannot be added remotely from another node.

Access other node to be added and run setup. Double-click the file: setup.exe
From SQL Server Installation left click “Add mode to a SQL Server failover cluster” and follow the prompt. 


For step by step instructions, watch the following video:http://www.youtube.com/watch?feature=player_embedded&v=oqSP0LtSJmE