Date post: | 08-Apr-2018 |
Category: |
Documents |
Upload: | vishwas-raut |
View: | 234 times |
Download: | 0 times |
of 32
8/7/2019 Sqlserver Ha
1/32
SQL ServerHigh Availability
Craig RyanNational Manager Database Services
8/7/2019 Sqlserver Ha
2/32
8/7/2019 Sqlserver Ha
3/32
How MuchAvailability do you need?
Need to ask yourself:
How long can we afford to be down?
How much data can we afford to lose?
Availability = up/(up+down)
Category % Uptime
Downtime
(Min/mth)
Downtime
(Hrs/mth)
Downtime
(Min/Year)
Downtime
(Hrs/Year)
1 nine 98.000% 876.00 14.600 10,512 175.20
2 nines 99.000% 438.00 7.300 5,256 87.60
3 nines 99.900% 43.80 0.730 526 8.76
4 nines 99.990% 4.38 0.073 53 0.88
5 nines 99.999% 0.44 0.007 5 0.09
8/7/2019 Sqlserver Ha
4/32
Barriers ToAvailability
Database Server Failure or Disaster User or Application Error
Data Access Concurrency Limitations
Database Maintenance and Operations
Upgrades
Availability at Scale
Many barriersMany barriersOnly some are addressable by DBMS technologyOnly some are addressable by DBMS technology
Be sure to consider people, planning, and proceduresBe sure to consider people, planning, and procedures
8/7/2019 Sqlserver Ha
5/32
Warm Standby SolutionsReplication and Log Shipping
Database Object Level
SQL Server Replication
Database Level
Log Shipping
Both provide multiple copies
and a MANUAL fail over
8/7/2019 Sqlserver Ha
6/32
Log Shipping Minimal impact on the production
server
No changes to the database arerequired
Transactional consistency
Supports delayed load oftransaction logs
Not all SQL Server objects areautomatically copied
Users must exit for next log to beapplied
Log ShippingLog Shipping
Primary
SQLServer
Secondary
SQL Server
Tra
Log
Tra
Log
Load Job
opy Job
8/7/2019 Sqlserver Ha
7/32
DemoSQL 2000 Log Shipping
8/7/2019 Sqlserver Ha
8/32
Replication Failover possible; a custom
solution Not limited to entire database; Can
define subset of source database
or tables
Copy of database is continuouslyaccessible for read activity
Latency between source and copy
can be as low as seconds
Significantly increases the on-
going Database management
Database schema may need to be
changed
ReplicationReplication
8/7/2019 Sqlserver Ha
9/32
DemoSQL 2000 Transactional Replication
8/7/2019 Sqlserver Ha
10/32
Hot Standby Automatic failover
Built on Microsoft Cluster Services (MSCS)
Multiple nodes provide availability, transparent to client
Automatic detection and failover
Requires certified hardware
Supports many scenarios: Active/Active, N+1, N+I
Instance Failover entire instance works as a unit
Single copy of instance databases Available since SQL Server 7.0
Standby is not available for reporting, queries, etc.
May support other instances
Failover ClusteringMicrosoft Cluster Services
Failover ClusterFailover Cluster
8/7/2019 Sqlserver Ha
11/32
Client CsClient Cs
Server AServer A Server BServer B
SharedShared
Disk ArrayDisk Array
HeartbeatHeartbeatCluster managementCluster management
SQL ServerSQL Server
Virtual
Server
EE FF GGC,DC,D C,DC,D
SQL Server
HubHub HubHub
Active/Passive SQL Server Cluster
8/7/2019 Sqlserver Ha
12/32
Client CsClient Cs
Server AServer A Server BServer B
SharedShared
Disk ArrayDisk Array
HeartbeatHeartbeatCluster managementCluster management
SQL ServerSQL Server
Virtual
Server
EE FF GGC,DC,D C,DC,D
HubHub HubHub
SQL Server
Active/Passive SQL Server Cluster
8/7/2019 Sqlserver Ha
13/32
What Clustering doesnt do:
Clustering is not a mechanism to scale
Doesnt protect your server against siteoutage
Doesnt protect your disk subsystem
Doesnt protect against databasecorruption
Doesnt protect against logical corruption
Doesnt protect against user error
Doesnt protect application crash
Clustering is not a method to load-balance
Still a single point of failure The Database!
8/7/2019 Sqlserver Ha
14/32
DemoSQL 2000 Failover Clustering
8/7/2019 Sqlserver Ha
15/32
Log Shipping vs Clustering vs SQL Replication
So whats the best solution.
On your business requirements
it depends
You can combine the SQL H.A options.
E.g. A/ Cluster with Log shipping
8/7/2019 Sqlserver Ha
16/32
SQL Server 2005High Availability
8/7/2019 Sqlserver Ha
17/32
Barriers ToAvailabilityAs addressed in SQL Server 2005As addressed in SQL Server 2005
Database Server Failure or Disaster
Failover Clustering
Database Mirroring Transparent Client Redirect
User or Application Error
Data Access Concurrency Limitations
Database Maintenance andOperations
Availability at Scale
8/7/2019 Sqlserver Ha
18/32
Failover ClusteringSQL Server 2005SQL Server 2005
Further refined in SQL Server 2005
More nodes
Match operating system limits
Unattended setup
Support for mounted volumes (Mount oints)
All SQL Server services participate Database Engine, SQL Server Agent,
Analysis Services, Full-Text Search, etc.
Failover ClusterFailover Cluster
8/7/2019 Sqlserver Ha
19/32
Database MirroringNewfor SQL Server 2005
Database MirroringNewfor SQL Server 2005
Instant Standby
Conceptually a fault-tolerant server
Database Failover Very Fast less than three seconds
Zero data loss
Automatic or manual failover
Automatic re-sync after failover
Automatic, transparent client redirect
Database MirroringDatabase Mirroring
8/7/2019 Sqlserver Ha
20/32
Database Mirroring
Hardware
Works with standard computers,
storage, and networks
No shared storage components,
virtually no distance limitations
Impact to transaction throughput
Zero to minimal, depending on
environment / workload
Database MirroringDatabase Mirroring
8/7/2019 Sqlserver Ha
21/32
Database MirroringHow itworks
MirrorMirrorrincipalrincipal
WitnessWitness
Log
Application
SQL Server SQL Server
2
2
4
51
Data DataLog
3>2 >3
Mirror is alwaysMirror is always
redoingredoing itit
remains currentremains currentCommit
8/7/2019 Sqlserver Ha
22/32
Witness and Quorum
Sole purpose of the Witness isto provide automatic failover
To survive the loss ofone server you
must have at least three Prevents split brain
Does a lost connection mean the partner is
down or is the network down?
To become the Principal, a server must
talk to at least one other server
WitnessWitness
8/7/2019 Sqlserver Ha
23/32
Witness
Witness is an instance of
SQL Server 2005
Single witness for multiple sessions
Consumes very little resources
Not a single point of failure
Partners can form quorum on their own
WitnessWitness
8/7/2019 Sqlserver Ha
24/32
Safety / Performance
There is a trade-off betweenperformance and safety
Database Mirroring has two safety
levels FULL commit when logged on Mirror Allows automatic failover
No data loss
OFF commit when logged on Principal System does its best to keep up
Prevents failover; to make mirror available
Must force service
Or terminate Database Mirroring session
8/7/2019 Sqlserver Ha
25/32
Transparent Client Redirect
No changes to application code Client automatically redirected if
session is dropped
Client library is aware ofPrincipal andMirror servers
Upon initial connect to Principal, library
caches Mirror name
When client attempts to reconnect
IfPrincipal is available, connects
If not, client library automatically redirects
connection to Mirror
8/7/2019 Sqlserver Ha
26/32
Database Mirroring Setup Steps1. Ensure SQL 2005 is installed on both the
principle & the mirror Server2. Setup Security (Endpoints)
3. Prepare the mirror database
4. Setup & Start the database mirroring session
5. Optionally add a witness
8/7/2019 Sqlserver Ha
27/32
DemoSQL 2005 Database Mirroring
8/7/2019 Sqlserver Ha
28/32
Database States for Database Mirroring SYNCHRONIZING
SYNCHRONIZED SUSPENDED
PENDING_FAILOVER
DISCONNECTED
8/7/2019 Sqlserver Ha
29/32
Automatic Failover Automatic Failover requires the following
conditions: Database mirroring running in synchronous mode
The database must be in a synchronised state
A witness must exist
During Failover the following actions occur:
The witness & mirror server agree the primary is dead,which puts the database into a suspend state
If possible the database on the Primary server changesto a disconnected state
The mirror finishes rolling forward and records the LSN
The mirror database comes online
When the principle returns, it becomes the mirror
8/7/2019 Sqlserver Ha
30/32
Failover SolutionsAtAGlance
Clustering & Mirroring both provide:
Automatic detection and failover
Manual failover
Transparent client connect
Database Mirroring
Database scope
Standard servers
Fastest failover
Limited reporting on standby
Duplicate copy of database
Failover Clustering
System scope
Certified hardware
Fast failover
No reporting on standby
Single copy of database
8/7/2019 Sqlserver Ha
31/32
Summary
How many 9s do you NEED?
SQL 2000 potential downtime ~3 mins
SQL 2005 potential downtime ~3 secs
Remember to consider process too!
8/7/2019 Sqlserver Ha
32/32
Feel free to contact us
Craig RyanNational Manager Database Services
Andrew Gannon
Business Development [email protected]
(03) 9427-1477