1 / 143 - Percona · High Availability High availability is a characteristic of a system, which...

143
1 / 143

Transcript of 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which...

Page 1: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

1 / 143

Page 2: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

2 / 143

Page 3: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

Percona University, Ghent, Belgium June2017

MySQL InnoDB Cluster

MySQL High Availability made easy

 

 

 

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

3 / 143

Page 4: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

 

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 @ 2017 Oracle and/or its affiliates. All rights reserved.

4 / 143

Page 5: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

about.me/lefred

Who am I ?

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

5 / 143

Page 6: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

Frédéric Descamps@lefredMySQL EvangelistHacking MySQL since 3.23devops believerMySQL Community Manager since May2016living in Belgium 🇧🇪

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

6 / 143

Page 7: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

MySQL InnoDB Cluster

Easy MySQL High Availability

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

7 / 143

Page 8: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

InnoDB

cluster

Ease-of-Use

Extreme Scale-Out

Out-of-Box Solution

Built-in HA

High Performance

Everything Integrated

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

8 / 143

Page 9: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

Our vision in 4 steps

MySQL Document Store

Relational & Document Models

MySQL HA

Out-Of-Box HA

Read Scale-Out

Async Replication + Auto Failover

Write Scale-Out

Sharding

E1

E3

E2 E4

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

9 / 143

Page 10: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

Step 2´s 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 @ 2017 Oracle and/or its affiliates. All rights reserved.

10 / 143

Page 11: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

Step 3´s ArchitectureA

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

S1 S2 S3 S4 S...

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

11 / 143

Page 12: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

Step 4´s ArchitectureA

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

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

I

n

n

o

D

B

c

l

u

s

t

e

r

M

p

M

M

S2 S3 S4 S...S1

I

n

n

o

D

B

c

l

u

s

t

e

r

M

p

M

M

S1 S2 S3 S4 S...

I

n

n

o

D

B

c

l

u

s

t

e

r

M

p

M

M

S1 S2 S3 S4 S...

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

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

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

replicaset 1

replicaset 2

replicaset 3

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

12 / 143

Page 13: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

Group Replication: heart of MySQL InnoDBCluster

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

13 / 143

Page 14: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

Group Replication: heart of MySQL InnoDBCluster

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

14 / 143

Page 15: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

But before going further...

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

15 / 143

Page 16: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

What is

High Availability ?

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

16 / 143

Page 17: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

High AvailabilityHigh availability is a characteristic of a system, which aims to ensure an agreed level ofoperational performance, usually uptime, for a higher than normal period.

There are three principles of systems design in reliability engineering which can helpachieve high availability:

Elimination of single points of failure. This means adding redundancy to the systemso that failure of a component does not mean failure of the entire system.Reliable crossover. In redundant systems, the crossover point itself tends to becomea single point of failure. Reliable systems must provide for reliable crossover.Detection of failures as they occur. If the two principles above are observed, then auser may never see a failure. But the maintenance activity must.

Source: WikipediaCopyright @ 2017 Oracle and/or its affiliates. All rights reserved.

17 / 143

Page 18: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

Database Redundancy

How to achieve it ?

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

18 / 143

Page 19: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

Database Redundancy

How to achieve it ?

Multiple solutions exist, some worse than the others ;-)

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

19 / 143

Page 20: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

Database Redundancy

How to achieve it ?

Multiple solutions exist, some worse than the others ;-)

use of share storage

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

20 / 143

Page 21: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

Database Redundancy

How to achieve it ?

Multiple solutions exist, some worse than the others ;-)

use of share storageuse of share blocs by network (drbd)

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

21 / 143

Page 22: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

Database Redundancy

How to achieve it ?

Multiple solutions exist, some worse than the others ;-)

use of share storageuse of share blocs by network (drbd)use of MySQL replication

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

22 / 143

Page 23: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

Database Redundancy

How to achieve it ?

Multiple solutions exist, some worse than the others ;-)

use of share storageuse of share blocs by network (drbd)use of MySQL replication

Of course the last one is the technique most spread, more flexible and more reliable.

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

23 / 143

Page 24: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

MySQL ReplicationThere are multiple types of MySQL replication:

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

24 / 143

Page 25: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

MySQL ReplicationThere are multiple types of MySQL replication:

asynchronous replication (async)

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

25 / 143

Page 26: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

MySQL ReplicationThere are multiple types of MySQL replication:

asynchronous replication (async)semi-synchronous replication (semi-sync)

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

26 / 143

Page 27: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

MySQL ReplicationThere are multiple types of MySQL replication:

asynchronous replication (async)semi-synchronous replication (semi-sync)group replication - since (5.7.17) !!

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

27 / 143

Page 28: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

Asynchronous Replication(s)replicas (also called slaves) stream the replication logs from a unique master (multi-source replication is possible since 5.7.6)

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

28 / 143

Page 29: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

Asynchronous Replication(s)replicas (also called slaves) stream the replication logs from a unique master (multi-source replication is possible since 5.7.6)slaves can be laging (having delay), there is no delivery guarantee (unless for semi-sync)

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

29 / 143

Page 30: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

Asynchronous Replication(s)replicas (also called slaves) stream the replication logs from a unique master (multi-source replication is possible since 5.7.6)slaves can be laging (having delay), there is no delivery guarantee (unless for semi-sync)replicas provisioning is manual

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

30 / 143

Page 31: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

Asynchronous Replication(s)replicas (also called slaves) stream the replication logs from a unique master (multi-source replication is possible since 5.7.6)slaves can be laging (having delay), there is no delivery guarantee (unless for semi-sync)replicas provisioning is manualdata consistency on replicas is assumed and needs a manual verification

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

31 / 143

Page 32: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

Asynchronous Replication(s)replicas (also called slaves) stream the replication logs from a unique master (multi-source replication is possible since 5.7.6)slaves can be laging (having delay), there is no delivery guarantee (unless for semi-sync)replicas provisioning is manualdata consistency on replicas is assumed and needs a manual verificationit´s even possible to create circular replication (highly not recommended)

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

32 / 143

Page 33: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

Asynchronous Replication(s)replicas (also called slaves) stream the replication logs from a unique master (multi-source replication is possible since 5.7.6)slaves can be laging (having delay), there is no delivery guarantee (unless for semi-sync)replicas provisioning is manualdata consistency on replicas is assumed and needs a manual verificationit´s even possible to create circular replication (highly not recommended)write operations are safe only from a unique global master

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

33 / 143

Page 34: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

Asynchronous Replication(s)complex topologies can be built

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

34 / 143

Page 35: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

Asynchronous Replication(s)complex topologies can be built

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

35 / 143

Page 36: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

Asynchronous Replication(s)complex topologies can be built

1

32

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

36 / 143

Page 37: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

Asynchronous Replication(s)complex topologies can be built

1

32

4

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

37 / 143

Page 38: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

Asynchronous Replication(s)complex topologies can be built

1

32

45

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

38 / 143

Page 39: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

Asynchronous Replication(s)complex topologies can be built

1

32

45

6 7 8

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

39 / 143

Page 40: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

Asynchronous Replication(s)complex topologies can be built

1

32

45

6 7 8

9

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

40 / 143

Page 41: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

Asynchronous Replication(s)complex topologies can be built

1

32

45

6 7 8

9

10

14

15

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

41 / 143

Page 42: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

Asynchronous Replication(s)complex topologies can be built

1

32

45

6 7 8

9

1011

14

15

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

42 / 143

Page 43: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

Asynchronous Replication(s)complex topologies can be built

1

32

45

6 7 8

9

1011

12

14

15

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

43 / 143

Page 44: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

Asynchronous Replication(s)complex topologies can be built

1

32

45

6 7 8

9

1011

12

13

14

15

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

44 / 143

Page 45: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

Asynchronous Replication(s)complex topologies can be built

1

32

45

6 7 8

9

1011

12

13

14

15

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

45 / 143

Page 46: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

MySQL HA Architectures with asynchronousreplicationIt exists a lot of possible architectures and as much tools to enforce them.

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

46 / 143

Page 47: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

MySQL HA Architectures with asynchronousreplicationIt exists a lot of possible architectures and as much tools to enforce them.

They are all based on the same principle:

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

47 / 143

Page 48: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

MySQL HA Architectures with asynchronousreplicationIt exists a lot of possible architectures and as much tools to enforce them.

They are all based on the same principle:

1 master

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

48 / 143

Page 49: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

MySQL HA Architectures with asynchronousreplicationIt exists a lot of possible architectures and as much tools to enforce them.

They are all based on the same principle:

1 master1 or many replicas (slaves)

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

49 / 143

Page 50: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

MySQL HA Architectures with asynchronousreplicationIt exists a lot of possible architectures and as much tools to enforce them.

They are all based on the same principle:

1 master1 or many replicas (slaves)

If the master as an issue, the most accurate slave needs to takeover the role and bepromoted as master for all the remaining slaves still online.

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

50 / 143

Page 51: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

Automation

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

51 / 143

Page 52: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

AutomationAnd this is the most complicated part...

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

52 / 143

Page 53: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

AutomationAnd this is the most complicated part...

It exists a large amount of external tools that can be used to achieve this task. Most ofthem are only compatible with GNU/Linux.

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

53 / 143

Page 54: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

AutomationAnd this is the most complicated part...

It exists a large amount of external tools that can be used to achieve this task. Most ofthem are only compatible with GNU/Linux.

Their problem is that they create complexity in the architecture's design. You need to beDBA & sysadmin to manage those solutions:

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

54 / 143

Page 55: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

AutomationAnd this is the most complicated part...

It exists a large amount of external tools that can be used to achieve this task. Most ofthem are only compatible with GNU/Linux.

Their problem is that they create complexity in the architecture's design. You need to beDBA & sysadmin to manage those solutions:

MySQL-Utilities (mysqlrplcheck, mysqlrpladmin)

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

55 / 143

Page 56: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

AutomationAnd this is the most complicated part...

It exists a large amount of external tools that can be used to achieve this task. Most ofthem are only compatible with GNU/Linux.

Their problem is that they create complexity in the architecture's design. You need to beDBA & sysadmin to manage those solutions:

MySQL-Utilities (mysqlrplcheck, mysqlrpladmin)Pacemaker with MySQL dedicated OCF

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

56 / 143

Page 57: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

AutomationAnd this is the most complicated part...

It exists a large amount of external tools that can be used to achieve this task. Most ofthem are only compatible with GNU/Linux.

Their problem is that they create complexity in the architecture's design. You need to beDBA & sysadmin to manage those solutions:

MySQL-Utilities (mysqlrplcheck, mysqlrpladmin)Pacemaker with MySQL dedicated OCFcustom solutions...

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

57 / 143

Page 58: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

MySQL Group Replication

but what is it ?!?

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

58 / 143

Page 59: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

MySQL Group Replication

but what is it ?!?

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

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

59 / 143

Page 60: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

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 @ 2017 Oracle and/or its affiliates. All rights reserved.

60 / 143

Page 61: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

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 uses a Paxos based protocol

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

61 / 143

Page 62: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

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 uses a Paxos based protocolGR allows to write on all Group Members (cluster nodes) simultaneously whileretaining consistency

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

62 / 143

Page 63: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

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 uses a Paxos based protocolGR allows to write on all Group Members (cluster nodes) simultaneously whileretaining consistencyGR implements conflict detection and resolution

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

63 / 143

Page 64: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

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 uses a Paxos based protocolGR allows to write on all Group Members (cluster nodes) simultaneously whileretaining consistencyGR implements conflict detection and resolutionGR allows automatic distributed recovery

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

64 / 143

Page 65: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

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 uses a Paxos based protocolGR 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 @ 2017 Oracle and/or its affiliates. All rights reserved.

65 / 143

Page 66: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

And for users ?

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

66 / 143

Page 67: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

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

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

67 / 143

Page 68: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

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

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

68 / 143

Page 69: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

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

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

69 / 143

Page 70: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

And 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 @ 2017 Oracle and/or its affiliates. All rights reserved.

70 / 143

Page 71: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

And 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 @ 2017 Oracle and/or its affiliates. All rights reserved.

71 / 143

Page 72: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

OK, but how does it work ?

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

72 / 143

Page 73: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

OK, but how does it work ?

it's just ...

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

73 / 143

Page 74: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

OK, but how does it work ?

it's just ...

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

74 / 143

Page 75: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

OK, 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 @ 2017 Oracle and/or its affiliates. All rights reserved.

75 / 143

Page 76: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

OK, 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 @ 2017 Oracle and/or its affiliates. All rights reserved.

76 / 143

Page 77: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

MySQL Group Replication

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

77 / 143

Page 78: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

MySQL Group Replication

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

78 / 143

Page 79: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

MySQL Group Replication

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

79 / 143

Page 80: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

MySQL Group Replication

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

80 / 143

Page 81: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

MySQL Group Replication

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

81 / 143

Page 82: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

MySQL Group Replication

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

82 / 143

Page 83: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

MySQL Group Replication

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

83 / 143

Page 84: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

MySQL Group Replication

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

84 / 143

Page 85: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

MySQL Group Replication

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

85 / 143

Page 86: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

MySQL Group Replication

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

86 / 143

Page 87: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

MySQL Group Replication

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

87 / 143

Page 88: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

MySQL Group Replication

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

88 / 143

Page 89: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

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

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

89 / 143

Page 90: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

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

can the write (transaction) be applied ?

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

90 / 143

Page 91: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

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 @ 2017 Oracle and/or its affiliates. All rights reserved.

91 / 143

Page 92: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

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 @ 2017 Oracle and/or its affiliates. All rights reserved.

92 / 143

Page 93: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

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 @ 2017 Oracle and/or its affiliates. All rights reserved.

93 / 143

Page 94: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

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 @ 2017 Oracle and/or its affiliates. All rights reserved.

94 / 143

Page 95: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

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 @ 2017 Oracle and/or its affiliates. All rights reserved.

95 / 143

Page 96: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

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 @ 2017 Oracle and/or its affiliates. All rights reserved.

96 / 143

Page 97: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

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 @ 2017 Oracle and/or its affiliates. All rights reserved.

97 / 143

Page 98: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

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 @ 2017 Oracle and/or its affiliates. All rights reserved.

98 / 143

Page 99: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

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 @ 2017 Oracle and/or its affiliates. All rights reserved.

99 / 143

Page 100: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

GTIDGTIDs are the same as those used by asynchronous replication.

mysql> SELECT * FROM performance_schema.replication_connection_status\G ************************** 1. row *************************** CHANNEL_NAME: group_replication_applier GROUP_NAME: afb80f36-2bff-11e6-84e0-0800277dd3bf SOURCE_UUID: afb80f36-2bff-11e6-84e0-0800277dd3bf THREAD_ID: NULL SERVICE_STATE: ON COUNT_RECEIVED_HEARTBEATS: 0 LAST_HEARTBEAT_TIMESTAMP: 0000-00-00 00:00:00 RECEIVED_TRANSACTION_SET: afb80f36-2bff-11e6-84e0-0800277dd3bf:1-57, f037578b-46b1-11e6-8005-08002774c31b:1-48937 LAST_ERROR_NUMBER: 0 LAST_ERROR_MESSAGE: LAST_ERROR_TIMESTAMP: 0000-00-00 00:00:00

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

100 / 143

Page 101: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

but transactions use the Group´s GTID

mysql> show master status\G ************************** 1. row *************************** File: mysql4-bin.000001 Position: 1501 Binlog_Do_DB: Binlog_Ignore_DB: Executed_Gtid_Set: afb80f36-2bff-11e6-84e0-0800277dd3bf:1-57, f037578b-46b1-11e6-8005-08002774c31b:1-48937

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

101 / 143

Page 102: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

Requirementsexclusively works with InnoDB tables only

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

102 / 143

Page 103: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

Requirementsexclusively works with InnoDB tables onlyevery tables must have a PK defined

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

103 / 143

Page 104: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

Requirementsexclusively works with InnoDB tables onlyevery tables must have a PK definedonly IPV4 is supported

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

104 / 143

Page 105: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

Requirementsexclusively works with InnoDB tables onlyevery tables must have a PK definedonly IPV4 is supporteda good network with low latency is important

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

105 / 143

Page 106: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

Requirementsexclusively works with InnoDB tables onlyevery tables must have a PK definedonly IPV4 is supporteda good network with low latency is importantmaximum of 9 members per group

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

106 / 143

Page 107: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

Requirementsexclusively works with InnoDB tables onlyevery tables must have a PK definedonly IPV4 is supporteda good network with low latency is importantmaximum of 9 members per grouplog-bin must be enabled and only ROW format is supported

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

107 / 143

Page 108: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

Requirements (2)enable GTIDs

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

108 / 143

Page 109: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

Requirements (2)enable GTIDsreplication meta-data must be stored in system tables

--master-info-repository=TABLE --relay-log-info-repository=TABLE

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

109 / 143

Page 110: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

Requirements (2)enable GTIDsreplication meta-data must be stored in system tables

--master-info-repository=TABLE --relay-log-info-repository=TABLE

writesets extraction must be enabled

--transaction-write-set-extraction=XXHASH64

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

110 / 143

Page 111: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

Requirements (2)enable GTIDsreplication meta-data must be stored in system tables

--master-info-repository=TABLE --relay-log-info-repository=TABLE

writesets extraction must be enabled

--transaction-write-set-extraction=XXHASH64

log-slave-updates must also be enabled

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

111 / 143

Page 112: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

Limitationsbinlog checksum is not supported (but we have checksum in the replication channel)

--binlog-checksum=NONE

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

112 / 143

Page 113: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

Limitationsbinlog checksum is not supported (but we have checksum in the replication channel)

--binlog-checksum=NONE

savepoints were not supported before 5.7.19 & 8.0.1

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

113 / 143

Page 114: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

Limitationsbinlog checksum is not supported (but we have checksum in the replication channel)

--binlog-checksum=NONE

savepoints were not supported before 5.7.19 & 8.0.1SERIALIZABLE is not supported as transaction isolation level

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

114 / 143

Page 115: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

Limitationsbinlog checksum is not supported (but we have checksum in the replication channel)

--binlog-checksum=NONE

savepoints were not supported before 5.7.19 & 8.0.1SERIALIZABLE is not supported as transaction isolation levelhttp://lefred.be/content/mysql-group-replication-limitations-savepoints/http://lefred.be/content/mysql-group-replication-and-table-design/

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

115 / 143

Page 116: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

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

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

116 / 143

Page 117: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

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 @ 2017 Oracle and/or its affiliates. All rights reserved.

117 / 143

Page 118: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

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) and therest 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 @ 2017 Oracle and/or its affiliates. All rights reserved.

118 / 143

Page 119: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

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

119 / 143

Page 120: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

MySQL Router (GA!)MySQL 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 traffic toappropriate backend MySQL Servers.

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

120 / 143

Page 121: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

MySQL Router (GA!)MySQL 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 traffic toappropriate backend MySQL Servers.

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

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

121 / 143

Page 122: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

MySQL Router (GA!)MySQL 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 traffic toappropriate backend MySQL Servers.

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

The MySQL Router development will be focusing on sharding.

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

122 / 143

Page 123: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

ProxySQL has native support for GroupReplication which makes it a good choice foradvanced 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 @ 2017 Oracle and/or its affiliates. All rights reserved.

123 / 143

Page 124: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

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

124 / 143

Page 125: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

MySQL Shell (GA!)The 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 @ 2017 Oracle and/or its affiliates. All rights reserved.

125 / 143

Page 126: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

MySQL Shell (2)The MySQL Shell provides:

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

126 / 143

Page 127: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

MySQL Shell (2)The MySQL Shell provides:

Both Interactive and Batch operations

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

127 / 143

Page 128: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

MySQL Shell (2)The MySQL Shell provides:

Both Interactive and Batch operationsDocument and Relational Models

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

128 / 143

Page 129: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

MySQL Shell (2)The MySQL Shell provides:

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

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

129 / 143

Page 130: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

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 @ 2017 Oracle and/or its affiliates. All rights reserved.

130 / 143

Page 131: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

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 @ 2017 Oracle and/or its affiliates. All rights reserved.

131 / 143

Page 132: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

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 @ 2017 Oracle and/or its affiliates. All rights reserved.

132 / 143

Page 133: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

MySQL Shell (3)PREVIEW: the new Shell´s prompt is nice and clear !

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

133 / 143

Page 134: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

don´t forget, this is a HA solution !

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

134 / 143

Page 135: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

Deploying a MySQL InnoDB Cluster using MySQLShell´s adminAPI:mysql-js> var i1 = 'root@instance01:3306';mysql-js> var i2 = 'root@instance02:3306';mysql-js> var i3 = 'root@instance03:3306';

mysql-js> dba.checkInstanceCon�guration(i1);mysql-js> dba.checkInstanceCon�guration(i2);mysql-js> dba.checkInstanceCon�guration(i3);

mysql-js> shell.connect(i1);mysql-js> var cluster = dba.createCluster('GhentCluster');

mysql-js> cluster.checkInstanceState(i2); mysql-js> cluster.addInstance(i2);

mysql-js> cluster.checkInstanceState(i3);mysql-js> cluster.addInstance(i3);

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

135 / 143

Page 136: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

DEMO !https://youtu.be/y3WywG7Zhks

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

136 / 143

Page 137: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

instance01.yaml :

classes: - innodbcluster

innodbcluster::mysql_serverid: 1

Thanks to the MySQL Shell we can automate everything ;-)

https://github.com/lefred/puppet-lefred-innodbcluster

Super easy using hiera:

common.yaml:

innodbcluster::mysql_root_password: StRongP4ssw0rD!innodbcluster::mysql_bind_interface: eth1innodbcluster::cluster_name: GhentClusterinnodbcluster::grant::user: fredinnodbcluster::grant::password: fredinnodbcluster::seed: instance01

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

137 / 143

Page 138: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

example (2)With hiera-eyaml you can even encrypt your password:

innodbcluster::mysql_root_password: > ENC[PKCS7,MIIBeQYJKoZIhvcNAQcDoIIBajCCAWYCAQAxggEhMIIBHQIBADAFMAACAQEw DQYJKoZIhvcNAQEBBQAEggEAhqKUTXZ/4L8/aL3XARMfDBEI+s5HPshPg9BI ... FLfovstrb8zmcbk5yb/KD0lDM8Elas0lrnpk8MxwNfKw+hB299JFp8ldAtUk ODIieTA8BgkqhkiG9w0BBwEwHQYJYIZIAWUDBAEqBBBJEeoyzHtW/WGpbiUz gcXTgBAnb1gGrBZAfAiv/ztwuZ9z]innodbcluster::mysql_bind_interface: eth1innodbcluster::cluster_name: GhentClusterinnodbcluster::grant::user: rootinnodbcluster::grant::password: > ENC[PKCS7,MIIBeQYJKoZIhvcNAQcDoIIBajCCAWYCAQAxggEhMIIBHQIBADAFMAACAQEw DQYJKoZIhvcNAQEBBQAEggEAhqKUTXZ/4L8/aL3XARMfDBEI+s5HPshPg9BI ... FLfovstrb8zmcbk5yb/KD0lDM8Elas0lrnpk8MxwNfKw+hB299JFp8ldAtUk ODIieTA8BgkqhkiG9w0BBwEwHQYJYIZIAWUDBAEqBBBJEeoyzHtW/WGpbiUz gcXTgBAnb1gGrBZAfAiv/ztwuZ9z]

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

138 / 143

Page 139: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

DEMO !https://www.youtube.com/watch?v=skwlmBNE7ts

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

139 / 143

Page 140: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

140 / 143

Page 141: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

Resourceshttp://lefred.be/content/mysql-innodb-cluster-mysql-shell-starter-guide/

http://lefred.be/content/mysql-innodb-cluster-automated-installation-with-puppet/

http://lefred.be/content/category/mysql/group-replication/

https://www.slideshare.net/lefred.descamps/mysql-devops-webinar

http://mysqlserverteam.com/innodb-cluster-in-opc/

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

141 / 143

Page 142: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

Thank you !

Kenny & Vadim for their tests, bugs and feature requests

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

142 / 143

Page 143: 1 / 143 - Percona · High Availability High availability is a characteristic of a system, which aims to ensure an agreed level of operational performance, usually uptime, for a higher

Thank you !

Any Questions ?

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

143 / 143