lessons learned - home - sql nuggets · help to protect from datacenter-level failures located...

24
Lessons Learned From An Azure Migration

Upload: others

Post on 22-May-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Lessons LearnedFrom An Azure Migration

Who Is This Guy?

Eric Cobb SQL Server Database Administrator

MCSE: Data Platform | MCSE: Data Management and Analytics

1999-2013: “Webmaster”, Programmer, Developer

2014+: Database Administrator

GitHub: https://github.com/ericcobb

Blog: http://www.sqlnuggets.com

Twitter: @sqlnugg @cfgears

What Are We Talking About Today?

Take a look at Azure from a first-timers perspective

Things that scared me

My challenges, confusion, and revelations

A few of my own personal ramblings

Where We Are

Development:SQL 2014 – Windows 2012(virtual)

Monitoring (SQLSentry):SQL 2012 – Windows 2008R2(physical)

Production:SQL 2014 - Windows 2008 R2AlwaysOn Availability Group(virtual)

Where We Are Headed

Development:SQL 2017 – Windows 2016

Future:Additional Availability Group Node In Different Region

Production:SQL 2017 - Windows 2016AlwaysOn Availability Group(with SQLSentry)

North American Azure Regions

https://azure.microsoft.com/en-us/regions/

GlobalAzure Regions

https://azure.microsoft.com/en-us/regions/

Azure Can Be Confusing

Outdated Tutorials are EVERYWHERE

New features are being rolled out almost daily

Confusing terminology

SO. MANY. OPTIONS.

Azure Can Be Confusing

http://azureinteractives.azurewebsites.net/Azure101Cards/default.html

Azure Can Be Intimidating

http://azureinteractives.azurewebsites.net/AzureSecurity/default.html

Azure Can Be Confusing

Multiple SQL Server Offerings

Azure SQLDB – Single database hosted on MS Servers (PaaS) 99.99% SLA, geo-replication, high availability, automatic backups,

point-in-time restores, latest & greatest SQL Server features

Fully managed, “SQL Server on auto pilot”

No cross database connections, SSIS, SSRS, SSAS

No access to SQL Agent, Backups, Remote Desktop and more

SQL VM – SQL Server you control (IaaS) Full control over server

Complete RDP/Windows access

Managed Instances for Azure SQL Database (Preview) Hybrid between running Paas and IaaS

All the features of Azure SQLDB, plus SQL Agent, cross-database querying, replication, CLR, service broker, etc.

Azure Portal

Stop!

SQL Server VM Configurations

Useful Guides

Tales from Building a SQL Server DW in Azure – SentryOne: Deciding between SQL Server in a VM, Azure SQLDB, and Azure SQLDW

Structuring Development, Test, and Production environments

Key decisions for storage, encryption, and backups

More

Performance best practices for SQL Server in Azure Virtual Machines – Microsoft:

VM size guidance

Storage guidance

Disks guidance

I/O guidance

Security

Group Managed Service Accounts (gMSA)

First available for SQL Server 2014 running on Windows 2012 R2

Special type of domain account managed by domain controller Complex password is managed automatically by domain controller

Cannot be used to log into a computer

Can run a Windows service such as SQL Server

Password can be updated without having to restart service using it

Useful Links: Group Managed Service Accounts (gMSA) and SQL Server 2016

Notes From A SQL 2017 Azure Install – Using Group Managed Service Accounts

Trace Flags

Trace Flag changes in SQL 2016 and SQL 2017

1117 & 1118 - Grow all data files evenly; allocate full extents Enabled in TempDB by default as of SQL Server 2016

Controlled via ALTER DATABASE for all other databases

2371 - Increase when autostats are generated on a table Enabled by default for compatibility level 130 and up

4199 - Enables query optimizer changes released in updates Now controlled via ALTER DATABASE SCOPED CONFIGURATION

Default is OFF, equivalent to enabling Trace Flag 4199

9481 - Set the cardinality estimator to pre-SQL Server 2014 Now controlled via ALTER DATABASE SCOPED CONFIGURATION

Default is OFF, which sets cardinality estimator based on the compatibility level of the database. Setting this to ON is equivalent to enabling Trace Flag 9481.

Availability Group Setup

Load Balanced Listener

Required for Availability Groups in Azure Azure blocks all Gratuitous Address Resolution Protocols (ARP)

If an Availability Group spans multiple Azure regions, each region needs a load balancer

Cloud Witness

New type of Failover Cluster quorum witness that leverages Microsoft Azure as the arbitration point (Windows Server 2016)

Uses Azure Blob Storage to read/write a blob file which is then used as an arbitration point

Availability Group Setup

Useful Guides

Why Does My SQL Server Availability Group Need a Load Balancer in Azure?

Configure a load balancer for an Always On availability group in Azure (step-by-step tutorial)

Notes From A SQL 2017 Azure Install – Using A Load Balancer As An Availability Group Listener

Failover Clustering and Always On Availability Groups

Deploy a Cloud Witness for a Failover Cluster (step-by-step tutorial)

Backups & Storage

Backup Storage Using Azure Storage Account

First, create General storage (not Blob), and then create a Blob container in that not-Blob storage, which offers three types of Blobs: Block Blobs, Append Blobs, and Page Blobs. So, you will have Blobs stored inside the Blob in the not-Blob storage, which is actually stored on top of a Blob.

First, create General storage (not Blob), and then create a Blobcontainer in that not-Blob storage, which offers three types of Blobsstorage options: Block Blobs, Append Blobs, and Page Blobs.

Azure Portal

Stop!

Backups & Storage

Storage Replication

Locally redundant storage (LRS) Replicates your data three times within a datacenter in the region in

which you created your storage account

Zone-redundant storage (ZRS) Replicates your data across datacenters within one or two regions in

addition to storing three replicas

Geo-redundant storage (GRS) Replicates your data to a secondary region that is hundreds of miles

away from the primary region

Data it is replicated three times in primary region, then also replicated three times in secondary region

Read-access geo-redundant storage (RA-GRS) Same as GRS, but also provides read-only access to the data in the

secondary location

Azure Availability Zones (In Preview)

Help to protect from datacenter-level failures

Located inside an Azure region

Each zone has independent power source, network, and cooling

Minimum of three separate zones in all enabled regions

Currently only supported in East US 2 and West Europe Regions

Backups & Storage

SQL Server Backup & Restore Options with Azure Blob Storage Service

Backup directly to the Azure Blob storage by specifying URL as the backup destination (SQL 2012 SP1 CU2)

SQL Server File-Snapshot Backups provide nearly instantaneous backups and restores for database files (SQL 2016)

SQL Server Managed Backup to Microsoft Azure manages and automates backups to Azure Blob storage. You can allow SQL Server to determine the backup schedule based on the transaction workload of your database (SQL 2014)

Local backups, using Azure Blob storage for long term retention

Migrating Databases To Azure

Useful Tools & Guides

Database Migration Guide - Choose your source, choose your target, create your guide

Data Migration Assistant - Detects compatibility issues, recommends performance and reliability improvements, and allows you to move your schema and data

Azure Database Migration Service - Designed as a seamless, end-to-end solution for moving on-premises SQL Server databases to the cloud. (currently in Preview)

Post-migration Validation and Optimization Guide - Lists common performance scenarios encountered after migrating to SQL Server Platform and how to resolve them