1 / 129 - MySQL · 2017-05-08 · High Availability High availability is a characteristic of a...
Transcript of 1 / 129 - MySQL · 2017-05-08 · High Availability High availability is a characteristic of a...
1 / 129
2 / 129
MySQL InnoDB Cluster
When MySQL High Availability is Made Easy
3 / 129
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 / 129
about.me/lefred
Who am I ?
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
5 / 129
Frédéric Descamps@lefredMySQL EvangelistHacking MySQL since 3.23devops believerMySQL Community Manager since May2016 (🎂)living in Belgium
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
6 / 129
MySQL InnoDB Cluster
Easy MySQL High Availability
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
7 / 129
InnoDB
cluster
Ease-of-Use
Extreme Scale-Out
Out-of-Box Solution
Built-in HA
High P erformance
Everything Integr ated
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
8 / 129
Our vision in 4 steps
MySQL Document Store
Relational & Document Models
MySQL HA
Out-Of-Box HA
Read Scale-Out
Async Replication + A uto F ailover
Write Scale-Out
Sharding
E1
E3
E2 E4
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
9 / 129
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 / 129
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 / 129
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 / 129
Group Replication: heart of MySQL InnoDBCluster
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
13 / 129
Group Replication: heart of MySQL InnoDBCluster
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
14 / 129
But before going further...
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
15 / 129
What is
High Availability ?
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
16 / 129
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 / 129
Database Redundancy
How to achieve it ?
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
18 / 129
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 / 129
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 / 129
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 / 129
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 / 129
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 / 129
MySQL ReplicationThere are multiple types of MySQL replication:
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
24 / 129
MySQL ReplicationThere are multiple types of MySQL replication:
asynchronous replication (async)
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
25 / 129
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 / 129
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 / 129
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 / 129
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 / 129
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 / 129
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 / 129
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 verificationcomplex topologies can be built
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
32 / 129
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 verificationcomplex topologies can be builtit´s even possible to create circular replication (not recommended)
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
33 / 129
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 verificationcomplex topologies can be builtit´s even possible to create circular replication (not recommended)write operations are safe only from a unique global master
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
34 / 129
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.
35 / 129
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.
36 / 129
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.
37 / 129
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.
38 / 129
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 tall the remaining slaves still online.
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
39 / 129
Automation
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
40 / 129
AutomationAnd this is the most complicated part...
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
41 / 129
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.
42 / 129
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.
43 / 129
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.
44 / 129
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.
45 / 129
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.
46 / 129
MySQL Group Replication
but what is it ?!?
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
47 / 129
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.
48 / 129
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.
49 / 129
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 @ 2017 Oracle and/or its affiliates. All rights reserved.
50 / 129
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 @ 2017 Oracle and/or its affiliates. All rights reserved.
51 / 129
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 @ 2017 Oracle and/or its affiliates. All rights reserved.
52 / 129
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 @ 2017 Oracle and/or its affiliates. All rights reserved.
53 / 129
MySQL Group Communication System (GCS)MySQL Xcom protocol
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
54 / 129
MySQL Group Communication System (GCS)MySQL Xcom protocolReplicated Database State Machine
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
55 / 129
MySQL Group Communication System (GCS)MySQL Xcom protocolReplicated Database State MachinePaxos based protocol
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
56 / 129
MySQL Group Communication System (GCS)MySQL Xcom protocolReplicated Database State MachinePaxos based protocolits task: deliver messages across the distributed system:
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
57 / 129
MySQL Group Communication System (GCS)MySQL Xcom protocolReplicated Database State MachinePaxos based protocolits task: deliver messages across the distributed system:
atomically
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
58 / 129
MySQL Group Communication System (GCS)MySQL Xcom protocolReplicated Database State MachinePaxos based protocolits task: deliver messages across the distributed system:
atomicallyin Total Order
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
59 / 129
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 @ 2017 Oracle and/or its affiliates. All rights reserved.
60 / 129
And for users ?
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
61 / 129
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.
62 / 129
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.
63 / 129
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.
64 / 129
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.
65 / 129
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.
66 / 129
OK, but how does it work ?
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
67 / 129
OK, but how does it work ?
it's just magic !
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
68 / 129
OK, but how does it work ?
it's just magic !
... 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.
69 / 129
OK, but how does it work ?
it's just magic !
... 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.
70 / 129
MySQL Group Replication
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
71 / 129
MySQL Group Replication
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
72 / 129
MySQL Group Replication
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
73 / 129
MySQL Group Replication
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
74 / 129
MySQL Group Replication
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
75 / 129
MySQL Group Replication
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
76 / 129
MySQL Group Replication
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
77 / 129
MySQL Group Replication
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
78 / 129
MySQL Group Replication
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
79 / 129
MySQL Group Replication
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
80 / 129
MySQL Group Replication
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
81 / 129
MySQL Group Replication
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
82 / 129
CertificationCertification is the process that only needs to answer the following unique question:
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
83 / 129
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.
84 / 129
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.
85 / 129
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.
86 / 129
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.
87 / 129
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.
88 / 129
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.
89 / 129
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.
90 / 129
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.
91 / 129
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.
92 / 129
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.
93 / 129
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.
94 / 129
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.
95 / 129
Requirementsexclusively works with InnoDB tables only
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
96 / 129
Requirementsexclusively works with InnoDB tables onlyevery tables must have a PK defined
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
97 / 129
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.
98 / 129
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.
99 / 129
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.
100 / 129
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.
101 / 129
Requirements (2)enable GTIDs
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
102 / 129
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.
103 / 129
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.
104 / 129
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.
105 / 129
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.
106 / 129
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.
107 / 129
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.
108 / 129
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.
109 / 129
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
110 / 129
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.
111 / 129
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.
112 / 129
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.
113 / 129
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.
114 / 129
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
115 / 129
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.
116 / 129
MySQL Shell (2)The MySQL Shell provides:
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
117 / 129
MySQL Shell (2)The MySQL Shell provides:
Both Interactive and Batch operations
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
118 / 129
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.
119 / 129
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.
120 / 129
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.
121 / 129
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.
122 / 129
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.
123 / 129
MySQL Shell (3)PREVIEW: the new Shell´s prompt is nice and clear !
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
124 / 129
Deploying a MySQL using MySQL Shell´sadminAPI:mysql-js> var i1 = 'root@instance01:3306';mysql-js> var i2 = 'root@instance02:3306';mysql-js> var i3 = 'root@instance02: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('InnovationDay');
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.
125 / 129
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: InnovationDayinnodbcluster::grant::user: fredinnodbcluster::grant::password: fredinnodbcluster::seed: instance01
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
126 / 129
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: InnovationDayinnodbcluster::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.
127 / 129
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.
128 / 129
Thank you !
Any Questions ?
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
129 / 129