3. Percona University, Ghent, BelgiumJune
2017
MySQL InnoDB Cluster
MySQL High Availability made easy
Frédéric Descamps - MySQL Community Manager - Oracle
3 / 143
4.
Safe Harbor Statement
The following is intended to outline our general product direction. It is intended for
information purpose only, and may not be incorporated into any contract. It is not a
commitment to deliver any material, code, or functionality, and should not be relied up in
making purchasing decisions. The development, release and timing of any features or
functionality described for Oracle´s product remains at the sole discretion of Oracle.
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
4 / 143
5. about.me/lefred
Who am I ?
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
5 / 143
6. Frédéric Descamps
@lefred
MySQL Evangelist
Hacking MySQL since 3.23
devops believer
MySQL Community Manager since May
2016
living in Belgium 🇧🇪
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
6 / 143
7. MySQL InnoDB Cluster
Easy MySQL High Availability
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
7 / 143
9. Our vision in 4 steps
MySQLDocumentStore
Relational&DocumentModels
MySQLHA
Out-Of-BoxHA
ReadScale-Out
AsyncReplication+AutoFailover
WriteScale-Out
Sharding
E1 E3
E2 E4
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
9 / 143
10. Step 2´s Architecture
Application
MySQL Connector
MySQL Router
MySQL Shell
InnoDB
cluster
Application
MySQL Connector
MySQL Router
Mp
M
M
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
10 / 143
11. Step 3´s Architecture
Application
MySQL Connector
MySQL Router
MySQL Shell
InnoDB
cluster
Application
MySQL Connector
MySQL Router
Mp
M
M
S1 S2 S3 S4 S...
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
11 / 143
12. Step 4´s Architecture
Application
MySQL Connector
MySQL Router
MySQL Shell
Application
MySQL Connector
MySQL Router
InnoDB
cluster
Mp
M
M
S2 S3 S4 S...S1
InnoDB
cluster
Mp
M
M
S1 S2 S3 S4 S...
InnoDB
cluster
Mp
M
M
S1 S2 S3 S4 S...
Application
MySQL Connector
MySQL Router
Application
MySQL Connector
MySQL Router
Application
MySQL Connector
MySQL Router
replicaset1
replicaset2
replicaset3
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
12 / 143
13. Group Replication: heart of MySQL InnoDB
Cluster
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
13 / 143
14. Group Replication: heart of MySQL InnoDB
Cluster
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
14 / 143
15. But before going further...
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
15 / 143
16. What is
High Availability ?
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
16 / 143
18. Database Redundancy
How to achieve it ?
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
18 / 143
19. 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
20. 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
21. Database Redundancy
How to achieve it ?
Multiple solutions exist, some worse than the others ;-)
use of share storage
use of share blocs by network (drbd)
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
21 / 143
22. Database Redundancy
How to achieve it ?
Multiple solutions exist, some worse than the others ;-)
use of share storage
use of share blocs by network (drbd)
use of MySQL replication
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
22 / 143
23. Database Redundancy
How to achieve it ?
Multiple solutions exist, some worse than the others ;-)
use of share storage
use 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
24. MySQL Replication
There are multiple types of MySQL replication:
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
24 / 143
25. MySQL Replication
There are multiple types of MySQL replication:
asynchronous replication (async)
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
25 / 143
26. MySQL Replication
There 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
27. MySQL Replication
There 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
28. Asynchronous Replication(s)
replicas (also called slaves) streamthe replication logs froma unique master (multi-
sourcereplicationispossiblesince5.7.6)
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
28 / 143
29. Asynchronous Replication(s)
replicas (also called slaves) streamthe replication logs froma unique master (multi-
sourcereplicationispossiblesince5.7.6)
slaves can be laging (having delay), there is no delivery guarantee (unlessforsemi-
sync)
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
29 / 143
30. Asynchronous Replication(s)
replicas (also called slaves) streamthe replication logs froma unique master (multi-
sourcereplicationispossiblesince5.7.6)
slaves can be laging (having delay), there is no delivery guarantee (unlessforsemi-
sync)
replicas provisioning is manual
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
30 / 143
31. Asynchronous Replication(s)
replicas (also called slaves) streamthe replication logs froma unique master (multi-
sourcereplicationispossiblesince5.7.6)
slaves can be laging (having delay), there is no delivery guarantee (unlessforsemi-
sync)
replicas provisioning is manual
data consistency on replicas is assumed and needs a manual verification
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
31 / 143
32. Asynchronous Replication(s)
replicas (also called slaves) streamthe replication logs froma unique master (multi-
sourcereplicationispossiblesince5.7.6)
slaves can be laging (having delay), there is no delivery guarantee (unlessforsemi-
sync)
replicas provisioning is manual
data consistency on replicas is assumed and needs a manual verification
it´s even possible to create circular replication (highly not recommended)
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
32 / 143
33. Asynchronous Replication(s)
replicas (also called slaves) streamthe replication logs froma unique master (multi-
sourcereplicationispossiblesince5.7.6)
slaves can be laging (having delay), there is no delivery guarantee (unlessforsemi-
sync)
replicas provisioning is manual
data consistency on replicas is assumed and needs a manual verification
it´s even possible to create circular replication (highly not recommended)
write operations are safe only froma unique global master
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
33 / 143
46. MySQL HA Architectures with asynchronous
replication
It 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
47. MySQL HA Architectures with asynchronous
replication
It 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
48. MySQL HA Architectures with asynchronous
replication
It 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
49. MySQL HA Architectures with asynchronous
replication
It exists a lot of possible architectures and as much tools to enforce them.
They are all based on the same principle:
1 master
1 or many replicas (slaves)
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
49 / 143
50. MySQL HA Architectures with asynchronous
replication
It exists a lot of possible architectures and as much tools to enforce them.
They are all based on the same principle:
1 master
1 or many replicas (slaves)
If the master as an issue, the most accurate slave needs to takeover the role and be
promoted as master for all the remaining slaves still online.
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
50 / 143
52. Automation
And this is the most complicated part...
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
52 / 143
53. Automation
And this is the most complicated part...
It exists a large amount of external tools that can be used to achieve this task. Most of
themare only compatible with GNU/Linux.
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
53 / 143
54. Automation
And this is the most complicated part...
It exists a large amount of external tools that can be used to achieve this task. Most of
themare only compatible with GNU/Linux.
Their problemis that they create complexity in the architecture's design. You need to be
DBA &sysadmin to manage those solutions:
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
54 / 143
55. Automation
And this is the most complicated part...
It exists a large amount of external tools that can be used to achieve this task. Most of
themare only compatible with GNU/Linux.
Their problemis that they create complexity in the architecture's design. You need to be
DBA &sysadmin to manage those solutions:
MySQL-Utilities (mysqlrplcheck, mysqlrpladmin)
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
55 / 143
56. Automation
And this is the most complicated part...
It exists a large amount of external tools that can be used to achieve this task. Most of
themare only compatible with GNU/Linux.
Their problemis that they create complexity in the architecture's design. You need to be
DBA &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
57. Automation
And this is the most complicated part...
It exists a large amount of external tools that can be used to achieve this task. Most of
themare only compatible with GNU/Linux.
Their problemis that they create complexity in the architecture's design. You need to be
DBA &sysadmin to manage those solutions:
MySQL-Utilities (mysqlrplcheck, mysqlrpladmin)
Pacemaker with MySQL dedicated OCF
customsolutions...
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
57 / 143
58. MySQL Group Replication
but what is it ?!?
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
58 / 143
59. 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
60. MySQL Group Replication
but what is it ?!?
GR is a plugin for MySQL, made by MySQL and packaged with MySQL
GR is an implementation of Replicated Database State Machine theory
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
60 / 143
61. MySQL Group Replication
but what is it ?!?
GR is a plugin for MySQL, made by MySQL and packaged with MySQL
GR is an implementation of Replicated Database State Machine theory
GR uses a Paxos based protocol
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
61 / 143
62. MySQL Group Replication
but what is it ?!?
GR is a plugin for MySQL, made by MySQL and packaged with MySQL
GR is an implementation of Replicated Database State Machine theory
GR uses a Paxos based protocol
GR allows to write on all Group Members (cluster nodes) simultaneously while
retaining consistency
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
62 / 143
63. MySQL Group Replication
but what is it ?!?
GR is a plugin for MySQL, made by MySQL and packaged with MySQL
GR is an implementation of Replicated Database State Machine theory
GR uses a Paxos based protocol
GR allows to write on all Group Members (cluster nodes) simultaneously while
retaining consistency
GR implements conflict detection and resolution
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
63 / 143
64. MySQL Group Replication
but what is it ?!?
GR is a plugin for MySQL, made by MySQL and packaged with MySQL
GR is an implementation of Replicated Database State Machine theory
GR uses a Paxos based protocol
GR allows to write on all Group Members (cluster nodes) simultaneously while
retaining consistency
GR implements conflict detection and resolution
GR allows automatic distributed recovery
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
64 / 143
65. MySQL Group Replication
but what is it ?!?
GR is a plugin for MySQL, made by MySQL and packaged with MySQL
GR is an implementation of Replicated Database State Machine theory
GR uses a Paxos based protocol
GR allows to write on all Group Members (cluster nodes) simultaneously while
retaining consistency
GR implements conflict detection and resolution
GR allows automatic distributed recovery
Supported on all MySQL platforms !!
Linux, Windows, Solaris, OSX, FreeBSD
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
65 / 143
66. And for users ?
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
66 / 143
67. 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
68. And for users ?
no longer necessary to handle server fail-over manually or with a complicated script
GR provides fault tolerance
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
68 / 143
69. And for users ?
no longer necessary to handle server fail-over manually or with a complicated script
GR provides fault tolerance
GR enables update-everywhere setups
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
69 / 143
70. And for users ?
no longer necessary to handle server fail-over manually or with a complicated script
GR provides fault tolerance
GR enables update-everywhere setups
GR handles crashes, failures, re-connetcs automatically
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
70 / 143
71. And for users ?
no longer necessary to handle server fail-over manually or with a complicated script
GR provides fault tolerance
GR enables update-everywhere setups
GR handles crashes, failures, re-connetcs automatically
Allows an easy setup of a MySQL service high available !
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
71 / 143
72. OK, but how does it work ?
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
72 / 143
73. OK, but how does it work ?
it's just ...
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
73 / 143
74. OK, but how does it work ?
it's just ...
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
74 / 143
75. OK, but how does it work ?
it's just ...
... no, in fact the writesets replication is synchronous and then certification and apply of
the changes are local to each nodes and asynchronous.
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
75 / 143
76. OK, but how does it work ?
it's just ...
... no, in fact the writesets replication is synchronous and then certification and apply of
the changes are local to each nodes and asynchronous.
not that easy to understand... right ? As a picture is worth a 1000 words, let's illustrate
this...
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
76 / 143
89. Certification
Certification is the process that only needs to answer the following unique question:
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
89 / 143
90. Certification
Certification is the process that only needs to answer the following unique question:
canthewrite(transaction)beapplied?
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
90 / 143
91. Certification
Certification is the process that only needs to answer the following unique question:
canthewrite(transaction)beapplied?
based on unapplied earlier transactions
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
91 / 143
92. Certification
Certification is the process that only needs to answer the following unique question:
canthewrite(transaction)beapplied?
based on unapplied earlier transactions
such conflicts must come for other members/nodes
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
92 / 143
93. Certification
Certification is the process that only needs to answer the following unique question:
canthewrite(transaction)beapplied?
based on unapplied earlier transactions
such conflicts must come for other members/nodes
happens on every member/node
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
93 / 143
94. Certification
Certification is the process that only needs to answer the following unique question:
canthewrite(transaction)beapplied?
based on unapplied earlier transactions
such conflicts must come for other members/nodes
happens on every member/node
should be deterministic on every node
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
94 / 143
95. Certification
Certification is the process that only needs to answer the following unique question:
canthewrite(transaction)beapplied?
based on unapplied earlier transactions
such conflicts must come for other members/nodes
happens on every member/node
should be deterministic on every node
results are not reported to the group
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
95 / 143
96. Certification
Certification is the process that only needs to answer the following unique question:
canthewrite(transaction)beapplied?
based on unapplied earlier transactions
such conflicts must come for other members/nodes
happens on every member/node
should be deterministic on every node
results are not reported to the group
pass: enter in the apply queue
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
96 / 143
97. Certification
Certification is the process that only needs to answer the following unique question:
canthewrite(transaction)beapplied?
based on unapplied earlier transactions
such conflicts must come for other members/nodes
happens on every member/node
should be deterministic on every node
results are not reported to the group
pass: enter in the apply queue
fail: drop the transaction
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
97 / 143
98. Certification
Certification is the process that only needs to answer the following unique question:
canthewrite(transaction)beapplied?
based on unapplied earlier transactions
such conflicts must come for other members/nodes
happens on every member/node
should be deterministic on every node
results are not reported to the group
pass: enter in the apply queue
fail: drop the transaction
serialized by the total order in GCS/XCOM+ GTID
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
98 / 143
99. Certification
Certification is the process that only needs to answer the following unique question:
canthewrite(transaction)beapplied?
based on unapplied earlier transactions
such conflicts must come for other members/nodes
happens on every member/node
should be deterministic on every node
results are not reported to the group
pass: enter in the apply queue
fail: drop the transaction
serialized by the total order in GCS/XCOM+ GTID
cost is based on trx size (# rows &# keys)
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
99 / 143
100. GTID
GTIDs are the same as those used by asynchronous replication.
mysql> SELECT * FROM performance_schema.replication_connection_statusG
************************** 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
101. but transactions use the Group´s GTID
mysql> show master statusG
************************** 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
103. Requirements
exclusively works with InnoDB tables only
every tables must have a PK defined
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
103 / 143
104. Requirements
exclusively works with InnoDB tables only
every tables must have a PK defined
only IPV4 is supported
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
104 / 143
105. Requirements
exclusively works with InnoDB tables only
every tables must have a PK defined
only IPV4 is supported
a good network with lowlatency is important
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
105 / 143
106. Requirements
exclusively works with InnoDB tables only
every tables must have a PK defined
only IPV4 is supported
a good network with lowlatency is important
maximumof 9 members per group
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
106 / 143
107. Requirements
exclusively works with InnoDB tables only
every tables must have a PK defined
only IPV4 is supported
a good network with lowlatency is important
maximumof 9 members per group
log-bin must be enabled and only ROWformat is supported
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
107 / 143
109. Requirements (2)
enable GTIDs
replication meta-data must be stored in systemtables
--master-info-repository=TABLE
--relay-log-info-repository=TABLE
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
109 / 143
110. Requirements (2)
enable GTIDs
replication meta-data must be stored in systemtables
--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
111. Requirements (2)
enable GTIDs
replication meta-data must be stored in systemtables
--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
112. Limitations
binlog checksumis not supported (butwehavechecksuminthereplicationchannel)
--binlog-checksum=NONE
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
112 / 143
113. Limitations
binlog checksumis not supported (butwehavechecksuminthereplicationchannel)
--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
114. Limitations
binlog checksumis not supported (butwehavechecksuminthereplicationchannel)
--binlog-checksum=NONE
savepoints were not supported before 5.7.19 &8.0.1
SERIALIZABLEis not supported as transaction isolation level
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
114 / 143
115. Limitations
binlog checksumis not supported (butwehavechecksuminthereplicationchannel)
--binlog-checksum=NONE
savepoints were not supported before 5.7.19 &8.0.1
SERIALIZABLEis not supported as transaction isolation level
http://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
116. Default = Single Primary Mode
By default, MySQL InnoDB Cluster runs in Single Primary Mode.
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
116 / 143
117. Default = Single Primary Mode
By 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
118. Default = Single Primary Mode
By 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 the
rest of the members act as hot-standbys (SECONDARY).
The group itself coordinates and configures itself automatically to determine which
member will act as the PRIMARY, through a leader election mechanism.
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
118 / 143
119. Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
119 / 143
120. MySQL Router (GA!)
MySQL Router is lightweight middleware that provides transparent routing between your
application 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 to
appropriate backend MySQL Servers.
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
120 / 143
121. MySQL Router (GA!)
MySQL Router is lightweight middleware that provides transparent routing between your
application 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 to
appropriate 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
122. MySQL Router (GA!)
MySQL Router is lightweight middleware that provides transparent routing between your
application 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 to
appropriate 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
123. ProxySQL has native support for Group
Replication which makes it a good choice for
advanced users.
ProxySQL
If you need some specific features that are not yet available in MySQL Router, like
transparent R/Wsplitting, 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
124. Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
124 / 143
125. MySQL Shell (GA!)
The MySQL Shell is an interactive Javascript, Python, or SQL interface supporting
development and administration for the MySQL Server and is a component of the MySQL
Server. You can use the MySQL Shell to performdata queries and updates as well as
various administration operations.
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
125 / 143
126. MySQL Shell (2)
The MySQL Shell provides:
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
126 / 143
127. MySQL Shell (2)
The MySQL Shell provides:
Both Interactive and Batch operations
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
127 / 143
128. MySQL Shell (2)
The MySQL Shell provides:
Both Interactive and Batch operations
Document and Relational Models
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
128 / 143
129. MySQL Shell (2)
The MySQL Shell provides:
Both Interactive and Batch operations
Document and Relational Models
CRUD Document and Relational APIs via scripting
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
129 / 143
130. MySQL Shell (2)
The MySQL Shell provides:
Both Interactive and Batch operations
Document and Relational Models
CRUD Document and Relational APIs via scripting
Traditional Table, JSON, Tab Separated output results formats
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
130 / 143
131. MySQL Shell (2)
The MySQL Shell provides:
Both Interactive and Batch operations
Document and Relational Models
CRUD Document and Relational APIs via scripting
Traditional Table, JSON, Tab Separated output results formats
MySQL Standard and X Protocols
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
131 / 143
132. MySQL Shell (2)
The MySQL Shell provides:
Both Interactive and Batch operations
Document and Relational Models
CRUD Document and Relational APIs via scripting
Traditional Table, JSON, Tab Separated output results formats
MySQL Standard and X Protocols
and more...
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
132 / 143
133. MySQL Shell (3)
PREVIEW: the newShell´s prompt is nice and clear !
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
133 / 143
134. don´t forget, this is a HA solution !
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
134 / 143
135. Deploying a MySQL InnoDB Cluster using MySQL
Shell´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
137. 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: eth1
innodbcluster::cluster_name: GhentCluster
innodbcluster::grant::user: fred
innodbcluster::grant::password: fred
innodbcluster::seed: instance01
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
137 / 143
138. 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: eth1
innodbcluster::cluster_name: GhentCluster
innodbcluster::grant::user: root
innodbcluster::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
142. Thank you !
Kenny & Vadim for their tests, bugs and feature requests
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
142 / 143
143. Thank you !
Any Questions ?
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
143 / 143