0% found this document useful (0 votes)
14 views

SQL Server Always On - Overview

SQL Server Always on - Overview

Uploaded by

Rofiq Ahmed
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

SQL Server Always On - Overview

SQL Server Always on - Overview

Uploaded by

Rofiq Ahmed
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

https://www.sqldbachamps.

com

SQL Server Always On is a high-availability and disaster recovery solution introduced in SQL Server 2012. It
includes two main technologies: Always On Availability Groups and Always On Failover Cluster Instances (FCIs).
Always On aims to ensure minimal downtime, protect against server failures, and maximize data availability.

Key Components of SQL Server Always On

1. Always On Availability Groups (AG)

This is the primary feature of Always On. It allows for multiple databases to be grouped together and provides
high availability for these groups. AGs offer automatic failover, manual failover, readable secondaries, and
replication across multiple locations.

- Primary Replica: The main server where all write and read transactions occur.

- Secondary Replica: One or more servers that replicate data from the primary replica. Some of these
secondaries can be configured to allow read operations (readable secondaries).

- Availability Group Listener: A virtual network name (VNN) that clients use to connect to the primary replica
without knowing the exact server hosting it. This simplifies failover because clients don’t need to change the
connection string during failovers.

Key Features:

- Multiple Databases in a Group: Always On supports failover at the level of groups of databases, making it

https://www.sqldbachamps.com
easier to manage applications that span several databases.

- Automatic and Manual Failover: Automatic failover occurs when the primary server is unavailable, with one of
the synchronous secondary replicas taking over. Manual failover can also be triggered for planned maintenance
or upgrades.

- Read-Only Secondaries: Allows offloading read workloads, such as reporting and analytics, to the secondary
replicas, reducing the load on the primary server.

- Backup from Secondary: Backups can be taken from secondary replicas, reducing the load on the primary
replica.

Availability Mode:

- Synchronous Commit Mode: The primary waits for a confirmation that the secondary has received and logged
the transaction before committing it, ensuring data consistency.

- Asynchronous Commit Mode: Transactions are committed on the primary without waiting for confirmation
from the secondary, which reduces latency but sacrifices data consistency.

https://www.sqldbachamps.com
https://www.sqldbachamps.com
2. Always On Failover Cluster Instances (FCIs)

Always On FCIs build on Windows Server Failover Clustering (WSFC) technology and provide instance-level
protection. Unlike Availability Groups, FCIs involve shared storage between the nodes in the cluster, where only
one node runs the SQL Server instance at a time, but all nodes have access to the same storage.

- Shared Storage: In an FCI setup, the underlying storage is shared between all nodes. This ensures that the
same data is accessible regardless of which node is active.

- Instance-Level Failover: If the active node fails, another node in the cluster takes over the SQL Server
instance, ensuring high availability for the entire instance.

Comparison Between AG and FCI:

- Granularity: Availability Groups operate at the database level, while Failover Clustering operates at the
instance level.

- Storage: Availability Groups don't require shared storage (the databases are replicated across different storage
devices), while FCIs require shared storage.

SQL Server Always On Architecture

1. Primary and Secondary Replicas

https://www.sqldbachamps.com
- Primary Replica: Handles the main production workload (read-write).

- Secondary Replica(s): Provides read-only access and serves as a backup for automatic failover. There can be
up to eight secondary replicas, and out of those, three can be synchronous commit replicas.

2. Quorum

- SQL Server Always On relies on a quorum in the Windows Server Failover Clustering (WSFC) model to manage
failover decisions. The quorum ensures that the cluster has a consensus on the health of the nodes. If the
number of nodes in the quorum drops below the required threshold, the cluster stops functioning to avoid
"split-brain" scenarios (where two nodes act as primary simultaneously).

3. Failover Types

- Automatic Failover: A synchronous secondary replica automatically takes over when the primary fails,
ensuring minimal downtime.

- Manual Failover: Administrators can manually initiate a failover, often used during planned maintenance.

- Forced Failover: This occurs in asynchronous mode when there’s no guarantee that the secondary replica has
all the transactions from the primary, risking potential data loss.

https://www.sqldbachamps.com
https://www.sqldbachamps.com
Always On Availability Group Configuration Steps

1. Prerequisites:

- Set up a Windows Server Failover Cluster (WSFC).

- SQL Server Enterprise Edition is required for Always On Availability Groups.

2. Configure Always On:

- Enable Always On from the SQL Server Configuration Manager.

- Create an Availability Group by selecting the databases to include, configuring replicas, and setting up the
Availability Group Listener for seamless client redirection.

3. Set Replication Mode:

- Choose between synchronous or asynchronous replication modes depending on your needs for data
consistency vs. performance.

4. Add Listeners:

- Configure the listener, which acts as a single point of entry for applications, simplifying connection
management during failovers.

5. Monitor Health:

https://www.sqldbachamps.com
- Use SQL Server Management Studio (SSMS) or SQL Server Data Tools to monitor the health of the
Availability Group and replicas.

SQL Server Always On Scenarios

- High Availability (HA): In scenarios where high availability is crucial, AGs provide seamless failover and allow
readable secondary replicas to offload read operations, such as reporting and analytics.

- Disaster Recovery (DR): In disaster recovery configurations, secondary replicas are often located in different
geographic regions. In the case of a site failure, the secondary replica in the remote site can take over.

- Hybrid Environments: SQL Server Always On can be deployed in hybrid cloud environments, combining
on-premises servers with cloud-based secondary replicas in services like Microsoft Azure or Amazon AWS.

https://www.sqldbachamps.com
https://www.sqldbachamps.com
Advantages of SQL Server Always On

- Minimized Downtime: Always On ensures that your databases are available even in the case of server or data
center failures.

- Enhanced Read Performance: By offloading read operations to secondary replicas, Always On reduces the
load on the primary replica and enhances performance for read-heavy workloads.

- No Shared Storage Dependency: Always On Availability Groups don’t require shared storage like traditional
failover clustering, making them more flexible and cloud-friendly.

- Automatic and Manual Failover: Provides options for automatic failover, manual failover, or planned failover
during maintenance.

- Granular Control: Supports database-level failover, as opposed to instance-level failover in Failover Cluster
Instances.

Limitations of SQL Server Always On

- Cost: Always On requires SQL Server Enterprise Edition, which can be cost-prohibitive for some organizations.

- Complex Configuration: Setting up Always On involves configuring Windows Server Failover Clustering,
networking, and SQL Server. This requires advanced technical expertise.

- Licensing: Each SQL Server replica requires a separate SQL Server license, which increases the overall cost.

https://www.sqldbachamps.com
Conclusion

SQL Server Always On is a robust solution for achieving high availability and disaster recovery. It allows you to
create highly available, readable secondary replicas, and failover clusters. While it requires careful planning and
setup, Always On Availability Groups can significantly improve the availability of SQL Server databases in both
on-premises and cloud environments.

Always On is suitable for mission-critical applications, offering high levels of protection and performance tuning
through read-only secondaries and flexible failover policies.

https://www.sqldbachamps.com

You might also like