db spof(mssql, my sql)

21
DB SPOF MySQL, MSSQL

Upload: -

Post on 13-Apr-2017

67 views

Category:

Engineering


1 download

TRANSCRIPT

Page 1: Db spof(mssql, my sql)

DB SPOFMySQL, MSSQL

Page 2: Db spof(mssql, my sql)

Contents• MySQL• MSSQL

Page 3: Db spof(mssql, my sql)

Contents• MySQL• MSSQL

Page 4: Db spof(mssql, my sql)

3-High Availability Architecture1. Replication2. Clustering & Virtualization3. Shared-Nothing, Failover Clusters

Page 5: Db spof(mssql, my sql)

1. Replication• Master-slave

– Database updates are replicated from a master to either one or more slaves

– Master logs the changes to the database– Slaves applies the logs

• Replication modes– Asynchronous (default)– Semi-synchronous– Synchronous

Page 6: Db spof(mssql, my sql)

Replication Workflow

Session thread processes queries from the applicationDump thread reads events from binary log and sends them to a slaveI/O thread receives replication events and stores them in slave’s relay logSQL thread reads replication events from slave’s relay log and applies them to slave database

Page 7: Db spof(mssql, my sql)

Replication topology• Replication can be deployed in a range of topolo-

gies to support diverse scaling and high avail-ability

Page 8: Db spof(mssql, my sql)

2. Clustering & Virtualiza-tion

• Clustering solutions– Oracle VM Template– Solaris Cluster– Windows Cluster– DRBD

• Windows Cluster– Requirements

• Windows Server 2008 R2• Network Connections between

nodes and storage• Shared Storage (SAN)

Page 9: Db spof(mssql, my sql)

3. Shared-Nothing, Failover Clusters• Data synchronously replicated to all nodes within the node

group– Reduces fail-over times

• Nodes can be distributed across multiple hosts– Allows to operate even during hardware failure

• Each data node has its own disk and memory– A failure in shared storage does not cause an outage

Page 10: Db spof(mssql, my sql)

Comparison of MySQL SolutionsReplication

Clustering & Virtual-ization

(Windows Server)Shared-Nothing,Failover Clusters

Supported Storage En-gine

All (InnoDB for Auto Failover) InnoDB NDB (for auto-sharding,

failover and recovery)Auto IP Failover No Yes Yes

Auto Database Failover Yes Yes YesAuto Data Resynchro-nization Yes N/A –Shared Storage Yes

Failover Time > 5s > 5s + InnoDB Recov-ery Time < 1s

Replication Mode Asynchronous / Semi-Synchronous N/A – Shared Storage Synchronous

Shared Storage No, distributed across nodes Yes No, distributed across

nodes

# of Nodes Master & Multiple Slaves

Active / Passive Master + Multiple Slaves 255 + Multiple Slaves

Availability Design Level 99.9% 99.95% 99.999%

Page 11: Db spof(mssql, my sql)

Contents• MySQL• MSSQL• NP?

Page 12: Db spof(mssql, my sql)

4-High Availability Technologies1. Log Shipping2. Transactional Replication3. Database Mirroring4. Failover Clustering

Page 13: Db spof(mssql, my sql)

1. Log Shipping• Primary / Secondary server(s)

– Based on transaction log restore process– Backup, copy, restore, repeat…– Cannot guarantee zero data loss

• Warm standby solution– Does not have mechanism to automate failover

• The failures are not automatically detected– Extra logic must be added to the client or in a mid tier

Page 14: Db spof(mssql, my sql)

Log Shipping Configuration• One primary server runs the transaction log backup job• Three secondary servers run its own copy job and restore job• One monitor server receives history from both primary and secon-

daries

Page 15: Db spof(mssql, my sql)

2. Transactional Replication• Publisher• Subscriber• Distributor

• Replication Flow– Committed transactions are read

from the transaction log– Stored in the distribution database on

the distributor– Applied to the subscription databases

Page 16: Db spof(mssql, my sql)

Transactional Replication• Limitations

– Warm standby solution• Does not provide automatic detection of failure and auto-

matic failover to a subscriber– Data loss

• There is latency between a transaction occurring on the publisher and being propagated to the subscribers

– Only protects the data in the publication• It cannot be used to protect the entire database or group of

databases

Page 17: Db spof(mssql, my sql)

3. Database Mirroring• Provides a redundant copy of a single database

– Main database(principle) / Redundant database(mirror)– Allows only a single mirror

Page 18: Db spof(mssql, my sql)

Database Mirroring• Synchronous mirroring with witness server

– High-availability mode• The mirror can initiate failover automatically

– Hot standby solution

• Synchronous mirroring without witness server– High-safety mode– Warm standby solution

• Asynchronous mirroring– High-performance mode– Warm standby solution

Page 19: Db spof(mssql, my sql)

4. Failover Clustering• The only technology that allows an entire SQL Server instance to

be made high-available– Leverages Windows Failover Cluster service

• Shared storage– There is only one copy of the data

• Hot standby solution

Page 20: Db spof(mssql, my sql)

Comparison of SQL Server Solutions

Log Shipping Replication Mirroring Failover Clus-tering

Automatic Failover No No Yes (high-availability mode) Yes

Failure Detection No No Yes (high-availability mode) Yes

Hot/Warm Standby Warm Warm Hot/Warm HotAutomatic Applica-tion Redirection No No Yes Yes

Relative Cost Low Low Low High

Page 21: Db spof(mssql, my sql)

References• MySQL

– High availability• http://www.mysql.com/products/cluster/availability.html

• SQL Server– High availability

• http://technet.microsoft.com/en-us/library/ee523927(v=sql.100).aspx

– Failure cluster• http://www.brentozar.com/archive/2012/02/introduction-sql-server-c

lusters/