using sql server 2012's always on (hadr)

19
Using SQL Server 2012's Always On (HADR) Denny Cherry [email protected] twitter.com/mrdenny

Upload: baina

Post on 23-Feb-2016

33 views

Category:

Documents


0 download

DESCRIPTION

Using SQL Server 2012's Always On (HADR). Denny Cherry [email protected] twitter.com/ mrdenny. About Me. Independent Consultant Founder of SQL Excursions Author or Coauthor of 5 books 8 + SQL Mag articles Dozens of other articles Microsoft MVP Microsoft Certified Master. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Using SQL  Server 2012's  Always  On (HADR)

Using SQL Server 2012's Always On (HADR)

Denny [email protected]

twitter.com/mrdenny

Page 2: Using SQL  Server 2012's  Always  On (HADR)

2

About MeIndependent ConsultantFounder of SQL ExcursionsAuthor or Coauthor of 5 books8+ SQL Mag articlesDozens of other articlesMicrosoft MVPMicrosoft Certified Master

Page 3: Using SQL  Server 2012's  Always  On (HADR)

What is “Always On”?AKA “HADR”Combines Best of Mirroring and ClusteringCan allow for backups to be read

Page 4: Using SQL  Server 2012's  Always  On (HADR)

What Parts of Clustering?Uses the clustering APIs for failoverNo shared storage, users still connect to

normal instanceShared IP Address for Availability Group

Listener

Page 5: Using SQL  Server 2012's  Always  On (HADR)

What Parts of Mirroring?Uses Mirroring Concepts for the data

transportUses Mirroring TCP Endpoint

Page 6: Using SQL  Server 2012's  Always  On (HADR)

New Terms to KnowAvailability GroupsAvailability ReplicasAvailability Databases

Page 7: Using SQL  Server 2012's  Always  On (HADR)

Setup RequirementsAll Instances must be installed on Windows

2008 R2 Enterprise (or higher)All servers running as part of HADR much be

in a single Windows clusterSQL is not clusteredDatabases must be in full recovery

Page 8: Using SQL  Server 2012's  Always  On (HADR)

Setup NotesMultiple Databases in a single Availability

GroupIO profiles on primary and secondary are

differentPrimary only writes on checkpointSecondary writes as changes are received(The same as Legacy DB Mirroring)

All compatibility modes are supportedNo Shared StorageMatching hardware is not required

Page 9: Using SQL  Server 2012's  Always  On (HADR)

AlwaysOn – A flexible solutionAlwaysOn provides the flexibility of different HA configurations

9

Synchronous Data Movement

Asynchcronous Data Movement

Shared Storage, regional and geo secondaries

A

AA

A

A

Direct attached storage local, regional and geo target

AA

Page 10: Using SQL  Server 2012's  Always  On (HADR)

Data TransferData is transferred via Data Mirroring

EndpointEndpoints created via the Wizard

automatically if not created

Page 11: Using SQL  Server 2012's  Always  On (HADR)

Configuration Options…Management Studio

Wizard Driven SetupPowerShell

CmdLets on the next slideT/SQL

CREATE AVAILABILITY GROUP – Setup Primary

ALTER AVAILABILITY GROUP – Join Secondary

Page 12: Using SQL  Server 2012's  Always  On (HADR)

PowerShell CmdLetsSetup

New-SqlAvailabilityGroup New-SqlAvailabilityReplica Add-SqlAvailabilityGroupDatabase Join-SqlAvailabilityGroup

Breakdown Remove-SqlAvailabilityGroup Remove-SqlAvailabilityGroupDatabase

Management Suspend-SqlAvailabilityGroup Switch-SqlAvailabilityGroup

Page 13: Using SQL  Server 2012's  Always  On (HADR)

Sample PowerShell Script to Configure HADR # Setup names and TCP addresses of the primary and secondary servers. $primaryServerName = "[PrimaryServerName]"; $secondaryServerName = "[SecondaryServerName]"; $primaryEndpointUrl = "TCP://" + $primaryServerName + ".web_domain:5022"; $secondaryEndpointUrl = "TCP://" + $secondaryServerName + ".web_domain:5022";

# Next create the Availability Replicas as templates. $replica1 = new-sqlavailabilityreplica -Name $primaryServerName -EndpointUrl

$primaryEndpointUrl -AsTemplate $replica2 = new-sqlavailabilityreplica -Name $secondaryServerName -EndpointUrl

$secondaryEndpointUrl -AsTemplate

# Finally create the Availability Group. $ag = new-sqlavailabilitygroup -Name $availabilityGroupName -AvailabilityReplica

($replica1, $replica2) -Database $databases

#Tells a secondary Server to join the Availability Group Join-SqlAvailabilityGroup -Path . -Name "My Availability Group"

Sorry About th

e Eye

Chart

Sorry About th

e Eye

Chart

Page 14: Using SQL  Server 2012's  Always  On (HADR)

Failing over AlwaysOnDone via SSMS. Switch-SqlAvailabilityGroup PowerShell

CmdLetALTER AVAILABILITY GROUP in T-SQL

http://www.flickr.com/photos/criminalintent/2569906181/

Page 15: Using SQL  Server 2012's  Always  On (HADR)

What can we use AlwaysOn for?Getting a backup of the database on a remote

machineTaking a snapshot of a databaseOffloading CheckDB from production serverOffloading reporting from production serverRedundancy - Dugh

Page 16: Using SQL  Server 2012's  Always  On (HADR)

Big Selling PointsSupport for up to 5 secondary servers

Up to 3 SynchronousUp to 5 Asynchronous

Backups on the secondary serversThe ability to fail over without data lossAutomatic FailoverRead Only routing to read only servers with

just a connection string and driver change on the client

Page 17: Using SQL  Server 2012's  Always  On (HADR)

LicensingEnterprise Only FeatureIf Read Only nodes are used by users then

licensing is required

Page 18: Using SQL  Server 2012's  Always  On (HADR)

Lets see how we set this thing up

Page 19: Using SQL  Server 2012's  Always  On (HADR)

Denny [email protected]

http://itke.techtarget.com/sql-serverhttp://twitter.com/mrdenny