Clustering SQL server Active-active-passive

download Clustering SQL server Active-active-passive

of 29

description

Clustering SQL Server with single instance or multiple instance using Failover, failback and DR standy

Transcript of Clustering SQL server Active-active-passive

SQL Server Performance Monitoring & Optimization

www.optimizesql.com/blog SQLDBA Clustering SQL Server1ByKareem Syedwww.optimizesql.blogspot.in1Agenda

2 Understanding Windows Clustering Working with SQL Clustering Monitoring Clustering Troubleshooting Clustering

www.optimizesql.com/blog SQLDBA 23SQL Server High AvailabilityGoal of High Availability is to keep systems, applications, email, databases etc always runningHA Overview

www.optimizesql.com/blog SQLDBA 4Server downtime is unavoidable.But we have to keep the business running and competitive.Server may go offline due toMaintenanceUpgradeSoftware or HardwareUpdatesHot fixes, security patchesAccidentlyPower OutagesDisasters

Importance of HA

www.optimizesql.com/blog SQLDBA Group of two or more servers (Nodes) that work together and represent themselves as single Server (Virtual Server) in the network. A server cluster is a collection of servers, called nodes that communicate with each other to make a set of services highly available to clients. Server clusters are designed for applications that have long running in-memory state or frequently updated data.Introduction to Clustering

www.optimizesql.com/blog SQLDBA Introduction6 A Microsoft SQL Server Cluster is simply a collection of two or more physical servers. These Servers are called Nodes. These nodes have same access to shared storage and provides the resources required to store the database filesEach of the nodes talk to one another via a network If one node does not communicate to the other node the other node will take ownership of SQL Server service. This process is called fail over. A failover can occur both automatically (a server stops communication for some reason) or manually.

www.optimizesql.com/blog SQLDBA 6

Client PCsServer AServer BSharedDisk Array

HeartbeatCluster management SQL ServerVirtual ServerEFGC,DC,DSQL ServerHubHub

Basic Architecturewww.optimizesql.com/blog SQLDBA BinnInstallUpgradeBinnInstallUpgradeBackupDataFTDataJob, Log, repldata7

Client PCsServer AServer BSharedDisk Array

HeartbeatCluster management SQL ServerVirtual ServerEFGC,DC,DHubHub

SQL Server

Basic Architecturewww.optimizesql.com/blog SQLDBA 8SQL is shutdown and restarted on Server B. Therefore clients will be disconnected and have to reconnect.FeatureDatabase MirroringFailover ClusteringLog ShippingData LossNo data loss optionNo data lossMaybeFailoverAutomatic failover optionAutomatic failoverNoFailover timeseconds~ 20+ secondsManualSpecial HardwareNoCertified hardwareNoRedundancyComplete redundancyDisks are sharedComplete redundancyMultiple SecondariesNoNoYesStandby Read AccessYes, through snapshotNoYes, WITH STANDBY optionGranularityDatabaseInstanceDatabaseConn StringTwoONETwoImportance of HA

www.optimizesql.com/blog SQLDBA Advantages10 High Availability Protection from failures Server level hardware and software failures, service failures etc Site level Fires, earthquake etc Online Administration Software/hardware upgrades/patch and restart with minimal downtime. Increased Scalability In some cases, clustering can be used to increase the scalability of an application. For example, if a current cluster is getting too busy, another server could be added to the cluster to expand the resources and help boost the performance of the application. Clustering is transparent to the calling application.www.optimizesql.com/blog SQLDBA 10Advantages11 Manageability Enables managing resources within entire cluster if we are managing a single computer. Instance level redundancy and automatic failover for SQL Serverwww.optimizesql.com/blog SQLDBA 11Advantages12 Reduces downtime. Allows for an automatic response to a failure in hardware/ software. Allows you to perform upgrades without forcing users off the system for extended periods of time. Clustering doesnt require any servers to be renamed. So when failover occurs, it is relatively transparent to end-users. Failing back is relatively quick, and can be done whenever the primary server is fixed and put back on-line. In some cases, clustering can be used to increase the scalability of an application. For example, if a current cluster is getting too busy, another server could be added to the cluster to expand the resources and help boost the performance of the application Clustering is transparent to the calling application.www.optimizesql.com/blog SQLDBA 12Disadvantages13 Failover Cluster is NOT designed to: Protect data Protect against a shared disk array from failing. Load Balance Prevent server from potential data disasters. Requires more on-going maintenance than other alternatives. Requires more experienced DBAs and network administrators.

www.optimizesql.com/blog SQLDBA 13Disadvantages14 This can be expensive. Requires more set up time than other alternatives. Requires more on-going maintenance than other alternatives. Requires more experienced DBAs and network administrators.

www.optimizesql.com/blog SQLDBA 14www.optimizesql.com/blog SQLDBA What SQL Server services can we cluster?15 Clusterable SQL Server SQL Server Agent Analysis Services

Non Clusterable SQL Server Integration Services SQL Server Reporting Services SQL Browser SQL Writer

Full text search (FTS) service? From SQL Server 2008, FTS service is integrated into SQL Server engine15www.optimizesql.com/blog SQLDBA Active and Passive16SQL Server offers Single Instance Clusters and Multi-Instance Clusters.

Single InstanceOnly one SQL Server Instance running at any given time on your cluster. Itll be running either on your 1st node or 2nd node.(Active-Passive).

Multi InstanceWe have 2 nodes running 2 Instances or even 4 Instances of SQL Server, Or lets say youve 3 nodes where youve 2 Instances of SQL Server(Active-Active-Passive), the third node serving as a standby node ready to take ownership in an event of any failure of Node1 or Node2.

16Basic Architecturewww.optimizesql.com/blog SQLDBA Node1Active SQL Instance1Node2Passive

Virtual NamePublic NetworkSANShared StoragePrivate NetworkHeart BeatActive/Passive Cluster

17SQL is shutdown and restarted on Server B. Therefore clients will be disconnected and have to reconnect.Basic Architecturewww.optimizesql.com/blog SQLDBA Node1Active SQL Instance1Node2ActiveSQL Instance2

Virtual NamePublic NetworkSANShared StoragePrivate NetworkHeart BeatActive/Active Cluster

18SQL is shutdown and restarted on Server B. Therefore clients will be disconnected and have to reconnect.Basic Components A minimum of two identical servers. Two NICs are needed per server.Private, PublicStorage (optional) Shared disk storage (SAN)Quorum (Maintains cluster meta data) 256MBMSDTC (Replication/Dist Trans)SQL Server (Backup,FTData,data,repldata,log,job)TempdbData, T.Log Files Distributed Transaction Coordinator (DTC) Operating System, service or Application

www.optimizesql.com/blog SQLDBA Domain Controller.www.optimizesql.com/blog SQLDBA Failover Clustering Terminology20 SQL Server virtual server

It is cluster-configured resource group that contains all resources necessary for SQL Server to operate on the cluster. This includes NetBIOS Name of the virtual server, TCP/IP address for the virtual server All disk drives, SQL Server services20www.optimizesql.com/blog SQLDBA Failover Clustering Terminology21 Heartbeat

A single User Datagram Protocol (UDP) packet is sent every 500 milliseconds between nodes in the cluster across the internal private network, This packet relays health information about the cluster nodes as well as health information about the clustered application21www.optimizesql.com/blog SQLDBA Failover Clustering Terminology22 Failover

It is the process of one node in the cluster changing states from offline to online. It results in the node taking over responsibility of the SQL Server virtual server. The Cluster Service fails over a group in the event that node becomes unavailable or one of the resources in the group fails. 22www.optimizesql.com/blog SQLDBA Failover Clustering Terminology23 Failback

Failback is the process of moving a SQL Server virtual server that failed over in the cluster back to the original online node.23www.optimizesql.com/blog SQLDBA Failover Clustering Terminology24 Quorum Resource

The quorum resource, also referred to as the witness disk in Windows Server 2008. It is the shared disk that holds the cluster servers configuration information. All servers must be able to contact the quorum resource to become part of a SQL Server 2008 cluster

24www.optimizesql.com/blog SQLDBA Failover Clustering Terminology25 Resource Group

A collection of cluster resources such as the SQL Server NetBIOS name, TCP/IP address, and the services belonging to the SQL Server cluster. A resource group also defines the items that fail over to surviving nodes during failover. Resource group is owned by only one node in the cluster at a time.

25www.optimizesql.com/blog SQLDBA Failover Clustering Terminology26 LUNs

An LUN is used to identify a disk or a disk volume that is presented to a host server or multiple hosts by the shared storage device.26www.optimizesql.com/blog SQLDBA Preparing Windows Clustering27 Pre installation checklist

Ensure that all nodes are working properly and are configured properly. Confirm that each node can access shared array or SAN drives. Verify that none of the nodes have been configured as domain controller. Verify that all drives are NTFS and are not compressed. Ensure that private and public networks are properly configured. Verify that you have disabled NetBIOS for all private network cards. Verify that Windows Task Scheduler service is running on each node. Take a domain admin account for configuring windows cluster. Use separate account for cluster service. Add cluster service account to the Local Administrators group of all the nodes in the cluster. Decide windows cluster virtual name and virtual IP.

27www.optimizesql.com/blog SQLDBA Preparing Windows Clustering28 Pre installation checklist

Ensure that shared drives are available for the following requirements

Quorum MSDTCTempDB User Defined database data files User Defined database T.Log files Backups 28www.optimizesql.com/blog SQLDBA Preparing Windows Clustering29 IP Address RequirementsName of ResourceIP AddressPrivate Network heartbeat (one per node)2Public Network (one per node)2MSDTC1Windows Cluster Name1SQL Cluster Name129