HA/DR options with SQL Server in Azure and hybrid

28
James Serra HA/DR options with SQL Server in Azure and hybrid

Transcript of HA/DR options with SQL Server in Azure and hybrid

Page 1: HA/DR options with SQL Server in Azure and hybrid

James Serra

HA/DR options with SQL Server in Azure and hybrid

Page 2: HA/DR options with SQL Server in Azure and hybrid

About Me Microsoft, Big Data Evangelist In IT for 30 years, worked on many BI and DW projects Worked as desktop/web/database developer, DBA, BI and DW architect and

developer, MDM architect, PDW/APS developer Been perm employee, contractor, consultant, business owner Presenter at PASS Business Analytics Conference, PASS Summit, Enterprise Data

World conference Certifications: MCSE: Data Platform, Business Intelligence; MS: Architecting

Microsoft Azure Solutions, Design and Implement Big Data Analytics Solutions, Design and Implement Cloud Data Platform Solutions

Blog at JamesSerra.com Former SQL Server MVP Author of book “Reporting with Microsoft SQL Server 2012”

Page 3: HA/DR options with SQL Server in Azure and hybrid

Agenda VM storage Always On AG Always On FCI Basic Availability Groups Database Mirroring Log Shipping Backup to Azure SQL Server data files in Azure Azure Site Recovery Azure VM Availability Set Azure SQL Data Sync

Page 4: HA/DR options with SQL Server in Azure and hybrid

Virtual Machine storage architecture

C:\OS disk (127 GB)

Usually 115 GB free

E:\, F:\, etc.Data disks (1 TB)Attach SSD/HDD up to 1TB.

These are .vhd files

D:\Temporary disk

(Contents can be lost)

SSD/HDD and size depends on VM chosenDisk Cache

Azure Blob storage

Page 5: HA/DR options with SQL Server in Azure and hybrid

Azure Default Blob Storage Azure Storage Page Blobs, 3 copies Storage high durability built-in

(like have RAID) VHD disks, up to 1 TB per disk (64 TB

total)

Page 6: HA/DR options with SQL Server in Azure and hybrid

Geo-storage replication 3 copies locally, another 3 copies in

different region Disable for SQL Server VM disk

(consistent write order across multiple disks is not guaranteed). Instead use DR techniques in this deck

Defend against regional disasters

Geo replication

Page 7: HA/DR options with SQL Server in Azure and hybrid

HA/DR deployment architecturesAlways On

Failover Cluster

Instances (FCI)

Always On Availability

Groups

Database Mirroring

Log Shipping Backup to Azure (blob

storage)

Azure Site Recovery

(ASR)Azure Only Availability replicas running across multiple datacenters in Azure VMs for disaster recovery.Cross-region solution protects against complete site outage.Hybrid Some availability replicas running in Azure VMs and other replicas running on-premises for cross-site disaster recovery.

HA only, not DR FCI on a two-node WSFC running in Azure VMs with storage supported by a third-party clustering solution.FCI on a two-node WSFC running in Azure VMs with remote iSCSI Target shared block storage via ExpressRoute.

Azure OnlyPrincipal and mirror and servers running in different datacenters for disaster recovery. Principal, Mirror, and Witness run within same Azure data center, deployed using a DC or server certificates for HA.HybridOne partner running in an Azure VM and the other running on-premises for cross-site disaster recovery using server certificates.

For DR only / Hybrid onlyOne server running in an Azure VM and the other running on-premises for cross-site disaster recovery.Log shipping depends on Windows file sharing, so a VPN connection between the Azure virtual network and the on-premises network is required.Requires AD deployment on DR site.

On-prem or Azure production databases backed up directly to Azure blob storage for disaster recovery.

SQL 2016: Backup to Azure with file snapshots

Simpler BCDR storySite Recovery makes it easy to handle replication, failover and recovery for your on-premises workloads and applications (not data!).Flexible replication You can replicate on-premises servers, Hyper-V virtual machines, and VMware virtual machines. Eliminate the need for secondary

SQL Server data files in

AzureNative support for SQL Server data files stored as Azure blobs

Page 8: HA/DR options with SQL Server in Azure and hybrid

HA/DR Defined• High Availability (HA) – Keeping your database up 100% of the time

with no data loss during common problems. Redundancy at system level, focus on failover, addresses single predictable failure, focus is on technology• Always On FCI• Always On AG• SQL Server data files in Azure

• Disaster Recovery (DR) – Protection if major disaster or unusual failure wipes out your database. Use of alternate site, focus on re-establishing services, addresses multiple failures, includes people and processes to execute recovery. Usually includes HA• Log Shipping• Database Mirroring• Always On AG• Backup to Azure

Page 9: HA/DR options with SQL Server in Azure and hybrid

RPO/RTORTO – Recover Time Objective. How much time after a failure until we have to be up and running again?RPO – Recover Point Objective. How much data can we lose?• HA – High Availability• RTO: seconds to minutes• RPO: Zero to seconds• Automatic failover• Well tested (maybe with each patch or

release)• DR – Disaster Recovery• RTO: minutes to hours• RPO: seconds to minutes • Manual failover into prepared

environment• Tested from time to time

How long does it take to fail over:• Backup-Restore: Hours• Log Shipping: Minutes• Always On FCI: Seconds to

minutes• Always On AG/Mirroring:

Seconds

Page 10: HA/DR options with SQL Server in Azure and hybrid

Always On Availability GroupsAlways On Availability

GroupsAzure Only Availability replicas running across multiple datacenters in Azure VMs for disaster recovery.Cross-region solution protects against complete site outage.

HybridSome availability replicas running in Azure VMs and other replicas running on-premises for cross-site disaster recovery.

Availability replicas running across multiple datacenters in Azure VMs for disaster recovery. This cross-region solution protects against complete site outage. Within a region, all replicas should be within the same cloud service and the same VNet. Because each region will have a separate VNet, these solutions require VNet to VNet connectivity. For more information, see Configure a Site-to-Site VPN in the Azure classic portal.

NOTE: US East should show a FSW.

All availability replicas running in Azure VMs for high availability within the same region. You need to configure a domain controller VM, because Windows Server Failover Clustering (WSFC) requires an Active Directory domain.For more information, see Configure Always On Availability Groups in Azure (GUI).With Windows Server 2016 replicas, you can use a Cloud Witness instead of a File Share Witness (FSW). A WSFC always requires a FSW to handle quorum (and Always On Availability Groups require WSFC).

Page 11: HA/DR options with SQL Server in Azure and hybrid

Always On Availability Groups (Hybrid)Always On Availability

GroupsAzure Only Availability replicas running across multiple datacenters in Azure VMs for disaster recovery.Cross-region solution protects against complete site outage.

HybridSome availability replicas running in Azure VMs and other replicas running on-premises for cross-site disaster recovery.

Some availability replicas running in Azure VMs and other replicas running on-premises for cross-site disaster recovery. The production site can be either on-premises or in an Azure datacenter.

Because all availability replicas must be in the same WSFC cluster, the WSFC cluster must span both networks (a multi-subnet WSFC cluster). This configuration requires a VPN connection between Azure and the on-premises network.

For successful disaster recovery of your databases, you should also install a replica domain controller at the disaster recovery site.

It is possible to use the Add Replica Wizard in SSMS to add an Azure replica to an existing Always On Availability Group. For more information, see Tutorial: Extend your Always On Availability Group to Azure.

Page 12: HA/DR options with SQL Server in Azure and hybrid

Microsoft Azure VMs – HA & DRAlways On between Azure Regions• Configure Always On between VMs in different geographic regions (asynchronous)• Over secure tunnel

• Manual Failover (~15 seconds) in case of a regional failure• Test it at any time

• Use closest secondary for read workloads• Region 1: AG used instead

of FCI (AG is synchronous)

Page 13: HA/DR options with SQL Server in Azure and hybrid

Always On Failover Cluster Instances (FCI)

An FCI on a two-node WSFC running in Azure VMs with remote iSCSI Target shared block storage via ExpressRoute. For example, NetApp Private Storage (NPS) exposes an iSCSI target via ExpressRoute with Equinix to Azure VMs.

For third-party shared storage and data replication solutions, you should contact the vendor for any issues related to accessing data on failover.

Note that using FCI on top of Azure File storage is not supported yet, because this solution does not utilize Premium Storage. We are working to support this soon.

Always On Failover Cluster

Instances (FCI)HA only, not DR

FCI on a two-node WSFC running in Azure VMs with storage supported by a third-party clustering solution.

FCI on a two-node WSFC running in Azure VMs with remote iSCSI Target shared block storage via ExpressRoute.

You can use FCI to host an availability replica for an availability group

FCI on a two-node WSFC running in Azure VMs with storage supported by a third-party clustering solution.

Page 14: HA/DR options with SQL Server in Azure and hybrid

Always On FCI vs Always On AG

AG: Can have two synchronous secondary replicas. One can serve as automatic failover partner (two in SQL 2016)

Page 15: HA/DR options with SQL Server in Azure and hybrid

SQL Server 2016 Editions

Page 16: HA/DR options with SQL Server in Azure and hybrid

Basic Availability GroupsBasic Availability Groups replaces the deprecated Database Mirroring feature, providing a similar level of features and is used for SQL Server 2016 Standard Edition (normal Availability Groups requires Enterprise Edition).

Limitations:

• Limit of two replicas (primary and secondary)• No read access on secondary replica• No backups on secondary replica• No support for replicas hosted on servers running a version of SQL Server prior to SQL

Server 2016 Community Technology Preview 3 (CTP3)• No support for adding or removing a replica to an existing basic availability group• Support for one availability database• Basic availability groups cannot be upgraded to advanced availability groups. The group

must be dropped and re-added to a group that contains servers running only SQL Server 2016 Enterprise Edition

• Basic availability groups are only supported for Standard Edition servers

Page 17: HA/DR options with SQL Server in Azure and hybrid

Database MirroringDatabase Mirroring

Azure OnlyPrincipal and mirror and servers running in different datacenters for disaster recovery. Principal, Mirror, and Witness run within same Azure data center, deployed using a DC or server certificates for HA.HybridOne partner running in an Azure VM and the other running on-premises for cross-site disaster recovery using server certificates.

Principal and mirror and servers running in different datacenters for disaster recovery. You must deploy using server certificates because an Active Directory domain cannot span multiple datacenters.

Principal, mirror, and witness servers all running in the same Azure datacenter for high availability. You can deploy using a domain controller.

You can also deploy the same database mirroring configuration without a domain controller by using server certificates instead.

Page 18: HA/DR options with SQL Server in Azure and hybrid

Database Mirroring vs Always On AGAlways On AG introduced in SQL Server 2012

Database Mirroring was deprecated in SQL Server 2012

8 secondaries in 2014

2016: DTC support, 3 synchronous replicas can be failover targets

Page 19: HA/DR options with SQL Server in Azure and hybrid

Database Mirroring (Hybrid)Database Mirroring

Azure OnlyPrincipal and mirror and servers running in different datacenters for disaster recovery. Principal, Mirror, and Witness run within same Azure data center, deployed using a DC or server certificates for HA.HybridOne partner running in an Azure VM and the other running on-premises for cross-site disaster recovery using server certificates.

One partner running in an Azure VM and the other running on-premises for cross-site disaster recovery using server certificates. Partners do not need to be in the same Active Directory domain, and no VPN connection is required.

Another database mirroring sceanario involves one partner running in an Azure VM and the other running on-premises in the same Active Directory domain for cross-site disaster recovery. A VPN connection between the Azure virtual network and the on-premises network is required.

For successful disaster recovery of your databases, you should also install a replica domain controller at the disaster recovery site.

Page 20: HA/DR options with SQL Server in Azure and hybrid

Log Shipping (Hybrid)Log Shipping

For DR only / Hybrid onlyOne server running in an Azure VM and the other running on-premises for cross-site disaster recovery.Log shipping depends on Windows file sharing, so a VPN connection between the Azure virtual network and the on-premises network is required.Requires AD deployment on DR site.

Page 21: HA/DR options with SQL Server in Azure and hybrid

Block blobsReduced storage costsSignificantly improved restore performanceMore granular control over Azure Storage

Azure Storage snapshot backupFastest method for creating backups and running restoresSupport of SQL Server database files on Azure Blob Storage

Backup to AzureBackup to

Azure (blob storage)

Managed backupOn-prem to AzureGranular control of the backup scheduleLocal staging for faster recovery and greater network resiliencySystem database supportSimple recovery mode support

On-prem or Azure production databases backed up directly to Azure blob storage for disaster recovery.

SQL 2016: Backup to Azure with file snapshots

Production databases backed up directly to blob storage in a different datacenter for disaster recovery

On-premises production databases backed up directly to Azure blob storage for disaster recovery.

Page 22: HA/DR options with SQL Server in Azure and hybrid

Backup to Azure with file snapshots (SQL Server 2016)

BACKUP DATABASE database TO URL = N'https://<account>.blob.core.windows.net/<container>/<backupfileblob1>‘ WITH FILE_SNAPSHOT

Instance

Azure Storage

MDFDatabaseMDF

LDFLDFBAK

Hybrid solutions

Page 23: HA/DR options with SQL Server in Azure and hybrid

SQL Server data files in Azure (Hybrid)SQL Server data files in

AzureNative support for SQL Server data files stored as Azure blobs

Benefits:- Easy and fast

migration benefits- Cost and limitless

storage benefits- High availability and

disaster recovery benefits

- Security benefits- Snapshot backup

Page 24: HA/DR options with SQL Server in Azure and hybrid

Azure Site Recovery (Hybrid)Azure Site Recovery

(ASR)Simpler BCDR storySite Recovery makes it easy to handle replication, failover and recovery for your on-premises workloads and applications (not data!).Flexible replication You can replicate on-premises servers, Hyper-V virtual machines, and VMware virtual machines. Eliminate the need for secondary

SQL Server on-prem DR example:

Standalone SQL Server instance residing on-premises and replicating to an Azure Storage account by using Azure Site Recovery. The replication targets are page blobs containing the vhd files (C drive) of Azure IaaS virtual machines hosting SQL Server instances that are brought online during failover. SQL Server data files are not handled with ASR.

Page 25: HA/DR options with SQL Server in Azure and hybrid

Azure VM Availability SetAzure Availability

Set

Create redundant VMs that are spread across multiple racks in the Windows Azure Data Centers. This means redundant power supply, switches and servers

99.95% SLA guaranteed (99.9% SLA for single instance)

Each virtual machine in your Availability Set is assigned an Update Domain (UD) and a Fault Domain (FD)

In ARM it is not yet possible to add an existing VM to an availability set.

VMs in an Availability Set can be different sizes, but they need to be within a range of sizes supported by the hardware where the first VM lands. Generally we recommend to keep the VMs within the same family for a reliable deployment. This means only using VMs of the following sizes in the same set: A0 – A7 A8 – A11 D1 – D14 DS1 – DS14 D1v2 – D14v2 G1 – G5 GS1 – GS5

Note: This is an Azure concept, not a SQL technology. There is no replication of data. Think of it as high-availability for your OS and SQL Server binaries, or for stateless apps (like web servers).

Page 26: HA/DR options with SQL Server in Azure and hybrid

Azure SQL Data Sync (preview)SQL Azure Data Sync is a Microsoft Windows Azure web service that provides data synchronization capabilities for SQL databases. SQL Azure Data Sync allows data to be synchronized between on-premises SQL Server databases and Azure SQL databases; in addition, it can also keep multiple Azure SQL databases in sync.

SQL Data Sync targets the reference data replication scenario.  Its key capabilities are: Sync between SQL Server (2005 SP2

and later) and Azure SQL databases, or between Azure SQL databases

One-way and bi-directional sync One-to-one and hub-spoke Table filter and column filter Scheduled and on-demand Eventual consistency Active Geo-Replication, in contrast, targets GeoDR scenario for Azure SQL Database by replicating the database to another region.  It only supports one-way replication (secondaries are read-only), replication is at database granularity and no database or column/row filter support, and it is only available for Premium service tier.

Page 27: HA/DR options with SQL Server in Azure and hybrid

ResourcesSQL Server in VM best practices: https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-sql-server-performance-best-practices/

Virtual machine limits: https://azure.microsoft.com/en-us/documentation/articles/azure-subscription-service-limits/#virtual-machines-limits

Sizes for Virtual Machines: https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-size-specs/

Virtual machines pricing: https://azure.microsoft.com/en-us/pricing/details/virtual-machines/

Disaster Recovery and High Availability for Azure Applications: https://msdn.microsoft.com/en-us/library/azure/dn251004.aspx

Page 28: HA/DR options with SQL Server in Azure and hybrid

© 2016 Microsoft Corporation. All rights reserved.