SQL 2017 Alwayson Ag Win Linux 10072017
SQL 2017 Alwayson Ag Win Linux 10072017
Unplanned Downtime
• Datacenter failure
• Server failure
• I/O subsystem failure
• Human error
• Possible data loss
Understanding Disaster Recovery
Two Principle Requirements for HA and DR
▪ Recovery Time Objective (RTO) - The maximum allowable downtime
when a failure occurs
▪ Recovery Point Objective (RPO) - The maximum allowable data-loss
when a failure occurs
a). Failover Cluster in Azure, b). Branch Office Clusters, c). Multi-site Clusters
Virtual Network
Fabric Switches Name
A
Primary Secondary A Secondary A Secondary Secondary
A A
Replica Replica 1 Replica 2 Replica 3 Replica 8
….
Requires ‘Windows
Management
Instrumentation (ASync-In)’
or Enable-SQLAlwaysOn Windows PowerShell cmdlet Firewall rule to be enabled
Availability Groups in SQL Server 2014
▪ Increased Number of Secondaries
▪ SQL 2014 increased to 8 replicas
▪ Additional Diagnostic Capabilities (fn_hadr* function, cluster DMVs)
▪ Increased Readable Secondaries Availability
Reduced the events which caused the readable secondaries
to be unavailable
▪ Add Azure Replica Wizard
Simple end-to-end solution for deploying replicas to Azure VMs
First step to improved deployment experiences
Available via T-SQL, but currently removed from SSMS
Synchronous-Commit
• High availability over performance at the cost of increased
transaction latency
Different ways to Create Availability Groups
SQL Server Management Studio
▪ Availability Group Wizard AlwaysOn_health
session may not be
▪ Availability Group Dialog Box automatically
started, If AG is not
created using the AG
T-SQL Wizard
PowerShell
22
Demo
io_subsystem and
5 events are leveraged
for diagnostic
Components purposes only
Failure Condition Levels
Note: Damaged databases and suspect databases are not detected by any failure-condition level.
Therefore, a database that is damaged or suspect (whether due to a hardware failure, data corruption,
or other issue) never triggers an automatic failover.
Demo
Replica
health
Hidden
columns
Database
health
System Views
• System catalog views
• View system configuration
• Dynamic Management Views (DMVs) and Functions
• View current state and health information
Performance Monitor
SQL Server: SQL Server: SQL Server:
Availability Replica Database Replica Databases
Test-SQLAvailabilityReplica
Test-SQLDatabaseReplicaState
Demo
Secondary
Secondary Replica 2 A Primary
A
Replica 3 Replica
A A
Secondary
A
Replica 4
Secondary A
Replica 1 Windows
Azure
Reports
Secondary
Replica 5
Reports
Reports
Database Level Failover • If a DB goes offline you will be able to initiate failover for the AG
Basic Availability Group • An option for Standard Edition customers in SQL Server 2016
AlwaysOn AG Automatic Seeding
▪ Automatically create the database replica on the secondary server
▪ SQL Server performs a backup over the network for initialization
▪ Process can be slow if databases are very large, or the replica(s) are remote
▪ The transaction log for these databases cannot be truncated during the backup
process
▪ Create new or enable on an Existing AG
ALTER AVAILABILITY GROUP [<availability_group_name>]
Enable
MODIFY REPLICA ON '<primary_node>' WITH (SEEDING_MODE = AUTOMATIC)Trace Flag 9567
GO for data stream
▪ compression
Query sys.dm_hadr_automatic_seeding system view to monitor the seeding progress
SELECT start_time, completion_time, is_source, current_state,
failure_state, failure_state_desc, error_code
FROM sys.dm_hadr_automatic_seeding
AlwaysOn Availability Groups
and Replicas
What is Read-Only Routing?
▪ Facilitates automatic redirect of read workloads
▪ Increases availability for read workloads
▪ Minimizes contention on Primary Replica
▪ Requires Listener and ApplicationIntent property
Windows Server Failover Cluster
AA Secondary Replica
A Secondary Replica
Primary Replica Primary Replica
CRASH
Reports Reports
▪ READ_ONLY_ROUTING_LIST =
((‘COMPUTER2’, ’COMPUTER3’, ’COMPUTER4’), ’COMPUTER5’)
Readable Secondary Load Balancing
Computer 1
Computer 5
(Primary)
Computer 3
Computer 4
Demo
DR / Migration /
Testing
Availability Group
Read Scale-Out
Scenario Solution
▪ SaaS app (website) ▪ Read scale with availability groups
▪ Catalog database with high volume of ▪ No cluster required
concurrent read-only transactions ▪ Both Windows and Linux support
▪ Bottlenecks on primary due to read
workloads
P
▪ Increased response time S3
S1
Note: R/W
▪ A single distributed availability
group can have up to 17 readable
secondary replicas S2
S4
▪ Daisy Chain is supported
Local Reads
Scale with Distributed Availability Groups
Primary
Asynch Log
Synchronization
AG2
https://docs.microsoft.com/en-us/sql/database-
Always On Availability engine/availability-groups/windows/always-on-availability-
Groups (SQL Server) groups-sql-server
Thank you!
Save the Date! www.SQLintersection.com
2018
Mar 25-28
We’re back in Orlando!
Leave the every day behind and enter a world of wonder and enchantment at the Walt Disney World® Resort.
Located in the heart of the most magical place on earth, the Walt Disney World Swan and Dolphin Resort
provides a truly extraordinary backdrop for our event! Beautiful tropical landscaping, tranquil waterways,
and classic art and architecture work together to create a stunning landmark!