Top Banner
Disaster Recovery and High Availability solutions with SQL Server Azure Montreal SQL Saturday Prepared by Michelle Gutzait
40
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Dr and ha solutions with sql server azure

Disaster Recovery and High

Availability solutions with

SQL Server Azure

Montreal SQL Saturday

Prepared by Michelle Gutzait

Page 2: Dr and ha solutions with sql server azure

WHOAMI?

[email protected]

SQL Server Consultant@ www.pythian.com

24/7 Remote DBA services

© 2013 Pythian2

Page 3: Dr and ha solutions with sql server azure

The environment

• OLTP/ DW?

• Availability? 24x7?

• Data loss and SLA?

• Local/hosted?

• SQL Server version and edition?

• Storage?

• Number of databases?

• Sizes of databases?

• Volume of transactions?

• Volume of reports?

• Backup strategy?

• Etc…

Page 4: Dr and ha solutions with sql server azure

Problems?• Performance issues

• Locks/blocks/deadlocks

• Application timeouts

• Backups failing

• Data updates VS reports

• Fragmented indexes

• Previous Database corruption

• Restore took too long

• Application bugs causing logical

corruption

• Long downtime on maintenance

Page 5: Dr and ha solutions with sql server azure

What are YOUR problems?

Page 6: Dr and ha solutions with sql server azure

HA and DR solutions

Primary and secondary environments can be:

• Only on-premises

• Only in Azure

• Hybrid (both on-premises and in Azure)

© 2013 Pythian6

Page 7: Dr and ha solutions with sql server azure

Countless solutions!!!

Page 8: Dr and ha solutions with sql server azure

Before Azure…

© 2013 Pythian8

Page 9: Dr and ha solutions with sql server azure

Backups• Full backup

• Differential backup

• T-Log backup

• Filegroup backup

• Filegroup Differential

Page 10: Dr and ha solutions with sql server azure

Backups strategy for DR

• How long is the restore?

• Where are the backup files?

• What’s the affordable downtime?

• How much data loss is acceptable?

Page 11: Dr and ha solutions with sql server azure

Log Shipping

• Replica of the entire database

• Synchronized to X minutes ago

• Backup and restore the t-logs

• Secondary can be:

– Read-only

– In recovery mode

Page 12: Dr and ha solutions with sql server azure

Log Shipping - Pros

• Verification of production backups

• Lag to protect from accidental changes

(ex: protection during monthly/weekly

releases)

• Any change in DB is replicated

automatically, including DDL

• Multiple secondaries are allowed

• Read-Only replica

– Good for reporting

– Data can be read at standby server when DB is not

restoring

– CHECKDB, Fragmentation checks on secondary

Page 13: Dr and ha solutions with sql server azure

Log Shipping - Cons• X minutes data loss

• No automatic failover (can be automated)

• No easy failback (Log Shipping needs to be

recreated)

• DB Corruption may be replicated

• Database level replication, not instance

• T-log backup files can be large if there is a high

volume of transactions

• Database needs to be in FULL recovery model

• Same SQL Server version for read-only replica

• Users will be disconnected on DB restore– Automatically

– Not automatically

• No particular indexes can be created for the

reports

Page 14: Dr and ha solutions with sql server azure

Database Mirroring

• Replica of the entire database

• Synchronization

– Synchronized (High Safety)

• With or without a witness

– A-synchronized (High Performance)

Page 15: Dr and ha solutions with sql server azure

Database Mirroring - Pros

• Real-time or close-to-real-time replica

• Any change in DB is replicated

automatically, including DDL

• Can implement Database Snapshots on

replica for reporting

• Corruption not being replicated

– SQL 2008+ page corresponding to a corruption is

retrieved from the replica/mirror and repaired,

transparently

• Easy failover and failback

• Automatic failover with a witness

– Faster failover than Clustering

• Reference to secondary instance in

connection strings

Page 16: Dr and ha solutions with sql server azure

Database Mirroring - Cons

• Secondary cannot be used for reporting

– Can use Database Snapshot

• Sensitive to network bandwidth

– And volume of transactions

• A-synchronous mode - only in ENT Edition

• Witness - only in ENT Edition

• Deprecated in future releases

• Replication on the database level, not

instance

• Only one mirror allowed per database

• A bit more complicated if instances not in the

same network or Domain

Page 17: Dr and ha solutions with sql server azure

Database Snapshot

• Static read-only copy of the

database

• Snapshot file grows when pages

modified

• On same instance as the original

database

Page 18: Dr and ha solutions with sql server azure

Database Snapshot - Pros

• Great for reporting

– Non real-time data

• Great for DR

– Non real-time data

• Can be created on a mirrored replica

• Corruption will be kept if at page-level

• Created in less than a second

• Read –only operations such as DBCC or

index fragmentation

• Can be backed up

Page 19: Dr and ha solutions with sql server azure

Database Snapshot - Cons

• Non real-time data

• Requires maintenance

– Multiple snapshots

– Add and remove

• Databases cannot be dropped if there is a

snapshot

• Snapshot cannot be dropped if there are

users

• No particular indexes can be created for

the reports

Page 20: Dr and ha solutions with sql server azure

Replication

• Object-level replication

– Row level

– Column level

• Three types

– Snapshot

– Merge

– Transactional

• With updatable subscribers

• Peer-to-peer

• Transaction being replicated

Page 21: Dr and ha solutions with sql server azure

Replication - Pros

• Partial replication

– Saving space and time

– Security

• Possibly different schema and different

indexes on secondary

• Great for reporting, users not disconnected

• Corruption not transferred

• Can configure a lag, protecting from

accidental data changes

• Secondary database can be backed up

Page 22: Dr and ha solutions with sql server azure

Replication - Cons

• Management and troubleshooting

complexity

• All replicated tables require a Primary Key

• Database level replication, not instance

• More physical hardware required with

heavy IO throughput

• Some latency, possible data loss

Page 23: Dr and ha solutions with sql server azure

Cluster

• Instance-level HA/DR

• High Availability with local cluster

• Plus Disaster Recovery with Geo-

Cluster

• 2 or N+1 nodes, M instances

• One instance can failover to different

nodes

• SQL Server has one virtual name

Page 24: Dr and ha solutions with sql server azure

Cluster - Pros

• Failover transparent to applications

• Automatic failover on hardware or

OS failures

• Fast failover (only service restart)

• Easy upgrades and patches

• Can add nodes seamlessly

• Manual failover (ex: performance

reasons)

Page 25: Dr and ha solutions with sql server azure

Cluster - Cons

• No protection from disk failure

• Only 2-node cluster for Standard

Edition

• More maintenance than a stand-

alone

• More expensive than a stand-alone

• There is no replica of the database

for reporting

Page 26: Dr and ha solutions with sql server azure

Always

OnAvailability

Groups

• A mix of Failover clustering and

Database Mirroring

• Does not require shared storage

• Instances are not clustered

resources

• Database level replication

• Group of databases failing over

together

• Read-only or non-readable replicas

• Automatic failover

• Different sync modes

• Different failover rules

• Built-in Load balancing

Page 27: Dr and ha solutions with sql server azure
Page 28: Dr and ha solutions with sql server azure

Other solutions – not SQL Server,

not Azure

• VM replication

• SAN or storage replication

• 3-rd party tools

• Etc….

Page 29: Dr and ha solutions with sql server azure

Architecture design – so farBe creative….

Node A Node B

Instance A

Node N

Instance BPassive

Instance C

Cluster

Page 30: Dr and ha solutions with sql server azure

WOW!! More options with

Azure

© 2013 Pythian33

Page 31: Dr and ha solutions with sql server azure

Other solutions – for Azure VMs• Service healing for cloud services and

Failure recovery detection for the Virtual

Machines– keep VM available even when there are problems

– VM proactively moved to new nodes

– VM may restart

– IP address of the VM does not change

• Azure Site Recovery– Hyper-V replication

• Geo Redundant Storage (GRS) for

Windows Azure– Locally or zone redundant

– Three copies of your data– http://blogs.msdn.com/b/windowsazurestorage/archive/2011/09/15/in

troducing-geo-replication-for-windows-azure-storage.aspx

Page 32: Dr and ha solutions with sql server azure

Cloud (Azure) only HA/DR solutions - examples

• Built-in Always On Availability Groups

© 2013 Pythian35

Within same region

Different region

Page 33: Dr and ha solutions with sql server azure

Cloud (Azure) only HA/DR solutions - examples

• Database mirroring

© 2013 Pythian36

Same region

With Domain Controller

Same region

Using certificates

Different region

Page 34: Dr and ha solutions with sql server azure

Hybrid HA/DR solutions - examples

• Always On

Availability Groups

• Database

mirroring

• Log Shipping

© 2013 Pythian37

Page 35: Dr and ha solutions with sql server azure

Quick demo…

Page 36: Dr and ha solutions with sql server azure

manage.windowsazure.com

Easy to choose from a menu

© 2013 Pythian39

Page 37: Dr and ha solutions with sql server azure

Connect an on-premises network to

a Microsoft Azure virtual network

© 2013 Pythian40

https://technet.microsoft.com/en-us/library/dn786406%28v=office.15%29.aspx

Page 38: Dr and ha solutions with sql server azure

Or…. Point-to-Site VPN

© 2013 Pythian41

http://blogs.technet.com/b/francesco_diaz/archive/2013/05/14/implementare-uno-

scenario-ibrido-con-sql-server-e-windows-azure-point-to-site-vpn.aspx

Page 39: Dr and ha solutions with sql server azure

Follow the steps

• On-premises Define and create an on-premises

network that requires a route to the Azure virtual network

and a VPN gateway device.

• Microsoft Azure Create an Azure virtual network with a

site-to-site VPN connection via the Azure Management

Portal.

• On premises Configure your on-premises hardware or

software VPN gateway to terminate the VPN tunnel,

which uses Internet Protocol security (IPsec).

© 2013 Pythian42