roger breu@rogerbreu technology solution professional dataplatform microsoft corporation sql server...
TRANSCRIPT
Roger Breu @rogerbreuTechnology Solution Professional DataPlatformMicrosoft Corporation
SQL Server 2012AlwaysOn Availability Groups
What is an Availability Group?Availability Group Setup Step by StepActive SecondariesTuning and MonitoringQ&A
Agenda
SQL Server 2012 AlwaysOn Availability Groups
What is an Availability Group?
HA/DR Features beforeFailover Clusterin
gVirtual Networkname
(transparent)
Multidatabase failover
Shared storage needed
No active secondaries available
DR only with Storage Replication or additional Logshipping/ Database
Mirroring
Database Mirroring
Fast Failover
No Shared Storage needed
Application has to be “mirroring-aware” (SNAC or connectstring modification)
No virtual network name to connect
Only 1 active secondary with database snapshots on
the mirror
Log Shipping
Multiple Secondaries
No Shared Storage needed
Needs good monitoring
No automatic failover
Secondaries offline while applying transactionlog
backups
... List is not complete, Replication only for Table Level HA...
AlwaysOn Availability Groups is a new feature that enhances and combines failover cluster, database mirroring and log shipping capabilities
AlwaysOn Availability Groups
Multi-database failoverMultiple secondaries
Total of 4 secondaries2 synchronous secondaries
1 automatic failover pairSynchronous and asynchronous data movementBuilt in compression and encryptionFlexible failover policyAutomatic Page Repair
Application failover using virtual nameConfiguration WizardDashboardSystem Center IntegrationRich diagnostic infrastructureFile-stream replicationReplication publisher failover
Flexible Integrated Efficient
Active SecondaryReadable SecondaryBackup from SecondaryAutomation using power-shell
Availability Group Scenarios
Synchronous Data Movement
Asynchcronous Data Movement
AG AG
AG
AG
AG
Direct Attached Storagelocal, regional and geo secondaries
ExamplePrimary in CalgaryFailover Partner in VancouverSync DR in Toronto
Async Secondary in Montreal (Reporting)Async Secondary in London (Geo DR)
Availability Group Scenarios
Synchronous Data Movement
Asynchcronous Data Movement
Shared Storagelocal, regional and geo secondaries
mixed with Direct Attached Storage
ExamplePrimary Failover Cluster in CalgarySync Secondary Failover Cluster in Vancouver
AG
AG
Async DR Standalone Server in Toronto
AG
«Container»1 or more DatabasesListener (aka virtual networkname)
1 or more IP Addresses (DHCP or fix, aka virtual IP)
Replica DefinitionPrimary/SecondariesAutomatic Failover PartnerSync/Async Secondaries
The Availability GroupDB
DBDB
AG
AG_VNN
AG_IP
Availability Group Architecture
Availability Group uses Windows Server Failover Cluster (WSFC) for
Inter-node health detection Failover coordinationPrimary health detection Distributed data store for Availability Group settings and state Distributed change notifications
Windows Server Failover Cluster
DatabaseActive Log Synchronization
DatabaseActive Log Synchronization
SQL Server synchronizes databases
Based on Transaction LogVia TCP EndpointSynchronous or asynchronousCompressed LogstreamEncrypted Logstrem
DBDB
DBDB
DBDB
AG
AG_VNN
AG_IP
SQL Server 2012 AlwaysOn Availability Groups
Availability Group Setup Step by Step
Windows Server 2008/2008 R2Failover Cluster Feature installedWindows Server Failover Cluster created
Needs Cluster Networkname and IP AddressNo Shared Storage neededQuorum can be configured with Fileshare Witness
OS Requirements
SQL Server 2012Installed as Standalone (or SQL Server Failover Cluster*) Instance on every Windows Server Failover Cluster Node
Can be named or default instanceInstance names don’t have to be the sameAll Nodes have to be part of the same Windows Server Failover ClusterAll Instances must use the same collationDomain Service Account
AlwaysOn Availability Groups feature enabled via SQL Server Service Configuration Manager
SQL Server Requirements
Each availability group name must be unique on the WSFC clusterFor a given availability group, the availability replicas must be hosted by server instances running on different nodes of the same WSFC cluster# of availability groups on a given server instance is unlimited
Recommended maximum is ten availability groups per instance
# of database in a given availability group is unlimited
Recommended maximum is 100 databases per availability group
Availability Group Requirements
Must be a user databaseSystem databases cannot belong to an availability group
Must be a read-write databaseRead-only databases cannot be added to an availability group
Must be a multi-user databaseNot use AUTO_CLOSEUse the full recovery modelPossess a full database backupReside on the SQL Server instance where you are creating the availability group and be accessible to the server instanceNot belong to another availability groupNot be configured for database mirroring
Database Requirements
Setup Windows Server Failover Cluster NodesConfigure WSFCSetup SQL Server Instances
Same collationRecommended to configure same DB/Tlog File pathes
Enable AlwaysOn Availability Groups via SQL Server Service Configuration Manager
Instance restart neededStart deploying Availability Groups
Checklist
Application reconnects using a virtual name (listener) after a failover to a secondary
Primary Secondary
-server Techdays1
Application retry during failover Connect to new primary
once failover is complete and the listener is online
Primary SecondarySecondary
CALGARY VANCOUVER TORONTO
Demo Scenario – Application Failover
DB1
DB2 DB
1
DB2
DB1
DB2
TechdaysAG1
Techdays1 (VNN)
AG_IP
WSFC DENALIWINCLU1
Via SQL Server Management StudioExpand the Management node, the AlwaysOn High Availability node, and the Availability Groups node. Right-click the availability group to be failed over, and select the Failover command.
Via T-SQLALTER AVAILABILITY GROUP TechdaysAG1 FORCE_FAILOVER_ALLOW_DATA_LOSS;
Via PowerShellSwitch-SqlAvailabilityGroup -Path SQLSERVER:\SQL\secondarymachine\secondaryinstance\AvailabilityGroups\TechdaysAG1 -AllowDataLoss
Via Failover Cluster Manager
Initiate a failover
Introducing Contained Databases or CDB’s
Unit of application programmability in DenaliA DB which establishes a boundary between application and server
CDBs sever the user–login relationship
Windows users no longer need matching loginsUsers with passwords replace SQL logins
What about Server Objects?
CDB can be part of an availability group and can failover across replicasAuthentication information moves with the CDBLimitation
Other objects, like jobs are not contained and have to be managed
SQL Server 2012 AlwaysOn Availability Groups
Active Secondaries
AlwaysOn Active Secondary
IT efficiency and cost-effectiveness is critical for businesses
Idle hardware is not an option anymore
AlwaysOn Active Secondary enables efficient utilization of high availability hardware resources thereby improving overall IT efficiencyActive Secondary can be utilized for
Balancing read-only workloadsOffloading Backup Operations
Read-Only client connection behavior determined by Availability Replica Option+ ApplicationIntent Property
ApplicationIntent is a connection property Replica option determines whether a replica is enabled for read access when in a secondary role
Read-Only Routing enables redirection of client connection to new secondary on role change
Enable seamless redirection of application connection across replicas without manual interventionConfiguration with Read-Only Routing Lists
Read-Only Client Connectivity
Readable secondary allows offloading read queries to secondaryAutomatic redirect with Routing Lists or manual connect to Secondary
Primary Secondary
-server Techdays1Application retry during failover Connect to new
primary/new secondary once failover is complete and the listener is online
Primary SecondarySecondary
CALGARY VANCOUVER TORONTO
Demo Scenario – Active Secondary
DB1
DB2 DB
1
DB2
DB1
DB2
TechdaysAG1
Techdays1 (VNN)
AG_IP
Reports
-server Techdays1; ApplicationIntent=ReadOnly
WSFC DENALIWINCLU1
DB1 Data
Log Cache
Log Cache
Close to real-time reads
Log is first hardened and then applied Redo thread is asynchronous and runs in the background
Latency (typically seconds) can be larger for log intensive operations like bulk import or index create/rebuildSync Replica minimizes latency due to network issues
DB1
DB1 Log
DB1
Primary SecondaryLog
Capture Log Recieve
DB1 Data
Network
Redo Thread
Redo Pages
DB1 Log
Page Updated
Log HardenLog Flush
Commit
Acknowledge Commit
Log Pool
Backups can be done on any replica of a database (Full WITH COPY_ONLY or Tlog)
Backups on primary replica still works
Log backups done on all replicas form a single log chain
Database Recovery Advisor makes restores simple
Enabling Backup On Secondary
R/W workload
Primary
Backups
Secondary
Backups
Secondary
Backups
SQL Server 2012 AlwaysOn Availability Groups
Tuning and Monitoring
All the availability replicas should run on comparable systems that can handle identical workloadsFor best performance, use a dedicated network adapter for AlwaysOn Availability Groups (LogStream)Every computer on which a server instance hosts an availability replica must possess sufficient disk space for all the databases in the availability group
Keep in mind that as primary databases grow, their corresponding secondary databases grow the same amount
For the New Availability Group wizard to automatically start initial data synchronization, every secondary database must use the same file path as its corresponding primary database
If you add a file to a primary database, secondary replica(s) will be able to add the new file on the corresponding secondary database(s)
Fine Tuning/Tipps
Make sure, WSFC network name has „add workstation to domain“ rights otherwise it will only add up to 10 VNNsFailover Cluster Failure Threshold should be adjusted for Test-runs
In the Failover Cluster Management snap-in navigation pane, expand one of the managed clusters that has a highly available application or service configured.Expand the Services and Applications category.Select and then right-click one of the groups, and then click Properties.Click the Failover tab, and then view the Maximum failures in the specified period setting
TraceFlag 9532 needed for all SQL Server 2012 CTP3 instances to allow more than one replica
Configuration via SQL Server Configuration Manager on every nodeAdd T9532 on the startup tabWon’t be necessary with RTM Bits
Fine Tuning/Tipps
Please consult following KB article for configuration and download Hotfix
http://support.microsoft.com/kb/2494036/en-us http://msdn.microsoft.com/en-us/library/hh270279(v=SQL.110).aspxCluster.exe DENALIWINCLU1 node TORONTO /prop NodeWeight=0
Remove the DR side vote so that a network interruption doesn’t affect the servers running on the main site for HA
Node weight Quorum Settings
WSFC Service
SQL Server Failover Cluster
Instance
AG Res DLL
IsAlive /LooksAliveWSFC asks Res DLL if SQL AG alive
exec sp_server_diagnostics
Diagnostics generated for Health State Components• System• Resource• Query Processing• IO Subsystem • Events
Diagnostics
User sets new Cluster propertiesHealthCheckTimeout and FailureConditionLevel
IsAlive/ LooksAlive result based on diagnostics and FailureConditionLevel
FailureConditionLevel (0 to 5)5 – Failover or restart on any qualified failure4 – Failover or restart on moderate SQL Server
errors3 – Failover or restart on critical SQL Server errors2 – Failover or restart on SQL Server unresponsive1 – Failover or restart on SQL Server down0 – No Automatic Failover or restart
Flexible Failover Policy
Availability Group Dashboard in Management StudioMonitoring will be fully integrated into the SQL Server 2012 Management Pack for SCOM
Including Database Mirroring Monitoring and Replication Monitoring for SQL Server 2008 R2
Lots of new DMVs:http://msdn.microsoft.com/en-us/library/ff878305(v=SQL.110).aspx
Availability Group Monitoring
Virtualization provides best consolidation isolationVirtualization without AlwaysOn:
Simplest management story for limited HA/DR:
When to use AlwaysOn for the guest:Need better HA/DR protection than standalone VM
Virtualization with AlwaysOn
Planned Unplanned
Host Live Migration VM failover (OS restart, Quick Migration)
Guest Downtime during patch
No protection from virtualization
SQL Server 2012 AlwaysOn Availability Groups
Conclusion
SQL Server AlwaysOn Availability Groups is a comprehensive high availability and disaster recovery solution
IntegratedFlexibleCost-Efficient
«Classical» Failover Clustering, Database Mirroring and Log Shipping are not dead
A combination of all solutions can bring you to meet your SLAs
Conclusion
SQL Server 2012 AlwaysOn Availability Groups
Additional Resources
SQL Server 2012 Developer Training Kithttp://www.microsoft.com/download/en/details.aspx?displaylang=en&id=27721
SQL Server 2012 CTP3 Product Guidehttp://www.microsoft.com/download/en/details.aspx?id=27069
swissSQL Bloghttp://blogs.technet.com/swissSQL
AlwaysOn Resource Centerhttp://msdn.microsoft.com/en-us/sqlserver/gg490638(en-us,MSDN.10)
AlwaysOn Availability Group Prerequisiteshttp://msdn.microsoft.com/en-us/library/ff878487(v=SQL.110).aspx
AlwaysOn Availability Groups together with SQL Server Failover Cluster Instance
http://msdn.microsoft.com/en-us/library/ff929171(v=SQL.110).aspx
Links
Please help us make TechDays even better by Evaluating this Session. Thank you!
Give us your feedback!
© 2011 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.