SQLCAT: SQL Server HA and DR Design Patterns, Architectures ...

35

Transcript of SQLCAT: SQL Server HA and DR Design Patterns, Architectures ...

Page 1: SQLCAT: SQL Server HA and DR Design Patterns, Architectures ...
Page 2: SQLCAT: SQL Server HA and DR Design Patterns, Architectures ...

SQL Server HA and DR Design Patterns, Architectures, and Best Practices Using Microsoft SQL Server 2012 AlwaysOnSanjay MishraProgram ManagerMicrosoft Corporation

DBI316

Michiel WoriesPrincipal Development LeadMicrosoft Corporation

Page 3: SQLCAT: SQL Server HA and DR Design Patterns, Architectures ...

Setting the Stage

Assumed Pre-requisites for this presentation: Basic knowledge ofAlwaysOn Failover Cluster Instances (FCI)AlwaysOn Availability Groups (AG)

Page 4: SQLCAT: SQL Server HA and DR Design Patterns, Architectures ...

Setting the Stage

AlwaysOn ≠ Availability Groups

AlwaysOn = { SQL Server Failover Cluster Instances, Availability Groups }

Availability Groups ≠ Database Mirroring

Page 5: SQLCAT: SQL Server HA and DR Design Patterns, Architectures ...

SQL Server 2012 AlwaysOn HA+DR Design Patterns

SQL Server 2012 AlwaysOn HA+DR Design Pattern Solution Characteristics

Corresponding Pre-SQL Server 2012 Solution

1 Multi-site Failover Cluster Instance (FCI) for HA and DR

• Shared Storage solution a

a Masked by storage replication Multi-site FCI using stretch VLAN

2 Availability Group for HA and DR • Non-Shared Storage solutionDatabase Mirroring for Local HA and Log Shipping for DR

3Failover Cluster Instance for local HA + Availability Group for DR

• Combined Shared Storage and Non-Shared Storage

Failover Cluster Instance for Local HA and Database Mirroring for DR

Slight variations of these design patterns are occasionally observed as well.

Page 6: SQLCAT: SQL Server HA and DR Design Patterns, Architectures ...

Friday, June 29, 10:15 AM – 11:30 AM

DBI360: SQLCAT: SQL Server 2012 AlwaysOn Lessons Learned from Early Customer DeploymentsD 204

Page 7: SQLCAT: SQL Server HA and DR Design Patterns, Architectures ...

titleMulti-site Failover Cluster Instance for HA and DR

Page 8: SQLCAT: SQL Server HA and DR Design Patterns, Architectures ...

Multi-site Failover Cluster Instance for HA and DRPrimary Site DR Site

Node 1 Node 2Node 3 Node 4

Windows Server Failover Cluster

Storage Replication

SQL-FCIActive Passive Passive Passive

SQL Server 2012 AlwaysOn HA+DR Solution Solution Characteristics

Corresponding Pre-SQL Server 2012 Solution

1Multi-site Failover Cluster Instance (FCI) for HA and DR(http://sqlcat.com/sqlcat/b/whitepapers/archive/2011/12/22/sql-server-2012-alwayson_3a00_-multisite-failover-cluster-instance.aspx)

• Shared Storage solution a

• Instance Level HA (automatic)• Instance Level DR (automatic b)• Uses storage replicationa Masked by storage replication b Consider 3rd data center

Multi-site FCI using stretch VLAN

Page 9: SQLCAT: SQL Server HA and DR Design Patterns, Architectures ...

Multi-site Failover Cluster InstanceKey Elements

A single SQL Server failover cluster instance (FCI) providing HA as well as DRspanning across multiple sites (usually multiple subnets as well)

Key components:Storage

Storage level replicationCluster EnablerProvided by the storage vendor

Work with your storage vendor to get the appropriate software and best practices

NetworkMulti-subnet support in SQL Server configuration and engine

Key improvement in SQL Server 2012IP address OR dependency set within SQL Server setupSQL Engine skips binding to any IP’s which are not online at start-up

RegisterAllProvidersIP for Network Name improves application failover time

Page 10: SQLCAT: SQL Server HA and DR Design Patterns, Architectures ...

Storage ValidationStorage Validation Check Requirement is relaxed due to make-up of multi-site storage infrastructure (but still get the pop-up!)Multi-site FCI Solution does not require passing the storage validation tests, to be supported. http://support.microsoft.com/kb/943984

Appropriate Quorum Model Validation suggests “Node and Disk Majority” which can be ignoredConsider “Node and File Share Majority” or “Node Majority” based on number of nodes

Multi-site Failover Cluster InstanceDeployment Considerations

Page 11: SQLCAT: SQL Server HA and DR Design Patterns, Architectures ...

TEMPDB on Local DiskNot specific to “multi-site” FCIs, but has some great positive side effects for “multi-site” scenariosEnables use of local storage for TEMPDB

Can use solid state storage to improve performance of TEMPDB-heavy workloadsSaves money on storage replication licensingReduces cross-data center storage replication traffic

Multi-site Failover Cluster InstanceDeployment Considerations

Page 12: SQLCAT: SQL Server HA and DR Design Patterns, Architectures ...

titleAvailability Groups for HA and DR

Page 13: SQLCAT: SQL Server HA and DR Design Patterns, Architectures ...

Availability Groups for HA and DR

SQL Server 2012 AlwaysOn HA+DR Solution Solution Characteristics

Corresponding Pre-SQL Server 2012 Solution

2 Availability Group for HA and DR

• Non-Shared Storage solution• (Group of) Database Level HA (automatic)• (Group of) Database Level DR (manual c)• DR replica can be Active Secondaryc DR is manual, if HA is chosen automatic. Consider 3rd data center, if need automatic DR.

Database Mirroring for Local HA and Log Shipping for DR

Primary Data Center Disaster Recovery Data Center

SQL ServerPrimary

SQL ServerSecondary

Windows Server Failover Cluster (single WSFC crossing two data centers)

Availability Group

Synchronous

Asynchronous

SQL Server

Secondary

Page 14: SQLCAT: SQL Server HA and DR Design Patterns, Architectures ...

Pre-requisites:Prerequisites, Restrictions, and Recommendations for AlwaysOn Availability Groups (SQL Server)

Unit of FailoverGroup of databases – not the instanceConsider Contained Database for containing logins for failoverFor jobs and other objects outside the database, simple customization needed

Considerations for Replacing Log ShippingNo delayed apply on the secondaryRemoving log shipping means the regular log backup job is removed

Need to re-establish periodic log backup (essential for truncating the log)

Availability Groups for HA and DRDeployment Considerations

Page 15: SQLCAT: SQL Server HA and DR Design Patterns, Architectures ...

Special Case: Automatic Failover for DRUse of 3rd Data Center

Primary Data Center Disaster Recovery Data Center

SQL ServerPrimary

SQL ServerSecondary

Windows Server Failover Cluster

Availability Group

Synchronous

File Share

3rd Data Center

Page 16: SQLCAT: SQL Server HA and DR Design Patterns, Architectures ...

titleFailover Cluster Instance for HA, and Availability Group for DR

Page 17: SQLCAT: SQL Server HA and DR Design Patterns, Architectures ...

FCI for HA + AG for DR

SQL Server 2012 AlwaysOn HA+DR Solution Solution Characteristics

Corresponding Pre-SQL Server 2012 Solution

3 Failover Cluster Instance for local HA + Availability Group for DR

• Combined Shared Storage and Non-Shared Storage

• Instance Level HA (automatic)• (Group of) Database Level DR (manual)• DR replica can be Active Secondary• Asymmetric storage is the key to this solution

Failover Cluster Instance for Local HA and Database Mirroring for DR

Primary Data Center

SQLFCIPrimary\INST_A

Disaster Recovery Data Center

SQLFCIDR\INST_B

Synchronous / Asynchronous

Primary Secondary

Windows Server Failover Cluster

Availability Group

Page 18: SQLCAT: SQL Server HA and DR Design Patterns, Architectures ...

Pre-requisites:Windows Server Service packs / QFEs:

Asymmetric StorageWindows Server 2008 with http://support.microsoft.com/kb/976097OR, Windows Server 2008 R2 SP1

Node Votes: http://support.microsoft.com/kb/2494036Validate disk test QFE: http://support.microsoft.com/kb/2531907

Prerequisites, Restrictions, and Recommendations for AlwaysOn Availability Groups (SQL Server)

Different units of failover for HA and DRInstance-level failover for local HA (FCI)Group of databases (AG) for DR

AG Failover ModeIn FCI+AG configuration, FCI provides automatic failover, and AG provides manual failover

FCI for HA + AG for DRDeployment Considerations

Page 19: SQLCAT: SQL Server HA and DR Design Patterns, Architectures ...

Asymmetric StorageKey concept behind this architectureNew Windows Server Failover Clustering capability introduced in:

Windows Server 2008 R2 SP1Windows Server 2008 with QFE

Symmetric storage = a cluster disk that is shared between all the WSFC nodesAsymmetric storage = a cluster disk that is shared between a subset of nodes

Instance NamingEach FCI within the WSFC needs to have a different instance name

Database File Paths(recommended) use identical drive letters for the disks for each FCI(recommended) use identical file paths for data and log files for each FCI

FCI for HA + AG for DRDeployment Considerations

Page 20: SQLCAT: SQL Server HA and DR Design Patterns, Architectures ...

title

Quorum Considerations

Page 21: SQLCAT: SQL Server HA and DR Design Patterns, Architectures ...

Quorum is managed by the WSFC, irrespective of the number of SQL Server instances (FCI or standalone), number of nodes, number of availability groupsImportant goal: Design to ensure

Unavailability of the DR site, or loss of network connectivity between sites should not impact the quorum of the WSFC

Two steps:Node votes: First decide which nodes should have a voteQuorum Model: Then choose the appropriate quorum model

Node VotesBy default, every node has a vote => May not be ideal for your specific HA / DR goalsWindows Server hotfix: http://support.microsoft.com/kb/2494036Guidelines: http://msdn.microsoft.com/en-us/library/hh270280.aspx#RecommendedAdjustmentstoQuorumVotingOdd number of votes

Quorum Models: http://technet.microsoft.com/en-us/library/cc770620(v=WS.10).aspx

Quorum Considerations

Page 22: SQLCAT: SQL Server HA and DR Design Patterns, Architectures ...

Note: The Fileshare Witness always has 1 vote.

Primary Data Center Disaster Recovery Data Center

SQL ServerPrimary

SQL ServerSecondary

Windows Server Failover Cluster (single WSFC crossing two data centers)

Availability Group

SQL Server

Secondary

Synchronous

Asynchronous

File Share

Quorum Model and Node VotesAvailability Groups for HA and DR

Page 23: SQLCAT: SQL Server HA and DR Design Patterns, Architectures ...

Note: The Fileshare Witness always has 1 vote.

Quorum Model and Node VotesFCI for HA + AG for DR

Primary Data Center

SQLFCIPrimary\INST_A

Disaster Recovery Data Center

SQLFCIDR\INST_B

Synchronous / Asynchronous

Primary Secondary

Windows Server Failover Cluster

Fileshare

Availability Group

Page 24: SQLCAT: SQL Server HA and DR Design Patterns, Architectures ...

Quorum Model and Node VotesHow to set / view

To View Quorum Model

Windows Failover Cluster Manager GUIPowerShellCluster.exe

SQL Server DMVsAlwaysOn Dashboard in SSMS

To Change Quorum Model

Windows Failover Cluster Manager GUIPowerShellCluster.exe

To View Node Votes

PowerShellCluster.exe

SQL Server DMVsAlwaysOn Dashboard in SSMS

To Change Node Votes

PowerShellCluster.exe

Note: Only cluster.exe can be used to set quorum model to “Node and (asymmetric) Disk Majority” or “(asymmetric) Disk Only”

Page 25: SQLCAT: SQL Server HA and DR Design Patterns, Architectures ...

demo Monitoring HA/DR Solution

Page 26: SQLCAT: SQL Server HA and DR Design Patterns, Architectures ...

titleMigration from Earlier HA/DR Solutions

Page 27: SQLCAT: SQL Server HA and DR Design Patterns, Architectures ...

Hardware: new hardware, reuse existing hardware?Windows Server: Upgrading the OS as well?Windows Clustering: involve the Windows System Administration team and the networking team

Quorum considerations across multiple data centersCluster network communication across multiple data centers

Stages: migrate the whole configuration at once, or migrate the DR afterwards?Application connection string changeIf the secondary is a Failover Cluster Instance: needs re-seeding

Uninstall existing SQL FCI on the DR site nodesDestroy existing WSFC at the DR siteJoin DR site nodes to Windows cluster created in the primary data centerRe-install SQL FCI on DR nodesBackup database(s) from primary, and Restore on the secondary

Planning and Key Considerations

Page 28: SQLCAT: SQL Server HA and DR Design Patterns, Architectures ...

Summary

Page 29: SQLCAT: SQL Server HA and DR Design Patterns, Architectures ...

SQL Server 2012 AlwaysOn HA+DR Design Patterns

SQL Server 2012 AlwaysOn HA+DR Design Pattern Solution Characteristics

Corresponding Pre-SQL Server 2012 Solution

1 Multi-site Failover Cluster Instance (FCI) for HA and DR

• Shared Storage solution 1

• Instance Level HA (automatic)• Instance Level DR (automatic 2)• Uses storage replication• Doesn’t require database to be in FULL recovery

model1 Masked by storage replication 2 Consider 3rd data center

Multi-site FCI using stretch VLAN

2 Availability Group for HA and DR

• Non-Shared Storage solution• (Group of) Database Level HA (automatic)• (Group of) Database Level DR (manual 3)• DR replica can be Active Secondary• Requires database to be in FULL recovery model3 DR is manual, if HA is chosen automatic. Consider 3rd data center, if need automatic DR.

Database Mirroring for Local HA and Log Shipping for DR

3Failover Cluster Instance for local HA + Availability Group for DR

• Combined Shared Storage and Non-Shared Storage

• Instance Level HA (automatic)• (Group of) Database Level DR (manual)• DR replica can be Active Secondary• Requires database to be in FULL recovery model• Asymmetric storage is the key to this solution

Failover Cluster Instance for Local HA and Database Mirroring for DR

Slight variations of these design patterns are occasionally observed as well.

Page 30: SQLCAT: SQL Server HA and DR Design Patterns, Architectures ...

Friday, June 29, 10:15 AM – 11:30 AM

DBI360: SQLCAT: SQL Server 2012 AlwaysOn Lessons Learned from Early Customer DeploymentsD 204

Page 32: SQLCAT: SQL Server HA and DR Design Patterns, Architectures ...

SanjayMishra

[email protected] www.sqlcat.com

@sqlcat

Page 33: SQLCAT: SQL Server HA and DR Design Patterns, Architectures ...

Resources

Connect. Share. Discuss.http://europe.msteched.com

Learning

Microsoft Certification & Training Resourceswww.microsoft.com/learning

TechNet

Resources for IT Professionalshttp://microsoft.com/technet

Resources for Developershttp://microsoft.com/msdn

Page 34: SQLCAT: SQL Server HA and DR Design Patterns, Architectures ...

Evaluations

http://europe.msteched.com/sessions

Submit your evals online

Page 35: SQLCAT: SQL Server HA and DR Design Patterns, Architectures ...

© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to

be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS

PRESENTATION.