3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric...

145
3 / 147

Transcript of 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric...

Page 1: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

3 / 147

Page 2: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

MySQL HA so easy ? That's insane !

MySQL 8.0 InnoDB Cluster is a very easy High Availability solution forMySQL

Frédéric Descamps - MySQL Community Manager - Oracle

4 / 147

Page 3: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Save the date !

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

5 / 147

Page 4: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

 

Safe Harbor StatementThe following is intended to outline our general product direction. It is intended forinformation purpose only, and may not be incorporated into any contract. It is not acommitment to deliver any material, code, or functionality, and should not be relied up inmaking purchasing decisions. The development, release and timing of any features orfunctionality described for Oracle´s product remains at the sole discretion of Oracle.

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

6 / 147

Page 5: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

about me - http://about.me/lefred

Who am I ?

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

7 / 147

Page 6: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Frédéric Descamps@lefredMySQL EvangelistHacking MySQL since 3.23devops believerliving in Belgium 🇧🇪http://lefred.be

 

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

8 / 147

Page 7: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

MySQL InnoDB Cluster: vision  "A single product - MySQL - with high availability and scaling features baked in;providing an integrated end-to-end solution that is easy to use."

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

9 / 147

Page 8: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

MySQL InnoDB Cluster: vision  "A single product - MySQL - with high availability and scaling features baked in;providing an integrated end-to-end solution that is easy to use."

InnoDB

cluster

Ease-of-Use

Extreme Scale-Out

Out-of-Box Solution

Built-in HA

High Performance

Everything Integrated

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

10 / 147

Page 9: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

One Product: MySQL

All components created togetherTested togetherPackaged together

Easy to Use

One client: MySQL ShellEasy packagingIntegrated orchestrationHomogenous servers

Flexible and Modern

SQL and NoSQL togetherProtocol BuffersAsynchronous APIDeveloper friendly

Support Read/Write Scale Out

Shared clustersFederated system of N replica sets

supporting cross shardoperations

Each replica set manages a shard

MySQL InnoDB Cluster: goals

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

11 / 147

Page 10: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

MySQL InnoDB Cluster Architecture

A

p

p

l

i

c

a

t

i

o

n

M

y

S

Q

L

C

o

n

n

e

c

t

o

r

M

y

S

Q

L

R

o

u

t

e

r

M

y

S

Q

L

S

h

e

l

l

I

n

n

o

D

B

c

l

u

s

t

e

r

A

p

p

l

i

c

a

t

i

o

n

M

y

S

Q

L

C

o

n

n

e

c

t

o

r

M

y

S

Q

L

R

o

u

t

e

r

M

p

M

M

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

12 / 147

Page 11: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Let's start with the demo, shall we ?

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

13 / 147

Page 12: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

14 / 147

Page 13: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

15 / 147

Page 14: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

16 / 147

Page 15: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Group Replication: heart of MySQL InnoDBCluster

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

17 / 147

Page 16: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Group Replication: heart of MySQL InnoDBCluster

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

18 / 147

Page 17: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

MySQL Group Replication

but what is it ?!?

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

19 / 147

Page 18: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

MySQL Group Replication

but what is it ?!?

GR is a plugin for MySQL, made by MySQL and packaged with MySQL

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

20 / 147

Page 19: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

MySQL Group Replication

but what is it ?!?

GR is a plugin for MySQL, made by MySQL and packaged with MySQLGR is an implementation of Replicated Database State Machine theory

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

21 / 147

Page 20: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

MySQL Group Replication

but what is it ?!?

GR is a plugin for MySQL, made by MySQL and packaged with MySQLGR is an implementation of Replicated Database State Machine theoryGR allows to write on all Group Members (cluster nodes) simultaneously whileretaining consistency

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

22 / 147

Page 21: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

MySQL Group Replication

but what is it ?!?

GR is a plugin for MySQL, made by MySQL and packaged with MySQLGR is an implementation of Replicated Database State Machine theoryGR allows to write on all Group Members (cluster nodes) simultaneously whileretaining consistencyGR implements conflict detection and resolution

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

23 / 147

Page 22: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

MySQL Group Replication

but what is it ?!?

GR is a plugin for MySQL, made by MySQL and packaged with MySQLGR is an implementation of Replicated Database State Machine theoryGR allows to write on all Group Members (cluster nodes) simultaneously whileretaining consistencyGR implements conflict detection and resolutionGR allows automatic distributed recovery

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

24 / 147

Page 23: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

MySQL Group Replication

but what is it ?!?

GR is a plugin for MySQL, made by MySQL and packaged with MySQLGR is an implementation of Replicated Database State Machine theoryGR allows to write on all Group Members (cluster nodes) simultaneously whileretaining consistencyGR implements conflict detection and resolutionGR allows automatic distributed recoverySupported on all MySQL platforms !!

Linux, Windows, Solaris, OSX, FreeBSD

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

25 / 147

Page 24: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

And what does it means for users ?

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

26 / 147

Page 25: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

And what does it means for users ?no longer necessary to handle server fail-over manually or with a complicated script

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

27 / 147

Page 26: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

And what does it means for users ?no longer necessary to handle server fail-over manually or with a complicated scriptGR provides fault tolerance

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

28 / 147

Page 27: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

And what does it means for users ?no longer necessary to handle server fail-over manually or with a complicated scriptGR provides fault toleranceGR enables update-everywhere setups

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

29 / 147

Page 28: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

And what does it means for users ?no longer necessary to handle server fail-over manually or with a complicated scriptGR provides fault toleranceGR enables update-everywhere setupsGR handles crashes, failures, re-connetcs automatically

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

30 / 147

Page 29: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

And what does it means for users ?no longer necessary to handle server fail-over manually or with a complicated scriptGR provides fault toleranceGR enables update-everywhere setupsGR handles crashes, failures, re-connetcs automaticallyAllows an easy setup of a MySQL service high available !

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

31 / 147

Page 30: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Default = Single Primary ModeBy default, MySQL InnoDB Cluster runs in Single Primary Mode.

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

32 / 147

Page 31: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Default = Single Primary ModeBy default, MySQL InnoDB Cluster runs in Single Primary Mode.

mysql> show global variables like 'group_replication_single_primary_mode';+---------------------------------------+-------+| Variable_name | Value |+---------------------------------------+-------+| group_replication_single_primary_mode | ON |+---------------------------------------+-------+

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

33 / 147

Page 32: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Default = Single Primary ModeBy default, MySQL InnoDB Cluster runs in Single Primary Mode.

mysql> show global variables like 'group_replication_single_primary_mode';+---------------------------------------+-------+| Variable_name | Value |+---------------------------------------+-------+| group_replication_single_primary_mode | ON |+---------------------------------------+-------+

In Single Primary Mode, a single member acts as the writable master (PRIMARY) andthe rest of the members act as hot-standbys (SECONDARY).

The group itself coordinates and configures itself automatically to determine whichmember will act as the PRIMARY, through a leader election mechanism.

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

34 / 147

Page 33: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

35 / 147

Page 34: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

MySQL RouterMySQL Router is lightweight middleware that provides transparent routing between yourapplication and backend MySQL Servers. It can be used for a wide variety of use cases,such as providing high availability and scalability by effectively routing database trafficto appropriate backend MySQL Servers.

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

36 / 147

Page 35: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

MySQL RouterMySQL Router is lightweight middleware that provides transparent routing between yourapplication and backend MySQL Servers. It can be used for a wide variety of use cases,such as providing high availability and scalability by effectively routing database trafficto appropriate backend MySQL Servers.

MySQL Router doesn´t require any specific configuration. It configures itselfautomatically (bootstrap) using MySQL InnoDB Cluster´s metadata.

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

37 / 147

Page 36: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

ProxySQL has native support for GroupReplication which makes it a good choicefor advanced users.

ProxySQLIf you need some specific features that are not yet available in MySQL Router, liketransparent R/W splitting, then you can use your software of choice.

We are also collaborating with ProxySQL.

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

38 / 147

Page 37: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

MySQL ShellThe MySQL Shell is an interactive Javascript, Python, or SQL interface supportingdevelopment and administration for the MySQL Server and is a component of the MySQLServer. You can use the MySQL Shell to perform data queries and updates as well asvarious administration operations.

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

39 / 147

Page 38: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

MySQL Shell (2)The MySQL Shell provides:

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

40 / 147

Page 39: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

MySQL Shell (2)The MySQL Shell provides:

Both Interactive and Batch operations

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

41 / 147

Page 40: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

MySQL Shell (2)The MySQL Shell provides:

Both Interactive and Batch operationsDocument and Relational Models

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

42 / 147

Page 41: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

MySQL Shell (2)The MySQL Shell provides:

Both Interactive and Batch operationsDocument and Relational ModelsCRUD Document and Relational APIs via scripting

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

43 / 147

Page 42: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

MySQL Shell (2)The MySQL Shell provides:

Both Interactive and Batch operationsDocument and Relational ModelsCRUD Document and Relational APIs via scriptingTraditional Table, JSON, Tab Separated output results formats

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

44 / 147

Page 43: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

MySQL Shell (2)The MySQL Shell provides:

Both Interactive and Batch operationsDocument and Relational ModelsCRUD Document and Relational APIs via scriptingTraditional Table, JSON, Tab Separated output results formatsMySQL Standard and X Protocols

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

45 / 147

Page 44: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

MySQL Shell (2)The MySQL Shell provides:

Both Interactive and Batch operationsDocument and Relational ModelsCRUD Document and Relational APIs via scriptingTraditional Table, JSON, Tab Separated output results formatsMySQL Standard and X Protocolsand more...

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

46 / 147

Page 45: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

New since MySQL 8.0.11The Shell improved a lot and uses all the enhancements part of MySQL 8:

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

47 / 147

Page 46: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

New since MySQL 8.0.11The Shell improved a lot and uses all the enhancements part of MySQL 8:

set persists

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

48 / 147

Page 47: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

New since MySQL 8.0.11The Shell improved a lot and uses all the enhancements part of MySQL 8:

set persists

restart

This makes the remote administration very easy and cloud friendly.

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

49 / 147

Page 48: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

don´t forget, this is a HA solution !

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

50 / 147

Page 49: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Thank you !

Any Questions ?

share your 💕 for MySQL on social media using @MySQL #DataOpsBarcelona

more at http://lefred.be/content/category/mysql/group-replication/http://mysqlhighavailability.com/

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

51 / 147

Page 50: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

want to know more?

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

52 / 147

Page 51: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

GR is nice, but how does it work ?

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

53 / 147

Page 52: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

GR is nice, but how does it work ?

it´s just ...

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

54 / 147

Page 53: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

GR is nice, but how does it work ?

it´s just ...

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

55 / 147

Page 54: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

GR is nice, but how does it work ?

it´s just ...

... no, in fact the writesets replication is synchronous and then certification and apply ofthe changes are local to each nodes and asynchronous.

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

56 / 147

Page 55: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

GR is nice, but how does it work ?

it´s just ...

... no, in fact the writesets replication is synchronous and then certification and apply ofthe changes are local to each nodes and asynchronous.

not that easy to understand... right ? As a picture is worth a 1000 words, let´s illustratethis...

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

57 / 147

Page 56: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

MySQL Group Replication

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

58 / 147

Page 57: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

MySQL Group Replication

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

59 / 147

Page 58: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

MySQL Group Replication

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

60 / 147

Page 59: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

MySQL Group Replication

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

61 / 147

Page 60: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

MySQL Group Replication

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

62 / 147

Page 61: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

MySQL Group Replication

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

63 / 147

Page 62: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

MySQL Group Replication

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

64 / 147

Page 63: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

MySQL Group Replication

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

65 / 147

Page 64: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

MySQL Group Replication

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

66 / 147

Page 65: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

MySQL Group Replication

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

67 / 147

Page 66: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

MySQL Group Replication

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

68 / 147

Page 67: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

MySQL Group Replication

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

69 / 147

Page 68: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

MySQL Group Replication (full transaction)

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

70 / 147

Page 69: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

MySQL Group Replication (full transaction)

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

71 / 147

Page 70: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

MySQL Group Replication (full transaction)

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

72 / 147

Page 71: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

MySQL Group Replication (full transaction)

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

73 / 147

Page 72: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

MySQL Group Replication (full transaction)

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

74 / 147

Page 73: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

MySQL Group Replication (full transaction)

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

75 / 147

Page 74: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

MySQL Group Replication (full transaction)

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

76 / 147

Page 75: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

MySQL Group Replication (full transaction)

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

77 / 147

Page 76: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

MySQL Group Replication (full transaction)

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

78 / 147

Page 77: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

MySQL Group Communication System (GCS)MySQL Xcom protocol

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

79 / 147

Page 78: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

MySQL Group Communication System (GCS)MySQL Xcom protocolReplicated Database State Machine

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

80 / 147

Page 79: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

MySQL Group Communication System (GCS)MySQL Xcom protocolReplicated Database State MachinePaxos based protocol

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

81 / 147

Page 80: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

MySQL Group Communication System (GCS)MySQL Xcom protocolReplicated Database State MachinePaxos based protocolits task: deliver messages across the distributed system:

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

82 / 147

Page 81: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

MySQL Group Communication System (GCS)MySQL Xcom protocolReplicated Database State MachinePaxos based protocolits task: deliver messages across the distributed system:

atomically

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

83 / 147

Page 82: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

MySQL Group Communication System (GCS)MySQL Xcom protocolReplicated Database State MachinePaxos based protocolits task: deliver messages across the distributed system:

atomicallyin Total Order

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

84 / 147

Page 83: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

MySQL Group Communication System (GCS)MySQL Xcom protocolReplicated Database State MachinePaxos based protocolits task: deliver messages across the distributed system:

atomicallyin Total Order

MySQL Group Replication receives the Ordered 'tickets' from this GCS subsystem.

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

85 / 147

Page 84: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Group Replication : Total Order Delivery - GTID

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

86 / 147

Page 85: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Group Replication : Total Order Delivery - GTID

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

87 / 147

Page 86: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Group Replication : Total Order Delivery - GTID

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

88 / 147

Page 87: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Group Replication : Total Order Delivery - GTID

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

89 / 147

Page 88: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Group Replication : Total Order Delivery - GTID

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

90 / 147

Page 89: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Group Replication : Total Order Delivery - GTID

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

91 / 147

Page 90: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Group Replication : Total Order Delivery - GTID

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

92 / 147

Page 91: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Group Replication : Total Order Delivery - GTID

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

93 / 147

Page 92: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Group Replication : Total Order Delivery - GTID

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

94 / 147

Page 93: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Group Replication : Total Order Delivery - GTID

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

95 / 147

Page 94: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Group Replication : Total Order Delivery - GTID

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

96 / 147

Page 95: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Group Replication : Total Order Delivery - GTID

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

97 / 147

Page 96: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Group Replication : Total Order Delivery - GTID

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

98 / 147

Page 97: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Group Replication : Total Order Delivery - GTID

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

99 / 147

Page 98: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Group Replication : Total Order Delivery - GTID

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

100 / 147

Page 99: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Group Replication : Total Order Delivery - GTID

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

101 / 147

Page 100: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Group Replication : Total Order Delivery - GTID

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

102 / 147

Page 101: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Group Replication : Total Order Delivery - GTID

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

103 / 147

Page 102: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Group Replication : Total Order Delivery - GTID

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

104 / 147

Page 103: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Group Replication: return commitAsynchronous Replication:

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

105 / 147

Page 104: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Group Replication: return from commit (2)Semi-Sync Replication:

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

106 / 147

Page 105: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Group Replication: return from commit (3)Group Replication:

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

107 / 147

Page 106: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Does this mean we can have a distant node andalways let it ack later ?

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

108 / 147

Page 107: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Does this mean we can have a distant node andalways let it ack later ?

NO!

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

109 / 147

Page 108: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Does this mean we can have a distant node andalways let it ack later ?

NO!

There will be always a penalty to pay. For example if you have 3 members, every 3rd writethe system will be affected by the lartency... why ?

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

110 / 147

Page 109: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Does this mean we can have a distant node andalways let it ack later ?

NO!

There will be always a penalty to pay. For example if you have 3 members, every 3rd writethe system will be affected by the lartency... why ?

That´s because the system has to wait for the noop (single skip message) from the“distant” node.

More info: http://lefred.be/content/mysql-group-replication-about-ack-from-majority/

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

111 / 147

Page 110: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Group Replication : Optimistic LockingGroup Replication uses optimistic locking

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

112 / 147

Page 111: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Group Replication : Optimistic LockingGroup Replication uses optimistic locking

during a transaction, local (InnoDB) locking happens

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

113 / 147

Page 112: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Group Replication : Optimistic LockingGroup Replication uses optimistic locking

during a transaction, local (InnoDB) locking happensoptimistically assumes there will be no conflicts across nodes (no communication between nodes necessary)

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

114 / 147

Page 113: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Group Replication : Optimistic LockingGroup Replication uses optimistic locking

during a transaction, local (InnoDB) locking happensoptimistically assumes there will be no conflicts across nodes (no communication between nodes necessary)cluster-wide conflict resolution happens only at COMMIT, during certification

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

115 / 147

Page 114: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Group Replication : Optimistic LockingGroup Replication uses optimistic locking

during a transaction, local (InnoDB) locking happensoptimistically assumes there will be no conflicts across nodes (no communication between nodes necessary)cluster-wide conflict resolution happens only at COMMIT, during certification

Let´s first have a look at the traditional locking to compare.

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

116 / 147

Page 115: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Traditional locking

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

117 / 147

Page 116: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Traditional locking

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

118 / 147

Page 117: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Traditional locking

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

119 / 147

Page 118: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Traditional locking

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

120 / 147

Page 119: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Traditional locking

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

121 / 147

Page 120: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Traditional locking

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

122 / 147

Page 121: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Optimistic Locking

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

123 / 147

Page 122: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Optimistic Locking

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

124 / 147

Page 123: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Optimistic Locking

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

125 / 147

Page 124: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Optimistic Locking

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

126 / 147

Page 125: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Optimistic Locking

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

127 / 147

Page 126: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Optimistic Locking

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

128 / 147

Page 127: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Optimistic Locking

The system returns error 149 as certification failed:

ERROR 1180 (HY000): Got error 149 during COMMIT

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

129 / 147

Page 128: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Such conflicts happen only when using multi-primary group !

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

130 / 147

Page 129: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

CertificationCertification is the process that only needs to answer the following unique question:

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

131 / 147

Page 130: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

CertificationCertification is the process that only needs to answer the following unique question:

can the write (transaction) be applied ?

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

132 / 147

Page 131: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

CertificationCertification is the process that only needs to answer the following unique question:

can the write (transaction) be applied ?based on unapplied earlier transactions

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

133 / 147

Page 132: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

CertificationCertification is the process that only needs to answer the following unique question:

can the write (transaction) be applied ?based on unapplied earlier transactionssuch conflicts must come for other members/nodes

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

134 / 147

Page 133: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

CertificationCertification is the process that only needs to answer the following unique question:

can the write (transaction) be applied ?based on unapplied earlier transactionssuch conflicts must come for other members/nodes

happens on every member/node

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

135 / 147

Page 134: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

CertificationCertification is the process that only needs to answer the following unique question:

can the write (transaction) be applied ?based on unapplied earlier transactionssuch conflicts must come for other members/nodes

happens on every member/nodeshould be deterministic on every node

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

136 / 147

Page 135: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

CertificationCertification is the process that only needs to answer the following unique question:

can the write (transaction) be applied ?based on unapplied earlier transactionssuch conflicts must come for other members/nodes

happens on every member/nodeshould be deterministic on every noderesults are not reported to the group

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

137 / 147

Page 136: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

CertificationCertification is the process that only needs to answer the following unique question:

can the write (transaction) be applied ?based on unapplied earlier transactionssuch conflicts must come for other members/nodes

happens on every member/nodeshould be deterministic on every noderesults are not reported to the group

pass: enter in the apply queue

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

138 / 147

Page 137: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

CertificationCertification is the process that only needs to answer the following unique question:

can the write (transaction) be applied ?based on unapplied earlier transactionssuch conflicts must come for other members/nodes

happens on every member/nodeshould be deterministic on every noderesults are not reported to the group

pass: enter in the apply queuefail: drop the transaction

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

139 / 147

Page 138: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

CertificationCertification is the process that only needs to answer the following unique question:

can the write (transaction) be applied ?based on unapplied earlier transactionssuch conflicts must come for other members/nodes

happens on every member/nodeshould be deterministic on every noderesults are not reported to the group

pass: enter in the apply queuefail: drop the transaction

serialized by the total order in GCS/XCOM + GTID

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

140 / 147

Page 139: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

CertificationCertification is the process that only needs to answer the following unique question:

can the write (transaction) be applied ?based on unapplied earlier transactionssuch conflicts must come for other members/nodes

happens on every member/nodeshould be deterministic on every noderesults are not reported to the group

pass: enter in the apply queuefail: drop the transaction

serialized by the total order in GCS/XCOM + GTIDcost is based on trx size (# rows & # keys)

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

141 / 147

Page 140: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

CertificationCertification is the process that only needs to answer the following unique question:

can the write (transaction) be applied ?based on unapplied earlier transactionssuch conflicts must come for other members/nodes

happens on every member/nodeshould be deterministic on every noderesults are not reported to the group

pass: enter in the apply queuefail: drop the transaction

serialized by the total order in GCS/XCOM + GTIDcost is based on trx size (# rows & # keys)first committer (and ack from majority) wins rule

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

142 / 147

Page 141: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Drawbacks of optimistic lockinghaving a first-committer-wins system means conflicts will more likely happen whenwriting on multiple members with:

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

143 / 147

Page 142: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Drawbacks of optimistic lockinghaving a first-committer-wins system means conflicts will more likely happen whenwriting on multiple members with:

large transactions

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

144 / 147

Page 143: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Drawbacks of optimistic lockinghaving a first-committer-wins system means conflicts will more likely happen whenwriting on multiple members with:

large transactions

long running transactions

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

145 / 147

Page 144: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Drawbacks of optimistic lockinghaving a first-committer-wins system means conflicts will more likely happen whenwriting on multiple members with:

large transactions

long running transactions

hotspot records

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

146 / 147

Page 145: 3 / 147 · MySQL 8.0 InnoDB Cluster is a very easy High Availability solution for MySQL Frédéric Descamps - MySQL Community Manager - Oracle 4 / 147. ... Shared clusters Federated

Thank you !

Any Questions ?

share your 💕 for MySQL on social media using @MySQL #DataOpsBarcelona

more at http://lefred.be/content/category/mysql/group-replication/http://mysqlhighavailability.com/

Copyright @ 2018 Oracle and/or its affiliates. All rights reserved.

147 / 147