#JSS2015
Les journées
SQL Server 2015
Un événement organisé par GUSS
@GUSS_FRANCE
#JSS2015
Les journées
SQL Server 2015
Un événement organisé par GUSS
AlwaysOn® 2016
Nicolas SOUKOFF
#JSS2015
La communauté Data & BI Microsoft
Webcasts, Conférences, Afterworks
http://GUSS.pro
Session donnée pour
@GUSS_FRANCE
/GUSS
/GUSS.FR
#JSS2015
Les journées
SQL Server 2015
#JSS2015
Merci à nos sponsors
#JSS2015
• Nicolas SOUKOFF
• Senior Premier Field Engineer (PFE)
• SQL 6.0 -> SQL 2016
• Contact:
– nicolas.soukoff@microsoft.com
– www.twitter.com/nicosoukoff
– https://www.linkedin.com/in/nicosoukoff
Qui suis-je ?
#JSS2015
• AlwaysOn®
• From 2012 to 2016
• End of Mirroring
Agenda
#JSS2015
SQL Server HA/DR technologies
• Server failover
– Useful in consolidation scenarios
• Shared Storage (SAN / SMB)
• Failover takes minutes
• Multi-Node Clustering
• Passive secondary nodes
• Multi-database Failover
• Direct attached storage
• Failover takes seconds
• Multiple Secondaries
• Active Secondaries
Failover Cluster Instances
for servers
Availability Groups
for groups of databases
#JSS2015
Availability Groups
Introduced in SQL Server 2012
• Multi-database Failover
• Multiple secondaries
• Sync / Async
• Compression & Encryption
• Manual/Automatic Failover
• Flexible Failover Policy
• Automatic Page Repair
• Seamless App Connectivity
• Configuration Wizard
• Monitoring Dashboard
• Diagnostics infrastructure
• System Center integration
• Full cross-feature support
• Contained Databases,
FileStream, FileTable,
Service Broker, In-memory
OLTP
• Active Secondaries
• Read workloads
• Backups
• PowerShell Automation
• Fast Failover
Integrated Efficient
#JSS2015
SQL Server 2014
#JSS2015
Availability Groups
Increased Number of Secondaries
SQL 2014 increased to 8 replicas
• 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
#JSS2015
SQL Server 2016
#JSS2015
Enhancements
• Database-Level Failover Trigger
• Load Balancing in Readable Secondaries
• GMSA Support
• MSDTC Support
• SSIS Support
• Auto-Failover Targets
• Lite Edition 
#JSS2015
• Currently, AG health only monitors the health of
the instance.
– A database can be offline or corrupt, but as long as the instance itself is
healthy, we won’t trigger a failover.
• 2016 will allow you to optionally change the
health monitoring to also consider the health of
the databases in the AG.
– Databases going offline trigger a change in the health status
Database-level failover trigger
#JSS2015
Database-level failover trigger – GUI interface
#JSS2015
CREATE AVAILABILITY GROUP [AG1]
WITH (AUTOMATED_BACKUP_PREFERENCE = SECONDARY,
DB_FAILOVER = ON,
DTC_SUPPORT = NONE)
FOR DATABASE [db1]
REPLICA ON N'SQL1' WITH (ENDPOINT_URL = N'TCP://SQL1.Contoso.com:5022', FAILOVER_MODE = MANUAL,
AVAILABILITY_MODE = ASYNCHRONOUS_COMMIT, BACKUP_PRIORITY = 50, SECONDARY_ROLE(ALLOW_CONNECTIONS = NO)),
N'SQL2' WITH (ENDPOINT_URL = N'TCP://SQL2.Contoso.com:5022', FAILOVER_MODE = MANUAL,
AVAILABILITY_MODE = ASYNCHRONOUS_COMMIT, BACKUP_PRIORITY = 50, SECONDARY_ROLE(ALLOW_CONNECTIONS = NO));
Database-level failover trigger - T-SQL
ALTER AVAILABILITY GROUP [AG1] SET(
DB_FAILOVER = OFF);
Create AAG : https://msdn.microsoft.com/en-us/library/ff878399.aspx
ALTER AAG : https://msdn.microsoft.com/en-us/library/ff878601.aspx
#JSS2015
Database-level failover trigger – Extended Event
availability_replica_database_fault_reporting
Column Name Description
fault_type
The fault id reported.
Possible values:
0 - NONE
1 - Unknown
2 - Shutdown
is_critical If the value is TRUE the replica will restart and fail the health check.
failover_ready_replicas The number of automatic failover secondaries that are synchronized.
availability_group_id The ID of the Availability Group.
availability_group_name The name of the Availability Group.
availability_replica_id The ID of the Availability Replica.
availability_replica_name The name of the Availability Replica.
database_replica_id The ID of the Availability Replica Database.
database_name The name of the database reporting the fault
#JSS2015
• In SQL 2014, read-only transactions routed by
the Listener, went to the first secondary that
was available.
• Read-only Routing lists
• Now you can configure the ROR lists to
round-robin among a specific set of
secondaries. (for each primary)
Load Balancing in Readable Secondaries
#JSS2015
Load Balancing Readable Secondaries
Secondary Replica
SQLAZ1
Primary Replica
SQL1
Secondary Replica
SQL5
Secure
Connection
Secondary Replicas
SQL2-4
A-sync
A-sync
Site A Site B
#JSS2015
Readable Secondary load balancing
Site ASite B SQL2
SQL3
SQL4
SQL5
SQL1
(Primary)
READ_ONLY_ROUTING_LIST=( (‘SQL2’,’SQL3’,’SQL4’) ,’SQL5’)
#JSS2015
LOAD BALANCING READABLE SECONDARIES
Infra BI V4 – le Scale out
(Salle Rubis 14h-15h)
#JSS2015
• Group Managed Service Accounts (GMSA)
– Domain-scoped automatically managed service
accounts
– Automatic password rotation
– Much more secure than regular domain accounts
– Enables cross system security context
GMSA Support
#JSS2015
• Currently, any distributed transactions
touching a database in an AAG are not
allowed.
– Many customers run unsupported, at risk to their data and our
reputation
– Lots of Enterprise applications need cross database
transactions.
DTC Support
#JSS2015
• Supported in 2016
– Currently supports cross-instance transactions only
– Joint effort with Windows, requires specific patch in order to
work cleanly
– CREATE AVAILABILITY GROUP command and the WITH
DTC_SUPPORT = PER_DB clause. You cannot currently alter
an existing availability group.
DTC Support
#JSS2015
• Increasing the scale of the solution
• Increasing resiliency
• Now any sync secondary can be a target
for automatic failover
• Total of 3 auto-failover targets
>2 Auto-Failover targets
#JSS2015
• HA can be maintained even if one of the
automatic failover partners is lost
• Reduces the need to manually manage
failovers or to reconfigure the AG in the
event that one of the automatic failover
partners went down
>2 Auto-Failover targets
#JSS2015
• Enables replacement of Database Mirroring
by not requiring EE license
• Limits mostly match DBM:
– Two replicas
– Sync or Async
– No Readable Secondaries
– No backup on secondary
Lite Edition
Edition Standard !!!
#JSS2015
DEMO SURPRISE
#JSS2015
• New feature in Windows Server 2016
• Environments supported
– Cross domains (with trust)
– Cross domains (no trust)
– No domain at all
• Windows 2016 clusters use certificates for intra-cluster auth
• Cluster management via PowerShell only
• SQL management as normal
• Uses certificate-secured endpoints like DBM
Domain-Independent Availability Groups
#JSS2015
Failover Clustering feature
How?
#JSS2015
Add local admin account
How?
#JSS2015
Add on each node a Primary DNS suffix
How?
#JSS2015
• Create Cluster
How?
#JSS2015
• Add Cloud Witness or Disk Witness
ONLY!!!
• File Share Witness is not supported!!!
How?
#JSS2015
• Check Commands
How?
#JSS2015
• Install SQL Server Standalone
• Add AlwaysOn® Feature with PowerShell®
command:
Enable-SqlAlwaysOn -Path SQLSERVER:SQLComputerInstance
https://msdn.microsoft.com/en-us/library/ff878259.aspx
How?
#JSS2015
CREATE ENDPOINTS
#JSS2015
CREATE AAG
#JSS2015
If you saw an environment with:
1.5 Million Databases
across
16 Geographic regions
processing
2.5 billion logins per week
with
99.99% aggregate uptime
Would it give you confidence in the platform?
Azure SQL Database
#JSS2015
#JSS2015#JSS2015
Les évaluations des sessions,
c’est important !!
http://GUSS.Pro/jss
#JSS2015
Merci à nos volontaires…
#JSS2015#JSS2015

[JSS2015] AlwaysOn 2016

  • 1.
    #JSS2015 Les journées SQL Server2015 Un événement organisé par GUSS @GUSS_FRANCE
  • 2.
    #JSS2015 Les journées SQL Server2015 Un événement organisé par GUSS AlwaysOn® 2016 Nicolas SOUKOFF
  • 3.
    #JSS2015 La communauté Data& BI Microsoft Webcasts, Conférences, Afterworks http://GUSS.pro Session donnée pour @GUSS_FRANCE /GUSS /GUSS.FR #JSS2015 Les journées SQL Server 2015
  • 4.
  • 5.
    #JSS2015 • Nicolas SOUKOFF •Senior Premier Field Engineer (PFE) • SQL 6.0 -> SQL 2016 • Contact: – nicolas.soukoff@microsoft.com – www.twitter.com/nicosoukoff – https://www.linkedin.com/in/nicosoukoff Qui suis-je ?
  • 6.
    #JSS2015 • AlwaysOn® • From2012 to 2016 • End of Mirroring Agenda
  • 7.
    #JSS2015 SQL Server HA/DRtechnologies • Server failover – Useful in consolidation scenarios • Shared Storage (SAN / SMB) • Failover takes minutes • Multi-Node Clustering • Passive secondary nodes • Multi-database Failover • Direct attached storage • Failover takes seconds • Multiple Secondaries • Active Secondaries Failover Cluster Instances for servers Availability Groups for groups of databases
  • 8.
    #JSS2015 Availability Groups Introduced inSQL Server 2012 • Multi-database Failover • Multiple secondaries • Sync / Async • Compression & Encryption • Manual/Automatic Failover • Flexible Failover Policy • Automatic Page Repair • Seamless App Connectivity • Configuration Wizard • Monitoring Dashboard • Diagnostics infrastructure • System Center integration • Full cross-feature support • Contained Databases, FileStream, FileTable, Service Broker, In-memory OLTP • Active Secondaries • Read workloads • Backups • PowerShell Automation • Fast Failover Integrated Efficient
  • 9.
  • 10.
    #JSS2015 Availability Groups Increased Numberof Secondaries SQL 2014 increased to 8 replicas • 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
  • 11.
  • 12.
    #JSS2015 Enhancements • Database-Level FailoverTrigger • Load Balancing in Readable Secondaries • GMSA Support • MSDTC Support • SSIS Support • Auto-Failover Targets • Lite Edition 
  • 13.
    #JSS2015 • Currently, AGhealth only monitors the health of the instance. – A database can be offline or corrupt, but as long as the instance itself is healthy, we won’t trigger a failover. • 2016 will allow you to optionally change the health monitoring to also consider the health of the databases in the AG. – Databases going offline trigger a change in the health status Database-level failover trigger
  • 14.
  • 15.
    #JSS2015 CREATE AVAILABILITY GROUP[AG1] WITH (AUTOMATED_BACKUP_PREFERENCE = SECONDARY, DB_FAILOVER = ON, DTC_SUPPORT = NONE) FOR DATABASE [db1] REPLICA ON N'SQL1' WITH (ENDPOINT_URL = N'TCP://SQL1.Contoso.com:5022', FAILOVER_MODE = MANUAL, AVAILABILITY_MODE = ASYNCHRONOUS_COMMIT, BACKUP_PRIORITY = 50, SECONDARY_ROLE(ALLOW_CONNECTIONS = NO)), N'SQL2' WITH (ENDPOINT_URL = N'TCP://SQL2.Contoso.com:5022', FAILOVER_MODE = MANUAL, AVAILABILITY_MODE = ASYNCHRONOUS_COMMIT, BACKUP_PRIORITY = 50, SECONDARY_ROLE(ALLOW_CONNECTIONS = NO)); Database-level failover trigger - T-SQL ALTER AVAILABILITY GROUP [AG1] SET( DB_FAILOVER = OFF); Create AAG : https://msdn.microsoft.com/en-us/library/ff878399.aspx ALTER AAG : https://msdn.microsoft.com/en-us/library/ff878601.aspx
  • 16.
    #JSS2015 Database-level failover trigger– Extended Event availability_replica_database_fault_reporting Column Name Description fault_type The fault id reported. Possible values: 0 - NONE 1 - Unknown 2 - Shutdown is_critical If the value is TRUE the replica will restart and fail the health check. failover_ready_replicas The number of automatic failover secondaries that are synchronized. availability_group_id The ID of the Availability Group. availability_group_name The name of the Availability Group. availability_replica_id The ID of the Availability Replica. availability_replica_name The name of the Availability Replica. database_replica_id The ID of the Availability Replica Database. database_name The name of the database reporting the fault
  • 17.
    #JSS2015 • In SQL2014, read-only transactions routed by the Listener, went to the first secondary that was available. • Read-only Routing lists • Now you can configure the ROR lists to round-robin among a specific set of secondaries. (for each primary) Load Balancing in Readable Secondaries
  • 18.
    #JSS2015 Load Balancing ReadableSecondaries Secondary Replica SQLAZ1 Primary Replica SQL1 Secondary Replica SQL5 Secure Connection Secondary Replicas SQL2-4 A-sync A-sync Site A Site B
  • 19.
    #JSS2015 Readable Secondary loadbalancing Site ASite B SQL2 SQL3 SQL4 SQL5 SQL1 (Primary) READ_ONLY_ROUTING_LIST=( (‘SQL2’,’SQL3’,’SQL4’) ,’SQL5’)
  • 20.
    #JSS2015 LOAD BALANCING READABLESECONDARIES Infra BI V4 – le Scale out (Salle Rubis 14h-15h)
  • 21.
    #JSS2015 • Group ManagedService Accounts (GMSA) – Domain-scoped automatically managed service accounts – Automatic password rotation – Much more secure than regular domain accounts – Enables cross system security context GMSA Support
  • 22.
    #JSS2015 • Currently, anydistributed transactions touching a database in an AAG are not allowed. – Many customers run unsupported, at risk to their data and our reputation – Lots of Enterprise applications need cross database transactions. DTC Support
  • 23.
    #JSS2015 • Supported in2016 – Currently supports cross-instance transactions only – Joint effort with Windows, requires specific patch in order to work cleanly – CREATE AVAILABILITY GROUP command and the WITH DTC_SUPPORT = PER_DB clause. You cannot currently alter an existing availability group. DTC Support
  • 24.
    #JSS2015 • Increasing thescale of the solution • Increasing resiliency • Now any sync secondary can be a target for automatic failover • Total of 3 auto-failover targets >2 Auto-Failover targets
  • 25.
    #JSS2015 • HA canbe maintained even if one of the automatic failover partners is lost • Reduces the need to manually manage failovers or to reconfigure the AG in the event that one of the automatic failover partners went down >2 Auto-Failover targets
  • 26.
    #JSS2015 • Enables replacementof Database Mirroring by not requiring EE license • Limits mostly match DBM: – Two replicas – Sync or Async – No Readable Secondaries – No backup on secondary Lite Edition Edition Standard !!!
  • 27.
  • 28.
    #JSS2015 • New featurein Windows Server 2016 • Environments supported – Cross domains (with trust) – Cross domains (no trust) – No domain at all • Windows 2016 clusters use certificates for intra-cluster auth • Cluster management via PowerShell only • SQL management as normal • Uses certificate-secured endpoints like DBM Domain-Independent Availability Groups
  • 29.
  • 30.
  • 31.
    #JSS2015 Add on eachnode a Primary DNS suffix How?
  • 32.
  • 33.
    #JSS2015 • Add CloudWitness or Disk Witness ONLY!!! • File Share Witness is not supported!!! How?
  • 34.
  • 35.
    #JSS2015 • Install SQLServer Standalone • Add AlwaysOn® Feature with PowerShell® command: Enable-SqlAlwaysOn -Path SQLSERVER:SQLComputerInstance https://msdn.microsoft.com/en-us/library/ff878259.aspx How?
  • 36.
  • 37.
  • 38.
    #JSS2015 If you sawan environment with: 1.5 Million Databases across 16 Geographic regions processing 2.5 billion logins per week with 99.99% aggregate uptime Would it give you confidence in the platform? Azure SQL Database
  • 39.
  • 40.
    #JSS2015#JSS2015 Les évaluations dessessions, c’est important !! http://GUSS.Pro/jss
  • 41.
    #JSS2015 Merci à nosvolontaires…
  • 42.

Editor's Notes

  • #14 Create AAG : https://msdn.microsoft.com/en-us/library/ff878399.aspx ALTER AAG : https://msdn.microsoft.com/en-us/library/ff878601.aspx
  • #15 Description:  Occurs when a database reports a fault to the availability replica manager which will trigger a replica restart if the database is critical
  • #16 Create AAG : https://msdn.microsoft.com/en-us/library/ff878399.aspx ALTER AAG : https://msdn.microsoft.com/en-us/library/ff878601.aspx
  • #17 Description:  Occurs when a database reports a fault to the availability replica manager which will trigger a replica restart if the database is critical
  • #18 https://msdn.microsoft.com/en-us/library/hh710054.aspx
  • #22 https://msdn.microsoft.com/en-us/library/hh710054(v=sql.130).aspx#loadbalancing
  • #24 Currently, we can only support cross-instance transactions. Cross-DB transactions within an instance are not safe yet. More work to be done. https://msdn.microsoft.com/en-us/library/ms366279.aspx
  • #25 Currently, we can only support cross-instance transactions. Cross-DB transactions within an instance are not safe yet. More work to be done. https://msdn.microsoft.com/en-us/library/ms366279.aspx
  • #26 Alignement du nombre de replicas synchrones avec le nombre de replicas en automatic Failover Faire attention au bug d’affichage sur l’interface (toujours up to 2 automatic Failover).
  • #27 Alignement du nombre de replicas synchrones avec le nombre de replicas en automatic Failover
  • #30 Looks like a fairly run of the mill 2 node availability group. Nothing really unusual that you can see here.
  • #31 Now, looking at the server properties, what do we see? <click> That’s right. Both of these nodes are in a workgroup. That means that we’ve got an Availability Group which is not dependent on an Active Directory Domain.
  • #32 This is a huge leap in flexibility. We now no longer are tied to a single domain for all nodes in an AG. You can still have a single domain, but now you have lots of other options: Cross-domains (with trust) Cross-Domains (without trust) No domain at all, as in our demo. This feature is the result of a great deal of cooperation between the SQL Server team and the Windows Cluster team, establishing the pattern for things to come!
  • #35 Windows/ Système / Modifier les paramètres.
  • #36 Bien préciser que le nom du cluster doit être provisionner avec son IP dans le DNS (dans beaucoup de cas il n’est pas possible aux machines hors domaines de faire de l’auto registry dans le DNS Cluster management via PowerShell only
  • #37 !!! File Share Witness is not supported !!!
  • #38 !!! File Share Witness is not supported !!!
  • #39 En T-SQL : SELECT SERVERPROPERTY ('IsHadrEnabled');
  • #40 /* Execute this against the Principal Instance */ USE MASTER GO CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'MyPasswordKey' GO CREATE CERTIFICATE hadr_sql261w_cert WITH SUBJECT = 'HOST_SQL2 certificate', START_DATE = '11/11/2015' GO CREATE ENDPOINT [Hadr_Endpoint] STATE=STARTED AS TCP ( LISTENER_PORT = 5022, LISTENER_IP = ALL ) FOR DATA_MIRRORING ( ROLE = ALL, AUTHENTICATION = CERTIFICATE [hadr_sql261w_cert], ENCRYPTION = REQUIRED ALGORITHM AES ) GO BACKUP CERTIFICATE hadr_sql261w_cert TO FILE = 'C:\Temp\hadr_sql216w_cert.cer' GO -- STEP TO BE DONE AFTER SECONDARY INSTANCE /* * Execute this against the Principal Instance. The HOST_MIRR_cert.cer * needs to be copied on the Principal Server. */ USE MASTER GO /* * We are creating a SQL Login here. For Windows logins, * use the Grant Login instead of Create Login */ CREATE LOGIN HADR_login WITH PASSWORD = '$JSS2015!' GO CREATE USER HADR_user FOR LOGIN HADR_login GO CREATE CERTIFICATE HADR_cert AUTHORIZATION HADR_user FROM FILE = 'c:\Temp\hadr_sql316w_cert.cer' GO GRANT CONNECT ON ENDPOINT::Hadr_Endpoint TO [HADR_login] GO
  • #41 /* Execute this against the Principal Instance */ USE MASTER GO CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'MyPasswordKey' GO CREATE CERTIFICATE hadr_sql261w_cert WITH SUBJECT = 'HOST_SQL2 certificate', START_DATE = '11/11/2015' GO CREATE ENDPOINT [Hadr_Endpoint] STATE=STARTED AS TCP ( LISTENER_PORT = 5022, LISTENER_IP = ALL ) FOR DATA_MIRRORING ( ROLE = ALL, AUTHENTICATION = CERTIFICATE [hadr_sql261w_cert], ENCRYPTION = REQUIRED ALGORITHM AES ) GO BACKUP CERTIFICATE hadr_sql261w_cert TO FILE = 'C:\Temp\hadr_sql216w_cert.cer' GO -- STEP TO BE DONE AFTER SECONDARY INSTANCE /* * Execute this against the Principal Instance. The HOST_MIRR_cert.cer * needs to be copied on the Principal Server. */ USE MASTER GO /* * We are creating a SQL Login here. For Windows logins, * use the Grant Login instead of Create Login */ CREATE LOGIN HADR_login WITH PASSWORD = '$JSS2015!' GO CREATE USER HADR_user FOR LOGIN HADR_login GO CREATE CERTIFICATE HADR_cert AUTHORIZATION HADR_user FROM FILE = 'c:\Temp\hadr_sql316w_cert.cer' GO GRANT CONNECT ON ENDPOINT::Hadr_Endpoint TO [HADR_login] GO
  • #42 Selling HA is all about trust. Customers need to be rock-solid confident that the solution they pick will keep their business up and running. No downtime. No excuses. How do we gain that trust? With proof points. If I could show you a reference account that has ……. Would it help your customers have confidence in our solution? We have it today. It’s called Azure SQL Database. Why is that relevant here? Because IT’S THE SAME TECHNOLOGY POWERING THE CLOUD AND SQL Server. The experiences gained in operating this environment have directly led to improvements in the on-premise product:
  • #44 On parlait des speakers, il y a une chose qui leur tient à cœur !