various mysql high availability (ha) solutions · extremely high throughput (if done correctly)...

24
www.fromdual.com 1 Various MySQL High Availability (HA) Solutions Percona Live MySQL Conference, London, Oct 24 th and 25 th , 2011 Oli Sennhauser Senior MySQL Consultant at FromDual GmbH [email protected]

Upload: others

Post on 22-May-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Various MySQL High Availability (HA) Solutions · Extremely high throughput (if done correctly) Good for read AND write New beast to tame (MySQL Cluster != MySQL!) More complex to

www.fromdual.com 1

Various MySQLHigh Availability (HA) Solutions

Percona Live MySQL Conference,London, Oct 24th and 25th, 2011

Oli SennhauserSenior MySQL Consultant at FromDual GmbH

[email protected]

Page 2: Various MySQL High Availability (HA) Solutions · Extremely high throughput (if done correctly) Good for read AND write New beast to tame (MySQL Cluster != MySQL!) More complex to

www.fromdual.com 2

About FromDual GmbH (LLC)

● FromDual provides neutral and independent:● Consulting for MySQL (on-site and remote)● Remote-DBA Services / MySQL Operations● Premium Support (ex. MySQL Basic and Silver)● Training for MySQL

● Consulting partner of the Open Database Alliance (ODBA.org)

● Oracle Silver Partner (OPN)● More information you can find at:

http://www.fromdual.com

Page 3: Various MySQL High Availability (HA) Solutions · Extremely high throughput (if done correctly) Good for read AND write New beast to tame (MySQL Cluster != MySQL!) More complex to

www.fromdual.com 3

Various MySQL High Availability (HA) Solu-tions

➢ MySQL Replication / MySQL Scale-Out➢ High-Availability with Replication➢ Master-Master Replication➢ Active/passive fail-over with SAN➢ Active/passive fail-over with DRBD➢ Galera (synchronous) Replication➢ MySQL Cluster➢ Tungsten Replicator

Contents

Page 4: Various MySQL High Availability (HA) Solutions · Extremely high throughput (if done correctly) Good for read AND write New beast to tame (MySQL Cluster != MySQL!) More complex to

www.fromdual.com 4

MySQL Scale-Out vs Scale-Up

Scale-Out

● Costs● MySQL Design● Physical bottlenecks

Scale-Up

● „Relaxation of Constraints“

Page 5: Various MySQL High Availability (HA) Solutions · Extremely high throughput (if done correctly) Good for read AND write New beast to tame (MySQL Cluster != MySQL!) More complex to

www.fromdual.com 5

High-Availability with Replication

Application

Master

Slave Backup

Load balancer

Slave 1

Slave Reporting

Slave 2

Slave 3

rtw

read only

...

async!Slave

M

● Fail-over?

VIP

Page 6: Various MySQL High Availability (HA) Solutions · Extremely high throughput (if done correctly) Good for read AND write New beast to tame (MySQL Cluster != MySQL!) More complex to

www.fromdual.com 6

Replication fail-over

Application

Master

Slave Backup

Load balancer

Slave 1

Slave Reporting

Slave 2

Slave 3

rtw

read only

...

async!Slave

M

VIP

Page 7: Various MySQL High Availability (HA) Solutions · Extremely high throughput (if done correctly) Good for read AND write New beast to tame (MySQL Cluster != MySQL!) More complex to

www.fromdual.com 7

Advantages / Disadvantages

Simple „standard“ Set-up

Master is a SpoF! (Single Point of Failure)

If master fails → which Slave becomes new master?

Switch → a lot of work, delicate!

There are tools to help (MMM v1/v2, MHA, Tungsten, ...)

Fail-over Site is already warm/hot!

Works very well if r >> w

Data inconsistencies (mk-table-check/sync)

Delay Master/Slave

Slave lagging (Slave as bottleneck)

Page 8: Various MySQL High Availability (HA) Solutions · Extremely high throughput (if done correctly) Good for read AND write New beast to tame (MySQL Cluster != MySQL!) More complex to

www.fromdual.com 8

Master-Master Replikation

App App App

M1

Slave1

Slave2

SlaveBackup

Load balancer (LB)

M2

VIP

Slave3

Page 9: Various MySQL High Availability (HA) Solutions · Extremely high throughput (if done correctly) Good for read AND write New beast to tame (MySQL Cluster != MySQL!) More complex to

www.fromdual.com 9

Master-Master Replication

App App App

M1

Slave1

Slave2

SlaveBackup

Load balancer (LB)

M2

VIP

Slave3

Page 10: Various MySQL High Availability (HA) Solutions · Extremely high throughput (if done correctly) Good for read AND write New beast to tame (MySQL Cluster != MySQL!) More complex to

www.fromdual.com 10

Advantages / Disadvantages

Only slightly more complex than Master/Slave

Careful when writing on both Masters!

For a “balanced” system at least 2 Slaves are needed

You will NOT get more I/O throughput!

Data in-consitency possible because of asynchronous replication

Fail-over Site is already warm/hot!

Works very well if r >> w

Data inconsistencies (mk-table-check/sync)

If Master fails, half of the Slave are out of sync!

A little more complicated to (re-)set-up

Delay Master/Slave

Slave lagging (Slave as bottleneck)

Page 11: Various MySQL High Availability (HA) Solutions · Extremely high throughput (if done correctly) Good for read AND write New beast to tame (MySQL Cluster != MySQL!) More complex to

www.fromdual.com 11

Active/passive fail-over with SAN

App App App

M'

SAN

Slave1

Slave2

Slave3

Load balancing (LB)

M

VIP

Page 12: Various MySQL High Availability (HA) Solutions · Extremely high throughput (if done correctly) Good for read AND write New beast to tame (MySQL Cluster != MySQL!) More complex to

www.fromdual.com 12

Active/passive fail-over with SAN

● SPOF! App App App

M'

SAN

Slave1

Slave2

Slave3

Load balancing (LB)

M

VIP

!!!

Page 13: Various MySQL High Availability (HA) Solutions · Extremely high throughput (if done correctly) Good for read AND write New beast to tame (MySQL Cluster != MySQL!) More complex to

www.fromdual.com 13

Advantages / Disadvantages

Synchronous replication

● I/O throughput depends on SAN (I/O system)

No data IN-consistencies possible

SAN is a SpoF!

Expensive if SAN is not available yet.

SAN's are not easy to handle!

Fail-over Site is still cold!

Half of the hardware is idling

Only one possible Data source

Slaves are automatically and properly fail-overed

Far more complex to set-up

Page 14: Various MySQL High Availability (HA) Solutions · Extremely high throughput (if done correctly) Good for read AND write New beast to tame (MySQL Cluster != MySQL!) More complex to

www.fromdual.com 14

Active/passive fail-over with DRBD

App App App

M'

Slave1

Slave2

Slave3

Load balancing (LB)

M

VIP

DRBD“Poor man's SAN”

Page 15: Various MySQL High Availability (HA) Solutions · Extremely high throughput (if done correctly) Good for read AND write New beast to tame (MySQL Cluster != MySQL!) More complex to

www.fromdual.com 15

Active/passive fail-over with DRBD

App App App

M'

Slave1

Slave2

Slave3

Load balancing (LB)

M

VIP

DRBD

Page 16: Various MySQL High Availability (HA) Solutions · Extremely high throughput (if done correctly) Good for read AND write New beast to tame (MySQL Cluster != MySQL!) More complex to

www.fromdual.com 16

Advantages / Disadvantages

Synchronous replication

No data IN-consistencies possible

I/O throughput lower

Slaves are automatically and properly fail-overed

Fail-over Site is still cold!

Half of the hardware is idling

Only one possible Data source

Far more complex to set-up

Page 17: Various MySQL High Availability (HA) Solutions · Extremely high throughput (if done correctly) Good for read AND write New beast to tame (MySQL Cluster != MySQL!) More complex to

www.fromdual.com 17

Galera (synchronous) Replication

App App App

Load balancing (LB)

Node 2 Node 3Node 1

wsrep

Galera replicationwsrep wsrep

Page 18: Various MySQL High Availability (HA) Solutions · Extremely high throughput (if done correctly) Good for read AND write New beast to tame (MySQL Cluster != MySQL!) More complex to

www.fromdual.com 18

Galera (synchronous) Replication

App App App

Load balancing (LB)

Node 2 Node 3Node 1

wsrep

Galera replicationwsrep wsrep

Page 19: Various MySQL High Availability (HA) Solutions · Extremely high throughput (if done correctly) Good for read AND write New beast to tame (MySQL Cluster != MySQL!) More complex to

www.fromdual.com 19

Advantages / Disadvantages

Synchronous replication

Based on InnoDB SE (other SE theoretically possible)

Active-active real multi-master topology

Read and write to any cluster node

Automatic membership control

True parallel replication, on row level

No slave lag

No lost transactions

Read AND write scalability (Read Scale-Out!)

Patch off MySQL binaries (Codership provides binaries)

Be aware of Hot Spots on rows

Higher probability of dead locks

Full sync blocks for writing → 3 nodes

Initial sync for very big databases (>>50 Gbyte) with mysqldump

Page 20: Various MySQL High Availability (HA) Solutions · Extremely high throughput (if done correctly) Good for read AND write New beast to tame (MySQL Cluster != MySQL!) More complex to

www.fromdual.com 20

MySQL Cluster

MySQLServer

NDB Cluster(Data nodes)

MySQLServer

MySQLServer

ndbd ndbd

ndbdndbd

mgmd

MGM client

SQL nodes

mgmd

MGM client

Data nodes / Mgmt nodes

App App App

Load balancing (LB)

Page 21: Various MySQL High Availability (HA) Solutions · Extremely high throughput (if done correctly) Good for read AND write New beast to tame (MySQL Cluster != MySQL!) More complex to

www.fromdual.com 21

Advantages / Disadvantages

Synchronous replication

No data IN-consistencies possible

Extremely high throughput (if done correctly)

Good for read AND write

New beast to tame (MySQL Cluster != MySQL!)

More complex to set-up and operate than normal MySQL

Not for disaster fail-over (<= 7.1)

Bad for complex queries (Joins, <= 7.1)

At least 3 machines (better 4) are need.

High demand on RAM and Network

Only one possible Data source

Page 22: Various MySQL High Availability (HA) Solutions · Extremely high throughput (if done correctly) Good for read AND write New beast to tame (MySQL Cluster != MySQL!) More complex to

www.fromdual.com 22

Tungsten Replicator

Page 23: Various MySQL High Availability (HA) Solutions · Extremely high throughput (if done correctly) Good for read AND write New beast to tame (MySQL Cluster != MySQL!) More complex to

www.fromdual.com 23

Advantages / Disadvantages

● Similar to MySQL Replication

Introduces Global Transaction-ID

Asynchronous Replication

Bases on MySQL Binary Log

For: MySQL, PostgreSQL, Oracle and Drizzle

Requires Java and Ruby?

Multi Source Replication

Failover should be easier to handle

Page 24: Various MySQL High Availability (HA) Solutions · Extremely high throughput (if done correctly) Good for read AND write New beast to tame (MySQL Cluster != MySQL!) More complex to

www.fromdual.com 24

Questions ?

Discussion ?