Coeo SQL Server 2008 High Availability
-
Upload
deepakshiva -
Category
Documents
-
view
230 -
download
0
Transcript of Coeo SQL Server 2008 High Availability
-
7/29/2019 Coeo SQL Server 2008 High Availability
1/34
Justin Langford
Principal Consultant
-
7/29/2019 Coeo SQL Server 2008 High Availability
2/34
The business continuity problem
Cold/ Warm/ Hot Standby Solutions
Failover Clustering
Database Mirroring
Combining Availability Technologies
-
7/29/2019 Coeo SQL Server 2008 High Availability
3/34
Fundamentals No failover, potential data lossBackup and RestoreThird party solutions: storage snapshots, VDI
Detach/ Attach
Distributed Data Manual failover, possible data lossLog ShippingPeer-to-peer replication
Database Mirroring (High Performance mode)
Data Mirroring (third party hardware/ software mirroring
High Availability Automatic failover, no data lossDatabase Mirroring (High Availability mode)
Failover clustering
Multi-site (Geo) clusters
-
7/29/2019 Coeo SQL Server 2008 High Availability
4/34
Application
Software
System
Software
Hardware
Majority of downtimeattributed to System Admins
Application Software can
improve fault tolerance
System Software can help atall levels
Commodity hardware nowvery reliable
Operator
-
7/29/2019 Coeo SQL Server 2008 High Availability
5/34
we need zerodowntime,zero data
loss
Evaluating business continuity solutions
Automatic or Manual DetectionAutomatic or Manual FailoverFailover timeNumber of failures survivedData Currency / LossData ConsistencyGranularity: Instance, Database, Table, Page, Row
Cost - hardware, network, additional managementComplexity
Recovery Point Interval/ Recovery Time Interval
-
7/29/2019 Coeo SQL Server 2008 High Availability
6/34
Transparency to clients
-
7/29/2019 Coeo SQL Server 2008 High Availability
7/34
The business continuity problem
Cold/ Warm/ Hot Standby Solutions
Failover Clustering
Database Mirroring
Combining Availability Technologies
-
7/29/2019 Coeo SQL Server 2008 High Availability
8/34
Manual detection and failoverPotential for data lossClients must be redirected
Slowest failover most downtime
Backup / Restore Log backups allow point in time restore
Detach / Copy / Attach Copies entire files No rolling forward logs
Backup / Restore
Detach / Copy / Attach
Backup/ Restore & Detach/ Attach
-
7/29/2019 Coeo SQL Server 2008 High Availability
9/34
Manual detection and failover
Replication since SQL Server 6.0
Primarily used where availability is required in
conjunction with scale out of read activity
Failover requires custom solution Could define subset of source database
Latency between source and copy can be seconds
Log Shipping
Basic idea: Backup, Copy, Restore Log will always be
supported
Database scope
Database accessible but read-only
Users must exit for next log to be applied
Log Shipping
Replication
Replication and Log Shipping
-
7/29/2019 Coeo SQL Server 2008 High Availability
10/34
SQL Server 2005 introduced bi-directional
transactional replication
Enables scale-out and improved availabilityWarm / hot standby Possibility of data loss on failure
SQL Server 2008 improvements
Conflict detection
Each row has a hidden column listing originating peer node ID for change
Distribution Agent on each node detects conflicts by comparing hidden column
New Topology Wizard makes setup/ changes easier
Peer-to-PeerTransactionalReplication
Peer-to-Peer Transactional Replication
-
7/29/2019 Coeo SQL Server 2008 High Availability
11/34
Both solutions provide Automatic detection Automatic, fast failover
Manual failover Transparent client redirection Zero work loss Site redundancy
Database Mirroring
Failover Cluster
Failover clustering and Database Mirroring
-
7/29/2019 Coeo SQL Server 2008 High Availability
12/34
The business continuity problem
Cold/ Warm/ Hot Standby Solutions
Failover Clustering
Database Mirroring
Combining Availability Technologies
-
7/29/2019 Coeo SQL Server 2008 High Availability
13/34
Hot Standby Automatic detection and failoverMultiple nodes provide availability
Failover transparent to client
Windows Server 2008 EE supports 16 node clusters
Windows 2008 clusters must pass validation tests (no HCL)
Supports many scenarios: Multiple Active Instances, N+1, N+I
N+1: N Active, 1 Inactive
Instances
Inst2 *
* Inst1
Multiple Active Instances
Inst2 *
* Inst1
Inst3 *
N+I: N Active, I Inactive
Instances
Failover Cluster
* Inst1
SRV1 SRV2
-
7/29/2019 Coeo SQL Server 2008 High Availability
14/34
Node Majority
Each node has a vote
Cluster functions with majority of votes
Node and Disk Majority
Each node plus the disk witness can vote
Cluster functions with majority of votes
Node and File Share Majority
Each node plus the file share witness can vote
Cluster functions with majority of votes
No Majority: Disk Only
Cluster functions if one node is available with quorum disk presented
Nodes in communication with quorum disk are cluster members
Failover Cluster
* Inst1
Majority
meansmore than
half
F il Cl
-
7/29/2019 Coeo SQL Server 2008 High Availability
15/34
Choosing a Quorum Model
Failover Cluster
* Inst1
Description of Cluster Quorum Recommendation
Odd number of nodes Node Majority
Even number of nodes (single site) Node and Disk Majority
Even nodes, multi-site cluster Node and File Share Majority
F il Cl t
-
7/29/2019 Coeo SQL Server 2008 High Availability
16/34
Zero work loss, minimal impact on throughput
Instance Failover entire instance works as a unit
Single copy of databases
Available since SQL Server 7.0
No standby reporting, testing etc.
Single cluster can support multiple instances
Can provide site fault-tolerance
Failover Cluster
* Inst1
F il Cl t
-
7/29/2019 Coeo SQL Server 2008 High Availability
17/34
No remote execution on cluster nodes
Run SQL Server setup to Install/ uninstall / upgrade nodes
Option 1: Integrated installation with Add Node
Configure single-node cluster instance
Run SQL Server Setup with Add Node functionality to add each node
Option2: Advanced/Enterprise installationRun Setup with Prepare Failover Cluster on each node
Run Setup on node owning shared disks to Complete Failover Cluster
Failover Cluster
New setup for SQL Server 2008
-
7/29/2019 Coeo SQL Server 2008 High Availability
18/34
Site redundancySQL Server requires single-subnet
Stretch VLAN between sites
Requires synchronous storage replication
Performance dependent on network RTT
Configure Heartbeat timeout
Increase to extend clusters over further distances
Decrease to increase failure sensitivity for fasterfailover
Two Quorum configurations suitable for multi-sitefailover clusters
-
7/29/2019 Coeo SQL Server 2008 High Availability
19/34
STORAGE REPLICATION
Site B
SAN
\\SERV1\CLUS1
File Share
Witness
Site C
Site A
SAN
Node and File Share Majority
-
7/29/2019 Coeo SQL Server 2008 High Availability
20/34
Site B
SAN
Site A
SAN
Node Majority
STORAGE REPLICATION
-
7/29/2019 Coeo SQL Server 2008 High Availability
21/34
The business continuity problem
Cold/ Warm/ Hot Standby Solutions
Failover Clustering
Database Mirroring
Combining Availability Technologies
Database Mirroring
-
7/29/2019 Coeo SQL Server 2008 High Availability
22/34
Hot StandbyProvides a fault-tolerant database
Database Failover
Very fast failover
-
7/29/2019 Coeo SQL Server 2008 High Availability
23/34
MirrorPrincipal
Witness
Log
Application
SQL Server SQL Server
2
2
4
51
Data DataLog
3>2 >3
Mirror alwaysredoing log toremain current
Commit
-
7/29/2019 Coeo SQL Server 2008 High Availability
24/34
High Availability - synchronous mirroring with a witness
Automatic detection/failover
No data loss
High Protection - synchronous mirroring without a witness
Manual failover
No data loss, downtime possible
High Performance - asynchronous mirroring
Manual failover
Data loss possible
Trade off: Performance vs. Safety
-
7/29/2019 Coeo SQL Server 2008 High Availability
25/34
Available in SQL Server 2008 Enterprise EditionAutomatic Page Repair
Auto-resolve some errors that prevent reading a page
Retrieve fresh copy from partner
Unreadable page is replaced by the copy
Repairs are asynchronous
Query on principal accessing corrupt page will fail
If mirror accesses corrupt page - mirroring session issuspended
-
7/29/2019 Coeo SQL Server 2008 High Availability
26/34
Not all errors can be repaired
823, 824 errors - Windows returns a CRC error when reading page
829 errors restore pending
Pages that cannot be repaired include:
file header page
database boot page
allocation bitmap pages (GAM, SGAM, PFS)
New DMV sys.dm_db_mirroring_auto_page_repair
Repair logged to SQL Server Error log
... Error: 824, Severity: 24, State: 2.
... SQL Server detected a logical consistency-based I/O error: incorrect checksum ...
... Database mirroring is attempting to repair physical page (4:4256) in database MyDB" by requesting a copy from the partner.
... Database mirroring successfully repaired physical page (4:4256) in database MyDB" by obtaining a copy from the partner.
-
7/29/2019 Coeo SQL Server 2008 High Availability
27/34
Log compression
DBM performance affected by network performance
Useful low-bandwidth scenarios
Outgoing log stream - principal to mirror compressed Requires CPU to compress/ decompress
Can be disabled
High-bandwidth network performance
Heavy duty, fully-logged maintenance operations when
mirroring is involved (e.g. index rebuild)
-
7/29/2019 Coeo SQL Server 2008 High Availability
28/34
Greatest improvement for low bandwidth networks
Log Compression Transactions/ second
-
7/29/2019 Coeo SQL Server 2008 High Availability
29/34
CPU usage
sometimes x2
Compressionoverhead
Increased
transaction
throughput
CPU Usage with Log Compression
-
7/29/2019 Coeo SQL Server 2008 High Availability
30/34
The business continuity problemCold/ Warm/ Hot Standby Solutions
Failover Clustering
Database Mirroring
Combining Availability Technologies
-
7/29/2019 Coeo SQL Server 2008 High Availability
31/34
Maximize availability for
Scale outOffload primary data platform
Heavy reporting
Mobile/disconnected users
Autonomous business units that share data
Maximize availability of critical systems
Designed for failover
Fast, automatic
Zero data loss
Transactionally current
Masks planned and unplanned downtime
Replication
Failover Solutions
-
7/29/2019 Coeo SQL Server 2008 High Availability
32/34
Fault-Tolerant Publisher and Distributor
Subscribers
Distributor
PublisherFailover Solution + Replication
-
7/29/2019 Coeo SQL Server 2008 High Availability
33/34
Principal Server can be a Failover Cluster Failover to mirror will occur before failover within the
cluster
Principal will assume role of Mirror
Mirror can be a Failover Cluster as well
Principal Mirror
Failover Cluster Failover Cluster
-
7/29/2019 Coeo SQL Server 2008 High Availability
34/34
Attribute Failover Cluster Log Shipping Database Mirroring
Automatic failover Yes No Yes, in High Safety
Perceived downtime 30 secs + recovery n/a < 5 secs
Potential data loss Single copy of dataYes, most recenttransaction log
Yes, in someconfigurations
Masking storage
failureNo Yes Yes
Special hardware Must pass validation No No
ScopeSystem and user
databasesUser databases User databases