42
www.fromdual.com 1 / 42 MySQL Teamwork: Replication or Galera Cluster, [email protected], 2016 April, CC-BY-SA MySQL Servers Working as a Team - Replication or Galera Cluster Open Source Data Center Conference, April 26 th - 28 th , Berlin Jörg Brühe Senior Support Engineer, FromDual GmbH [email protected] CC-BY-SA

MySQL Servers Working as a Team - Replication or Galera ...€¦ · MySQL Teamwork: Replication or Galera Cluster, [email protected], 2016 April, CC-BY-SA 1 / 42 MySQL Servers

  • Upload
    others

  • View
    16

  • Download
    0

Embed Size (px)

Citation preview

Page 1: MySQL Servers Working as a Team - Replication or Galera ...€¦ · MySQL Teamwork: Replication or Galera Cluster, joerg.bruehe@fromdual.com, 2016 April, CC-BY-SA 1 / 42 MySQL Servers

www.fromdual.com

1 / 42MySQL Teamwork: Replication or Galera Cluster, [email protected], 2016 April, CC-BY-SA

MySQL Servers Working as a Team -Replication or Galera Cluster

Open Source Data Center Conference, April 26th - 28th, Berlin

Jörg BrüheSenior Support Engineer, FromDual GmbH

[email protected]

CC-BY-SA

Page 2: MySQL Servers Working as a Team - Replication or Galera ...€¦ · MySQL Teamwork: Replication or Galera Cluster, joerg.bruehe@fromdual.com, 2016 April, CC-BY-SA 1 / 42 MySQL Servers

www.fromdual.com

2 / 42MySQL Teamwork: Replication or Galera Cluster, [email protected], 2016 April, CC-BY-SA

FromDual GmbH

Support

remote-DBA

Training

Consulting

Page 3: MySQL Servers Working as a Team - Replication or Galera ...€¦ · MySQL Teamwork: Replication or Galera Cluster, joerg.bruehe@fromdual.com, 2016 April, CC-BY-SA 1 / 42 MySQL Servers

www.fromdual.com

3 / 42MySQL Teamwork: Replication or Galera Cluster, [email protected], 2016 April, CC-BY-SA

About Me

● Development distributed SQL-DBMSPorting mainframe -> Unix,Interface to archiver tools (ADSM, NetWorker)

● MySQL Build TeamRelease builds incl. tests, packaging, scripts, ...

● DBAMySQL running a web platform(master-master-replication)

● Support-Engineer (FromDual)Support + Remote-DBA for MySQL / MariaDB / Percona both with and without Galera Cluster

Page 4: MySQL Servers Working as a Team - Replication or Galera ...€¦ · MySQL Teamwork: Replication or Galera Cluster, joerg.bruehe@fromdual.com, 2016 April, CC-BY-SA 1 / 42 MySQL Servers

www.fromdual.com

4 / 42MySQL Teamwork: Replication or Galera Cluster, [email protected], 2016 April, CC-BY-SA

Contents

MySQL Server: Architecture

Binlog

Replication

Galera Cluster

Comparison

Examples / When (not) to Choose Which

Page 5: MySQL Servers Working as a Team - Replication or Galera ...€¦ · MySQL Teamwork: Replication or Galera Cluster, joerg.bruehe@fromdual.com, 2016 April, CC-BY-SA 1 / 42 MySQL Servers

www.fromdual.com

5 / 42MySQL Teamwork: Replication or Galera Cluster, [email protected], 2016 April, CC-BY-SA

General Remarks

● Concepts rather than details:”the forest, not the trees“

● MySQL 5.6 (established GA version)● Also valid for Percona and MariaDB

● Not applicable to ”embedded“ MySQL● Not considered: NDB = ”MySQL Cluster“

Page 6: MySQL Servers Working as a Team - Replication or Galera ...€¦ · MySQL Teamwork: Replication or Galera Cluster, joerg.bruehe@fromdual.com, 2016 April, CC-BY-SA 1 / 42 MySQL Servers

www.fromdual.com

6 / 42MySQL Teamwork: Replication or Galera Cluster, [email protected], 2016 April, CC-BY-SA

MySQL Server: Architecture

Binlog

Replication

Galera Cluster

Comparison

Examples / When (not) to Choose Which

Page 7: MySQL Servers Working as a Team - Replication or Galera ...€¦ · MySQL Teamwork: Replication or Galera Cluster, joerg.bruehe@fromdual.com, 2016 April, CC-BY-SA 1 / 42 MySQL Servers

www.fromdual.com

7 / 42MySQL Teamwork: Replication or Galera Cluster, [email protected], 2016 April, CC-BY-SA

Client-Server-DBMS

App App App

Server

Disk

Client (application)local or remote

Socket, LAN or internet

Server is separate process,multi-threaded: 1 thread per user session

Disk / SSD, local or SAN

Page 8: MySQL Servers Working as a Team - Replication or Galera ...€¦ · MySQL Teamwork: Replication or Galera Cluster, joerg.bruehe@fromdual.com, 2016 April, CC-BY-SA 1 / 42 MySQL Servers

www.fromdual.com

8 / 42MySQL Teamwork: Replication or Galera Cluster, [email protected], 2016 April, CC-BY-SA

Inside the Server

mysqld

MySQL ist eine multi-Thread und NICHT eine multi-Prozess Applikation!

Application / Client

ThreadCache

ConnectionManager

User Au-thentication

CommandDispatcherLogging

Query CacheModule

QueryCache

Parser

Optimizer

Access Control

Table Manager

Table OpenCache (.frm, fh)

Table DefinitionCache (tbl def.)

Handler Interface

MyISAM Memory NDB PBXTInnoDB ...Aria XtraDB Federated-X

Page 9: MySQL Servers Working as a Team - Replication or Galera ...€¦ · MySQL Teamwork: Replication or Galera Cluster, joerg.bruehe@fromdual.com, 2016 April, CC-BY-SA 1 / 42 MySQL Servers

www.fromdual.com

9 / 42MySQL Teamwork: Replication or Galera Cluster, [email protected], 2016 April, CC-BY-SA

MySQL Server: Architecture

Binlog

Replication

Galera Cluster

Comparison

Examples / When (not) to Choose Which

Page 10: MySQL Servers Working as a Team - Replication or Galera ...€¦ · MySQL Teamwork: Replication or Galera Cluster, joerg.bruehe@fromdual.com, 2016 April, CC-BY-SA 1 / 42 MySQL Servers

www.fromdual.com

10 / 42MySQL Teamwork: Replication or Galera Cluster, [email protected], 2016 April, CC-BY-SA

Layers + Binlog

MyI

SA

M

Inn

oD

B

...

Use

r th

read

2

Use

r th

read

1

...

SQL layer:- Parser- Optimizer- Privileges- Query Cache- …

Handler Interface

File layer:- Table Handler- InnoDB: - Row Access - Row Locks - Recovery - ...

Binlog:All dataand schemachanges

Page 11: MySQL Servers Working as a Team - Replication or Galera ...€¦ · MySQL Teamwork: Replication or Galera Cluster, joerg.bruehe@fromdual.com, 2016 April, CC-BY-SA 1 / 42 MySQL Servers

www.fromdual.com

11 / 42MySQL Teamwork: Replication or Galera Cluster, [email protected], 2016 April, CC-BY-SA

Binlog

● All data changes executed● All schema changes executed● Timestamps● Essential for Point-in-Time-Recovery ”PITR“● Independent of table handler ● Formats ”statement“, ”row“, and ”mixed“● Segments of configurable size● Numbered sequentially

Page 12: MySQL Servers Working as a Team - Replication or Galera ...€¦ · MySQL Teamwork: Replication or Galera Cluster, joerg.bruehe@fromdual.com, 2016 April, CC-BY-SA 1 / 42 MySQL Servers

www.fromdual.com

12 / 42MySQL Teamwork: Replication or Galera Cluster, [email protected], 2016 April, CC-BY-SA

MySQL Server: Architecture

Binlog

Replication

Galera Cluster

Comparison

Examples / When (not) to Choose Which

Page 13: MySQL Servers Working as a Team - Replication or Galera ...€¦ · MySQL Teamwork: Replication or Galera Cluster, joerg.bruehe@fromdual.com, 2016 April, CC-BY-SA 1 / 42 MySQL Servers

www.fromdual.com

13 / 42MySQL Teamwork: Replication or Galera Cluster, [email protected], 2016 April, CC-BY-SA

MySQL Replication

● Applications communicate with ”Master“● ”Master“ logs all changes● ”Slave“ has identical initial state

● Slave fetches all changes from masterand applies them locally

● Replication is running asynchronous● Slave stops replication on difference

Page 14: MySQL Servers Working as a Team - Replication or Galera ...€¦ · MySQL Teamwork: Replication or Galera Cluster, joerg.bruehe@fromdual.com, 2016 April, CC-BY-SA 1 / 42 MySQL Servers

www.fromdual.com

14 / 42MySQL Teamwork: Replication or Galera Cluster, [email protected], 2016 April, CC-BY-SA

Slave fetches binlog

Use

r th

read

2

Use

r th

read

1

...

Use

r th

read

3

MyI

SA

M

Inn

oD

B

...

Use

r th

read

2

Use

r th

read

1

...

SQ

L t

hre

ad

IO t

hre

ad

BinlogRelayLog

MyI

SA

M

Inn

oD

B

...

Slave:“log-bin = FILE”, or else no binlog“log_slave_updates = 1” for forwarding

Master:“log-bin = FILE”, or else no binlog (no master function)

Binlog

Page 15: MySQL Servers Working as a Team - Replication or Galera ...€¦ · MySQL Teamwork: Replication or Galera Cluster, joerg.bruehe@fromdual.com, 2016 April, CC-BY-SA 1 / 42 MySQL Servers

www.fromdual.com

15 / 42MySQL Teamwork: Replication or Galera Cluster, [email protected], 2016 April, CC-BY-SA

Typical Usage

● ”High Availability“● Geographic redundancy● Support higher read load

(= ”read scale-out“)● Read-only instance(s)

e.g. for backup or reports● Intentional delay is possible● Filtering (by DB or table) is possible

Page 16: MySQL Servers Working as a Team - Replication or Galera ...€¦ · MySQL Teamwork: Replication or Galera Cluster, joerg.bruehe@fromdual.com, 2016 April, CC-BY-SA 1 / 42 MySQL Servers

www.fromdual.com

16 / 42MySQL Teamwork: Replication or Galera Cluster, [email protected], 2016 April, CC-BY-SA

Replication Cascade

Use

r th

read

2

Us

er t

hre

ad 1

...

Us

er t

hre

ad 3

MyI

SA

M

Inn

oD

B

...

MyI

SA

M

Inn

oD

B

...

MyI

SA

M

Inn

oD

B

...

SQ

L t

hre

ad

IO t

hre

ad

Use

r th

read

2

Us

er t

hre

ad

1

...

SQ

L t

hre

ad

IO t

hre

ad

Use

r th

read

2

Use

r th

rea

d 1

...

● Recommended: ”read-only = 1“ on slave”log_slave_updates = 1“

● Multiple slaves per master are possible

Page 17: MySQL Servers Working as a Team - Replication or Galera ...€¦ · MySQL Teamwork: Replication or Galera Cluster, joerg.bruehe@fromdual.com, 2016 April, CC-BY-SA 1 / 42 MySQL Servers

www.fromdual.com

17 / 42MySQL Teamwork: Replication or Galera Cluster, [email protected], 2016 April, CC-BY-SA

Entries in Binlog

Original:● Identification by file name and position

● Replication: ”change master to ...“ specifyinghost, port, user, password, file, position

● See also: ”mysqldump ­­master­data“

From MySQL 5.6 also:● GTID = ”Global Transaction ID“

● Replication: ”change master to ...“ specifyinghost, port, user, password, ”auto_position = 1“

Page 18: MySQL Servers Working as a Team - Replication or Galera ...€¦ · MySQL Teamwork: Replication or Galera Cluster, joerg.bruehe@fromdual.com, 2016 April, CC-BY-SA 1 / 42 MySQL Servers

www.fromdual.com

18 / 42MySQL Teamwork: Replication or Galera Cluster, [email protected], 2016 April, CC-BY-SA

Master-Master-Replication

Use

r th

read

2

Use

r th

read

1

...

Use

r th

read

3

MyI

SA

M

Inn

oD

B

...

Use

r th

read

2

Use

r th

read

1

...

SQ

L t

hre

ad

IO t

hre

ad

BinlogRelayLog

MyI

SA

M

Inn

oD

B

...

Binlog

SQ

L t

hre

ad

IO t

hre

ad

RelayLog

● Overlapping changes are fatal!

Page 19: MySQL Servers Working as a Team - Replication or Galera ...€¦ · MySQL Teamwork: Replication or Galera Cluster, joerg.bruehe@fromdual.com, 2016 April, CC-BY-SA 1 / 42 MySQL Servers

www.fromdual.com

19 / 42MySQL Teamwork: Replication or Galera Cluster, [email protected], 2016 April, CC-BY-SA

Notes about Replication

● Master-Master is controversial, be careful!● Replication increases read throughput,

but not/barely write throughput● Replication causes file IO und network load● Format ”row“ is more efficient, but less readable● Multi-threaded replication since MySQL 5.6,

multi-master (”multi-source“) coming in MySQL 5.7● Big installation: booking.com

● Recommended: datacharmer.blogspot.de (Giuseppe Maxia, August 2015)

Page 20: MySQL Servers Working as a Team - Replication or Galera ...€¦ · MySQL Teamwork: Replication or Galera Cluster, joerg.bruehe@fromdual.com, 2016 April, CC-BY-SA 1 / 42 MySQL Servers

www.fromdual.com

20 / 42MySQL Teamwork: Replication or Galera Cluster, [email protected], 2016 April, CC-BY-SA

MySQL Server: Architecture

Binlog

Replication

Galera Cluster

Comparison

Examples / When (not) to Choose Which

Page 21: MySQL Servers Working as a Team - Replication or Galera ...€¦ · MySQL Teamwork: Replication or Galera Cluster, joerg.bruehe@fromdual.com, 2016 April, CC-BY-SA 1 / 42 MySQL Servers

www.fromdual.com

21 / 42MySQL Teamwork: Replication or Galera Cluster, [email protected], 2016 April, CC-BY-SA

Replication Weaknesses

● Asynchronous● Asymmetrical● Only one write node● Parallel writes may cause breakage● HA needs failover after node crash● Each node is SPOF for its slaves,

breakdown requires structure change● Dynamic changes are complicated

Page 22: MySQL Servers Working as a Team - Replication or Galera ...€¦ · MySQL Teamwork: Replication or Galera Cluster, joerg.bruehe@fromdual.com, 2016 April, CC-BY-SA 1 / 42 MySQL Servers

www.fromdual.com

22 / 42MySQL Teamwork: Replication or Galera Cluster, [email protected], 2016 April, CC-BY-SA

Better Alternative

● Synchronous transfer● Symmetrical cluster● Write accesses on all nodes● Distributed conflict analysis and handling● HA by continuity after node outage● Dynamic entry / exit of nodes supported

Page 23: MySQL Servers Working as a Team - Replication or Galera ...€¦ · MySQL Teamwork: Replication or Galera Cluster, joerg.bruehe@fromdual.com, 2016 April, CC-BY-SA 1 / 42 MySQL Servers

www.fromdual.com

23 / 42MySQL Teamwork: Replication or Galera Cluster, [email protected], 2016 April, CC-BY-SA

Galera Cluster

App App App

Load balancing (LB)

Node 2 Node 3Node 1

wsrep

Galera replication

wsrep wsrep

Inclusiding outage detectionand redirection for HA

“Working Set Replication”

Dedicated network preferred

Locale disks,each holding all data

= =

“shared nothing” architecture

Page 24: MySQL Servers Working as a Team - Replication or Galera ...€¦ · MySQL Teamwork: Replication or Galera Cluster, joerg.bruehe@fromdual.com, 2016 April, CC-BY-SA 1 / 42 MySQL Servers

www.fromdual.com

24 / 42MySQL Teamwork: Replication or Galera Cluster, [email protected], 2016 April, CC-BY-SA

Galera Properties (1)

+ Based on InnoDB (due to transactions and rollback)

+ Also transfers user definitions, privileges, ...

+ Quasi-synchronous transfer on commit,check for conflicts, efficient

+ Symmetrical, HA without server failover, quorum

+ No loss of transactions

+ Brings read scale-out, also some write increase

+ Dynamical entry / exit possible,synchronisation is automated

Page 25: MySQL Servers Working as a Team - Replication or Galera ...€¦ · MySQL Teamwork: Replication or Galera Cluster, joerg.bruehe@fromdual.com, 2016 April, CC-BY-SA 1 / 42 MySQL Servers

www.fromdual.com

25 / 42MySQL Teamwork: Replication or Galera Cluster, [email protected], 2016 April, CC-BY-SA

Order of Events

Graph by Vadim Tkachenko(Percona):

http://www.mysqlperformanceblog.com/2012/01/19/ percona-xtradb-cluster-feature-2-multi-master-replication/

Page 26: MySQL Servers Working as a Team - Replication or Galera ...€¦ · MySQL Teamwork: Replication or Galera Cluster, joerg.bruehe@fromdual.com, 2016 April, CC-BY-SA 1 / 42 MySQL Servers

www.fromdual.com

26 / 42MySQL Teamwork: Replication or Galera Cluster, [email protected], 2016 April, CC-BY-SA

Galera Properties (2)

- MySQL sources need patching(Codership offers binaries, ditto MariaDB and Percona)

- Beware of hot spots (rows)

- Conflict detection is late, full rollback(Check postponed till commit)

- Minimum size is 3 nodes

- Synchronisation time for large DB(mysqldump -> xtrabackup or rsync)

Page 27: MySQL Servers Working as a Team - Replication or Galera ...€¦ · MySQL Teamwork: Replication or Galera Cluster, joerg.bruehe@fromdual.com, 2016 April, CC-BY-SA 1 / 42 MySQL Servers

www.fromdual.com

27 / 42MySQL Teamwork: Replication or Galera Cluster, [email protected], 2016 April, CC-BY-SA

Certifiation at Commit

http://galeracluster.com/documentation-webpages/certificationbasedreplication.html

Page 28: MySQL Servers Working as a Team - Replication or Galera ...€¦ · MySQL Teamwork: Replication or Galera Cluster, joerg.bruehe@fromdual.com, 2016 April, CC-BY-SA 1 / 42 MySQL Servers

www.fromdual.com

28 / 42MySQL Teamwork: Replication or Galera Cluster, [email protected], 2016 April, CC-BY-SA

MySQL Server: Architecture

Binlog

Replication

Galera Cluster

Comparison

Examples / When (not) to Choose Which

Page 29: MySQL Servers Working as a Team - Replication or Galera ...€¦ · MySQL Teamwork: Replication or Galera Cluster, joerg.bruehe@fromdual.com, 2016 April, CC-BY-SA 1 / 42 MySQL Servers

www.fromdual.com

29 / 42MySQL Teamwork: Replication or Galera Cluster, [email protected], 2016 April, CC-BY-SA

Team of MySQL Servers

● Alternatives: Replication or Galera Cluster

● Redundancy of machine and storage● HA● Scale-out, esp. for read load● Instances for reports, analysis, backup● Data available locally (branch offices, ...)

Page 30: MySQL Servers Working as a Team - Replication or Galera ...€¦ · MySQL Teamwork: Replication or Galera Cluster, joerg.bruehe@fromdual.com, 2016 April, CC-BY-SA 1 / 42 MySQL Servers

www.fromdual.com

30 / 42MySQL Teamwork: Replication or Galera Cluster, [email protected], 2016 April, CC-BY-SA

Comparison (1)

Replication Galera

Standard Add-on product

All handlers InnoDB only

Upwards compatible Same versions

Minimum 2 nodes Minimum 3 nodes

HA by failover HA without changes

Communication:

Hierarchical, chain Symmetrical, parallel

Asynchronous Quasi-synchronous

Delay is configurable Immediate

Filtering is configurable Complete

Page 31: MySQL Servers Working as a Team - Replication or Galera ...€¦ · MySQL Teamwork: Replication or Galera Cluster, joerg.bruehe@fromdual.com, 2016 April, CC-BY-SA 1 / 42 MySQL Servers

www.fromdual.com

31 / 42MySQL Teamwork: Replication or Galera Cluster, [email protected], 2016 April, CC-BY-SA

Comparison (2)

Replication Galera

Read scale-Out Read scale-Out

Write unchanged Write increased

1 Master:

1* write 1* write

Local conflict :

Error on statement Error on statement

n Master:

n* write n* write

Distributed conflict:

Replication breakdown Rollback on commit

Page 32: MySQL Servers Working as a Team - Replication or Galera ...€¦ · MySQL Teamwork: Replication or Galera Cluster, joerg.bruehe@fromdual.com, 2016 April, CC-BY-SA 1 / 42 MySQL Servers

www.fromdual.com

32 / 42MySQL Teamwork: Replication or Galera Cluster, [email protected], 2016 April, CC-BY-SA

Comparison (3)

Replication Galera

Short interruption:

Replication resumes IST (incremental transfer)

Long interruption:

Replication resumes SST (full transfer)

Structure change:

Manual / separate Tool Automatic / dynamic

Initial setup:

Snapshot, Full transfer,

master remains available donor may be blocked

Page 33: MySQL Servers Working as a Team - Replication or Galera ...€¦ · MySQL Teamwork: Replication or Galera Cluster, joerg.bruehe@fromdual.com, 2016 April, CC-BY-SA 1 / 42 MySQL Servers

www.fromdual.com

33 / 42MySQL Teamwork: Replication or Galera Cluster, [email protected], 2016 April, CC-BY-SA

CAP Theorem

”For a distributed computer system,it is impossible to simultaneously provideall three of the following guarantees:● C = Consistency (identical data throughout)● A = Availability (system is operational)● P = Partition Tolerance (network outage)“

Eric Brewer, 1998 ff.https://en.wikipedia.org/wiki/CAP_theorem

Page 34: MySQL Servers Working as a Team - Replication or Galera ...€¦ · MySQL Teamwork: Replication or Galera Cluster, joerg.bruehe@fromdual.com, 2016 April, CC-BY-SA 1 / 42 MySQL Servers

www.fromdual.com

34 / 42MySQL Teamwork: Replication or Galera Cluster, [email protected], 2016 April, CC-BY-SA

Prospect: MySQL 5.7

● MySQL 5.7 is GA (5.7.9, 2015-Oct-21)

● Replication like in MySQL 5.6,added: multi-source replication(one slave reading from several masters)

● Codership is working on addingGalera Cluster to MySQL 5.7

● Oracle is working on ”Group replication“,currently available as ”labs release“(= ”not fit for production“)

Page 35: MySQL Servers Working as a Team - Replication or Galera ...€¦ · MySQL Teamwork: Replication or Galera Cluster, joerg.bruehe@fromdual.com, 2016 April, CC-BY-SA 1 / 42 MySQL Servers

www.fromdual.com

35 / 42MySQL Teamwork: Replication or Galera Cluster, [email protected], 2016 April, CC-BY-SA

MySQL Server: Architecture

Binlog

Replication

Galera Cluster

Comparison

Examples / When (not) to Choose Which

Page 36: MySQL Servers Working as a Team - Replication or Galera ...€¦ · MySQL Teamwork: Replication or Galera Cluster, joerg.bruehe@fromdual.com, 2016 April, CC-BY-SA 1 / 42 MySQL Servers

www.fromdual.com

36 / 42MySQL Teamwork: Replication or Galera Cluster, [email protected], 2016 April, CC-BY-SA

Communication Outage (1)

Galera Cluster: ● Isolated node has no quorum

=> will not serve applications● Quorum is at risk!● Active nodes write ”gcache“ to files,

storage period?● Switch to SST threatens

Page 37: MySQL Servers Working as a Team - Replication or Galera ...€¦ · MySQL Teamwork: Replication or Galera Cluster, joerg.bruehe@fromdual.com, 2016 April, CC-BY-SA 1 / 42 MySQL Servers

www.fromdual.com

37 / 42MySQL Teamwork: Replication or Galera Cluster, [email protected], 2016 April, CC-BY-SA

Communication Outage (2)

Replication: ● Master writes log segments to files● IO-Thread asks to read from binlog position /

GTID, retries periodical until successful● Avoid ”purge log“!

Replication is more tolerantthan Galera Cluster !

Page 38: MySQL Servers Working as a Team - Replication or Galera ...€¦ · MySQL Teamwork: Replication or Galera Cluster, joerg.bruehe@fromdual.com, 2016 April, CC-BY-SA 1 / 42 MySQL Servers

www.fromdual.com

38 / 42MySQL Teamwork: Replication or Galera Cluster, [email protected], 2016 April, CC-BY-SA

Global Production

Solution:Replication with

filtering

Requirement:Head office (D) andfactories (BR, CN, ...) with selective transfer

Page 39: MySQL Servers Working as a Team - Replication or Galera ...€¦ · MySQL Teamwork: Replication or Galera Cluster, joerg.bruehe@fromdual.com, 2016 April, CC-BY-SA 1 / 42 MySQL Servers

www.fromdual.com

39 / 42MySQL Teamwork: Replication or Galera Cluster, [email protected], 2016 April, CC-BY-SA

Parallel Writes + Conflict

Galera:● Retry of autocommit statements configurable● Transaction conflict causes rollback

=> Application repeats complete transaction

Replication:● Slave detects conflict, no contact to application

=> Replication stops

Replication needs admin action on conflict !

Page 40: MySQL Servers Working as a Team - Replication or Galera ...€¦ · MySQL Teamwork: Replication or Galera Cluster, joerg.bruehe@fromdual.com, 2016 April, CC-BY-SA 1 / 42 MySQL Servers

www.fromdual.com

40 / 42MySQL Teamwork: Replication or Galera Cluster, [email protected], 2016 April, CC-BY-SA

Hot Spot

● Replication: frequent aborts● Galera: frequent rollbacks

=> Agree on a single write node !

Page 41: MySQL Servers Working as a Team - Replication or Galera ...€¦ · MySQL Teamwork: Replication or Galera Cluster, joerg.bruehe@fromdual.com, 2016 April, CC-BY-SA 1 / 42 MySQL Servers

www.fromdual.com

41 / 42MySQL Teamwork: Replication or Galera Cluster, [email protected], 2016 April, CC-BY-SA

High Availability

Replication:● Failover manual (reaction time) or automated

(correct?)● Slave lag, selection of new master

Galera:● Symmetrical, no change of roles● Virtually synchronous replication (no lag)

=> Advantage Galera

Page 42: MySQL Servers Working as a Team - Replication or Galera ...€¦ · MySQL Teamwork: Replication or Galera Cluster, joerg.bruehe@fromdual.com, 2016 April, CC-BY-SA 1 / 42 MySQL Servers

www.fromdual.com

42 / 42MySQL Teamwork: Replication or Galera Cluster, [email protected], 2016 April, CC-BY-SA

Q & A

Questions ?

Discussion?

● FromDual provides neutral and independent:● Consulting● Remote-DBA● Support for MySQL, Galera, Percona Server and MariaDB● Training

www.fromdual.com/presentations