Date: 27th March 2013
Topic: SQL Server 2012 AlwaysOn!
Speaker: Harminder Singh Sethi (Microsoft PFE)
Session Synopsis:
SQL Server AlwaysOn is the new comprehensive high availability and disaster recovery solution in SQL Server 2012. Using AlwaysOn, you can increase application availability and get a better return on your hardware investments through a simplified high availability (HA) deployment and management experience. SQL Server AlwaysOn provides availability at either the application database or instance level.
Topics discussed:
1) HA & DR solutions available in SQL Server 2008 R2 & before
- Failover Clustering
- Database Mirroring
- Log Shipping
- Replication
2) Limitations with existing HA and DR solutions
- Solutions are fragmented
- Database mirroring does not allow multiple secondary’s
- Multiple databases cannot fail over as a group
- Log shipping might lose data and does not fail over automatically
- Passive servers are mostly running idle
- Offloading of reporting and maintenance tasks from the primary server is not easy
- SAN is a single point of failure in failover clustering
- Peer-to-peer transactional replication does not automatically detect a failure or automatically fail over
3) Introduction to AlwaysOn
SQL Server 2012 AlwaysOn provides flexible design choices for selecting an appropriate high availability and disaster recovery solution for your application. SQL Server AlwaysOn was developed for applications that require high uptime, need protection against failures within a data center (high availability) and adequate redundancy against data center failures (disaster recovery). http://msdn.microsoft.com/en-us/sqlserver/gg490638 provides an overview of high availability and disaster recovery solutions available in SQL Server 2012 AlwaysOn.
Through working with customers who are evaluating and deploying SQL Server 2012 AlwaysOn currently, we have seen the following design patterns emerge as end-to-end HA+DR solution:
- Using Availability Groups (AG) for local high availability and disaster recovery solution
- Using Failover Cluster Instance (FCI) for local high availability, and Availability Groups (AG) for disaster recovery solution
- Using Multi-site Failover Cluster Instance (FCI) for local high availability and disaster recovery solution
4) SQL Server 2012 AlwaysOn FCI enhancements
- Flexible failover policy
- Improved diagnostics (Exec SP_Server_Diagnostics)
- Support for TempDB on local disk
- Better mount-point support
- Reduced planned downtime
- SMB protocol support
- Multi-subnet clustering
5) SQL Server 2012 AlwaysOn AG (Availability Groups) Architecture & Design
New enterprise-level solution for high availability and disaster recovery. Availability groups maximize the availability of one or more user databases.
- Automatic Failover via WSFC. SQL Server AlwaysOn uses WSFC to perform health detection and automatic failover to an available secondary copy of the databases. The unit of failover is a WSFC resource group.
- Multi-Subnet Clustering. Built on Windows Server 2008 clustering, availability groups can use geographically dispersed clusters and can span Windows Server cluster nodes that are in separate subnets.
- Multiple Secondaries (up to four). Availability groups can synchronize up to four secondary SQL Server instances. Each copy of the database is called a replica. You can have a total five replicas (one primary and four secondaries).
- Maximum 10 AG Groups with 10 Databases each per SQL Server Instance is supported
Terminologies used:
- Availability Replicas (primary Replica & Secondary Replicas): Every copy is called a replica
- Availability Group (containers): Unit of high availability
- Availability Group Listener: Defines the endpoint where clients can connect to the instance
Data-Synchronization Modes and Failover
- Synchronous-commit mode with automatic failover: No data loss
- Synchronous-commit mode with manual failover: No data loss
- Asynchronous-commit mode: High performance, Possible Data Loss
6) SQL Server 2012 AlwaysOn Setup & Manageability
- Follow the Prerequisites,
Restrictions, and Recommendations for AlwaysOn Availability Groups http://msdn.microsoft.com/en-sg/library/ff878487.aspx - Enable AlwaysOn Availability Groups. The AlwaysOn Availability Groups feature must be enabled on every instance of SQL Server 2012 that is to participate in an availability group. Enable and Disable AlwaysOn Availability Groups: http://msdn.microsoft.com/en-us/library/ff878259.aspx
- Use the New Availability Group Wizard from SQL Server Management Studio to create AlwaysOn AG http://msdn.microsoft.com/en-us/library/hh403415
7) SQL Server 2012 AlwaysOn Benefits & usage of secondary replicas
Secondary Replica DB can be in below different states:
- Read-Only Mode: Open for Read Queries
- None: Offline, not accessible
- Read-Intent: Applications can specify the purpose of the connection through a new property of the connection string called Application Intent. This property specifies whether the connection is directed to a read-write or a read-only version of the availability-group database. The value of the property is stored in the client’s session during login. SQL Server then determines which database to connect to, according to the configuration of the availability group and the current state of the database in the secondary replica.
Other Benefits:
- Backups can be offload to secondary Replicas
- Offloading read-only resource-intensive queries to secondary replicas
- Reporting can be offloaded to secondary replicas
For details on the above listed topics discussed during the session, follow below links:
- SQL Server 2012 AlwaysOn High Availability and Disaster Recovery Design Patterns
http://sqlcat.com/sqlcat/b/msdnmirror/archive/2011/12/22/sql-server-2012-alwayson-high-availability-and-disaster-recovery-design-patterns.aspx - Prerequisites, Restrictions, and Recommendations for AlwaysOn Availability Groups
http://msdn.microsoft.com/en-sg/library/ff878487.aspx - Overview of AlwaysOn Availability Groups
http://msdn.microsoft.com/en-us/library/ff877884.aspx - Configuration of a Server Instance for AlwaysOn Availability Groups
http://msdn.microsoft.com/en-us/library/hh510260.aspx - Active Secondaries: Readable Secondary Replicas
http://msdn.microsoft.com/en-us/library/ff878253.aspx - Active Secondaries: Backup on Secondary Replicas
http://msdn.microsoft.com/en-us/library/hh245119.aspx