1 / 65 - MySQL · MySQL High Availability made easy Frédéric Descamps - MySQL Community Manager -...

65
1 / 65

Transcript of 1 / 65 - MySQL · MySQL High Availability made easy Frédéric Descamps - MySQL Community Manager -...

1 / 65

2 / 65

3 / 65

Introduction to MySQL InnoDB Cluster

MySQL High Availability made easy

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

4 / 65

100% 

virtually all organizations require theirmost critical systems to be highlyavailable!

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

5 / 65

 

  "High Availability becomes a core firstclass feature of MySQL!"

MySQL InnoDB Cluster 

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

6 / 65

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.

7 / 65

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.

8 / 65

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.

9 / 65

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.

10 / 65

Group Replication: heart of MySQL InnoDBCluster

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

11 / 65

Group Replication: heart of MySQL InnoDBCluster

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

12 / 65

MySQL Group Replication

but what is it ?!?

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

13 / 65

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.

14 / 65

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.

15 / 65

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.

16 / 65

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.

17 / 65

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.

18 / 65

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.

19 / 65

MySQL Group Communication System (GCS)MySQL Xcom protocol

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

20 / 65

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

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

21 / 65

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

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

22 / 65

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.

23 / 65

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.

24 / 65

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.

25 / 65

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.

26 / 65

And for users ?

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

27 / 65

And 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.

28 / 65

And 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.

29 / 65

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

30 / 65

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

31 / 65

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

32 / 65

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

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

33 / 65

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.

34 / 65

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.

35 / 65

Single Primary Mode - sice 8.0.2group_replication_member_weight: influence the primary member election in Single-Primary mode (from 0 to 100).

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

36 / 65

Single Primary Mode - sice 8.0.2group_replication_member_weight: influence the primary member election in Single-Primary mode (from 0 to 100).

more visibility

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

37 / 65

Single Primary Mode - sice 8.0.2group_replication_member_weight: influence the primary member election in Single-Primary mode (from 0 to 100).

more visibility

mysql-sql> select * from performance_schema.replication_group_members;+--------------+--------------+--------+------+---------+-------------+-------+| CHANNEL_NAME | MEMBER_ID | M_HOST | PORT | M_STATE | MEMBER_ROLE | M_VER |+--------------+--------------+--------+------+---------+-------------+-------+| gr_applier | ...-8d90-... | mysql1 | 3306 | ONLINE | SECONDARY | 8.0.2 || gr_applier | ...-be23-... | mysql2 | 3306 | ONLINE | SECONDARY | 8.0.2 || gr_applier | ...-a747-... | mysql3 | 3306 | ONLINE | PRIMARY | 8.0.2 |+--------------+--------------+--------+------+---------+-------------+-------+

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

38 / 65

since MySQL 8.0.3Group Replication flow control variables now correctly permit you to have somemembers in a group that do not affect the minimum throughput of the flow-controlmechanism

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

39 / 65

since MySQL 8.0.3Group Replication flow control variables now correctly permit you to have somemembers in a group that do not affect the minimum throughput of the flow-controlmechanism

GCS instrumentation in Performance_Schema

thread/group_rpl/THD_Gcs_xcom_control

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

40 / 65

since MySQL 8.0.3Group Replication flow control variables now correctly permit you to have somemembers in a group that do not affect the minimum throughput of the flow-controlmechanism

GCS instrumentation in Performance_Schema

thread/group_rpl/THD_Gcs_xcom_control

Auto-setting Read Only when leaving the Group

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

41 / 65

since MySQL 8.0.4no more possible to add member to the group if it misses GTIDs(group_replication_allow_local_disjoint_gtids_join)

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

42 / 65

since MySQL 8.0.4no more possible to add member to the group if it misses GTIDs(group_replication_allow_local_disjoint_gtids_join)

support for the new default authentication plugin

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

43 / 65

since MySQL 8.0.4no more possible to add member to the group if it misses GTIDs(group_replication_allow_local_disjoint_gtids_join)

support for the new default authentication plugin

group_replication_ip_whitelist allows host names

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

44 / 65

since MySQL 8.0.4no more possible to add member to the group if it misses GTIDs(group_replication_allow_local_disjoint_gtids_join)

support for the new default authentication plugin

group_replication_ip_whitelist allows host names

better integration with DD

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

45 / 65

New in 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.

46 / 65

New in 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.

47 / 65

New in 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.

48 / 65

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

49 / 65

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.

50 / 65

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.

51 / 65

MySQL Router - New in 8.0.11compatibility with the new default authentication plugin

client-certs to connect metadata server

apparmor fixes

automatic failover on bootstrap: you can point the bootstrap at any node of themetadata server and it will find the writable one itself to setup the router'smetadata

scalability limitations lifted (the infamous 500 connections problem)

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

52 / 65

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.

53 / 65

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.

54 / 65

MySQL Shell (2)The MySQL Shell provides:

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

55 / 65

MySQL Shell (2)The MySQL Shell provides:

Both Interactive and Batch operations

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

56 / 65

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.

57 / 65

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.

58 / 65

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.

59 / 65

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.

60 / 65

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.

61 / 65

don´t forget, this is a HA solution !

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

62 / 65

Demo ?

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

63 / 65

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

64 / 65

Thank you !

Any Questions ?

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

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

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

65 / 65