![Page 1: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/1.jpg)
1 / 192
![Page 2: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/2.jpg)
MySQL Group Replication in a nutshell
MySQL InnoDB Cluster: hands-on tutorial
Percona Live Amsterdam - October 2016
Frédéric Descamps - MySQL Community Manager - Oracle
Kenny Gryp - MySQL Practice Manager - Percona
2 / 192
![Page 3: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/3.jpg)
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 @ 2016 Oracle and/or its affiliates. All rights reserved.
3 / 192
![Page 4: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/4.jpg)
about.me/lefred
Who are we ?
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
4 / 192
![Page 5: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/5.jpg)
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
5 / 192
![Page 6: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/6.jpg)
Frédéric Descamps@lefredMySQL EvangelistManaging MySQL since 3.23devops believer
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
6 / 192
![Page 7: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/7.jpg)
Kenny Gryp@grypMySQL Practice Manager
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
7 / 192
![Page 8: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/8.jpg)
get more at the conference
MySQL Group Replication
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
8 / 192
![Page 9: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/9.jpg)
Other sessionMySQL Replication: Latest Developments
Luìs SoaresTuesday 4 October 20163:10pm to 4:00pm - Zürich 1
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
9 / 192
![Page 10: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/10.jpg)
AgendaPrepare your workstation
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
10 / 192
![Page 11: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/11.jpg)
AgendaPrepare your workstationGroup Replication concepts
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
11 / 192
![Page 12: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/12.jpg)
AgendaPrepare your workstationGroup Replication conceptsMigration from Master-Slave to GR
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
12 / 192
![Page 13: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/13.jpg)
AgendaPrepare your workstationGroup Replication conceptsMigration from Master-Slave to GRHow to monitor ?
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
13 / 192
![Page 14: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/14.jpg)
AgendaPrepare your workstationGroup Replication conceptsMigration from Master-Slave to GRHow to monitor ?Application interaction
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
14 / 192
![Page 15: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/15.jpg)
VirtualBox
Setup your workstation
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
15 / 192
![Page 16: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/16.jpg)
Setup your workstationInstall VirtualBox 5On the USB key, there is a file called PLAM16_GR.ova, please copy it on yourlaptop and doubleclick on itStart all virtual machines (mysql1, mysql2, mysql3 & mysql4)Install putty if you are using Windows
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
16 / 192
![Page 17: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/17.jpg)
Setup your workstationInstall VirtualBox 5On the USB key, there is a file called PLAM16_GR.ova, please copy it on yourlaptop and doubleclick on itStart all virtual machines (mysql1, mysql2, mysql3 & mysql4)Install putty if you are using WindowsTry to connect to all VM's from your terminal or putty (root password is X) :
ssh -p 8821 [email protected] to mysql1ssh -p 8822 [email protected] to mysql2ssh -p 8823 [email protected] to mysql3ssh -p 8824 [email protected] to mysql4
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
17 / 192
![Page 18: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/18.jpg)
LAB1: Current situation
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
18 / 192
![Page 19: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/19.jpg)
launchrun_app.sh
on mysql1 intoa screensessionverify thatmysql2 is arunning slave
LAB1: Current situation
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
19 / 192
![Page 20: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/20.jpg)
Summary
+--------+----------+--------------+-----------------+| | ROLE | SSH PORT | INTERNAL IP |+--------+----------+--------------+-----------------+ | | | | | | mysql1 | master | 8821 | 192.168.56.11 | | | | | | | mysql2 | slave | 8822 | 192.168.56.12 | | | | | | | mysql3 | n/a | 8823 | 192.168.56.13 | | | | | | | mysql4 | n/a | 8824 | 192.168.56.14 | | | | | | +--------+----------+--------------+-----------------+
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
20 / 192
![Page 21: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/21.jpg)
the magic explained
Group Replication Concept
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
21 / 192
![Page 22: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/22.jpg)
Group Replication : what is it ?
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
22 / 192
![Page 23: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/23.jpg)
Group Replication : what is it ?MySQL Group Replication is one of the major components of MySQL InnoDB Cluster
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
23 / 192
![Page 24: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/24.jpg)
Group Replication : what is it ?MySQL Group Replication is one of the major components of MySQL InnoDB Cluster
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
24 / 192
![Page 25: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/25.jpg)
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
25 / 192
![Page 26: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/26.jpg)
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
26 / 192
![Page 27: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/27.jpg)
Group replication is a plugin !
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
27 / 192
![Page 28: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/28.jpg)
Group replication is a plugin !GR is a plugin for MySQL, made by MySQL and packaged with MySQL
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
28 / 192
![Page 29: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/29.jpg)
Group replication is a plugin !GR is a plugin for MySQL, made by MySQL and packaged with MySQLGR is an implementation of Replicated Database State Machine theory
MySQL Group Communication System (GCS) is based on Paxos Mencius
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
29 / 192
![Page 30: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/30.jpg)
Group replication is a plugin !GR is a plugin for MySQL, made by MySQL and packaged with MySQLGR is an implementation of Replicated Database State Machine theory
MySQL Group Communication System (GCS) is based on Paxos MenciusProvides virtually synchronous replication for MySQL 5.7+
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
30 / 192
![Page 31: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/31.jpg)
Group replication is a plugin !GR is a plugin for MySQL, made by MySQL and packaged with MySQLGR is an implementation of Replicated Database State Machine theory
MySQL Group Communication System (GCS) is based on Paxos MenciusProvides virtually synchronous replication for MySQL 5.7+Supported on all MySQL platforms !!
Linux, Windows, Solaris, OSX, FreeBSD
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
31 / 192
![Page 32: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/32.jpg)
“Multi-master update anywhere replication plugin for MySQL with built-in conflictdetection and resolution, automatic distributed recovery, and group membership.”
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
32 / 192
![Page 33: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/33.jpg)
Group Replication : how does it work ?
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
33 / 192
![Page 34: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/34.jpg)
Group Replication : how does it work ?A node (member of the group) sends the changes (binlog events) made by atransaction to the group through the GCS.
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
34 / 192
![Page 35: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/35.jpg)
Group Replication : how does it work ?A node (member of the group) sends the changes (binlog events) made by atransaction to the group through the GCS.All members consume the writeset and certify it, no need to wait for all members,ack by the majority is enough.
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
35 / 192
![Page 36: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/36.jpg)
Group Replication : how does it work ?A node (member of the group) sends the changes (binlog events) made by atransaction to the group through the GCS.All members consume the writeset and certify it, no need to wait for all members,ack by the majority is enough.If passed it is applied, if failed, transaction is rolled back on originating server anddiscarded at other servers.
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
36 / 192
![Page 37: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/37.jpg)
OK... but how does it work ?!
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
37 / 192
![Page 38: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/38.jpg)
OK... but how does it work ?!It's just magic !
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
38 / 192
![Page 39: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/39.jpg)
OK... but how does it work ?!It's just magic !
... no, the writeset replication is synchronous and then certification and applying of thechanges happen locally on each node and is asynchronous.
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
39 / 192
![Page 40: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/40.jpg)
OK... but how does it work ?!It's just magic !
... no, the writeset replication is synchronous and then certification and applying of thechanges happen locally on each node and is asynchronous.
not that easy to understand... right ? Let's illustrate this...
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
40 / 192
![Page 41: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/41.jpg)
MySQL Group Replication (autocommit)
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
41 / 192
![Page 42: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/42.jpg)
MySQL Group Replication (autocommit)
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
42 / 192
![Page 43: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/43.jpg)
MySQL Group Replication (autocommit)
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
43 / 192
![Page 44: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/44.jpg)
MySQL Group Replication (autocommit)
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
44 / 192
![Page 45: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/45.jpg)
MySQL Group Replication (autocommit)
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
45 / 192
![Page 46: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/46.jpg)
MySQL Group Replication (autocommit)
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
46 / 192
![Page 47: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/47.jpg)
MySQL Group Replication (autocommit)
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
47 / 192
![Page 48: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/48.jpg)
MySQL Group Replication (autocommit)
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
48 / 192
![Page 49: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/49.jpg)
MySQL Group Replication (autocommit)
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
49 / 192
![Page 50: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/50.jpg)
MySQL Group Replication (autocommit)
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
50 / 192
![Page 51: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/51.jpg)
MySQL Group Replication (autocommit)
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
51 / 192
![Page 52: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/52.jpg)
MySQL Group Replication (full transaction)
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
52 / 192
![Page 53: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/53.jpg)
MySQL Group Replication (full transaction)
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
53 / 192
![Page 54: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/54.jpg)
MySQL Group Replication (full transaction)
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
54 / 192
![Page 55: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/55.jpg)
MySQL Group Replication (full transaction)
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
55 / 192
![Page 56: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/56.jpg)
MySQL Group Replication (full transaction)
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
56 / 192
![Page 57: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/57.jpg)
MySQL Group Replication (full transaction)
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
57 / 192
![Page 58: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/58.jpg)
MySQL Group Replication (full transaction)
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
58 / 192
![Page 59: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/59.jpg)
MySQL Group Replication (full transaction)
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
59 / 192
![Page 60: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/60.jpg)
MySQL Group Replication (full transaction)
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
60 / 192
![Page 61: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/61.jpg)
Group Replication : Total Order Delivery - GTID
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
61 / 192
![Page 62: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/62.jpg)
Group Replication : Total Order Delivery - GTID
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
62 / 192
![Page 63: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/63.jpg)
Group Replication : Total Order Delivery - GTID
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
63 / 192
![Page 64: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/64.jpg)
Group Replication : Total Order Delivery - GTID
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
64 / 192
![Page 65: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/65.jpg)
Group Replication : Total Order Delivery - GTID
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
65 / 192
![Page 66: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/66.jpg)
Group Replication : Total Order Delivery - GTID
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
66 / 192
![Page 67: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/67.jpg)
Group Replication : Total Order Delivery - GTID
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
67 / 192
![Page 68: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/68.jpg)
Group Replication : Total Order Delivery - GTID
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
68 / 192
![Page 69: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/69.jpg)
Group Replication : Total Order Delivery - GTID
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
69 / 192
![Page 70: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/70.jpg)
Group Replication : Total Order Delivery - GTID
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
70 / 192
![Page 71: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/71.jpg)
Group Replication : Total Order Delivery - GTID
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
71 / 192
![Page 72: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/72.jpg)
Group Replication : Total Order Delivery - GTID
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
72 / 192
![Page 73: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/73.jpg)
Group Replication : Total Order Delivery - GTID
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
73 / 192
![Page 74: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/74.jpg)
Group Replication : Total Order Delivery - GTID
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
74 / 192
![Page 75: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/75.jpg)
Group Replication : Total Order Delivery - GTID
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
75 / 192
![Page 76: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/76.jpg)
Group Replication : Total Order Delivery - GTID
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
76 / 192
![Page 77: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/77.jpg)
Group Replication : Total Order Delivery - GTID
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
77 / 192
![Page 78: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/78.jpg)
Group Replication : Total Order Delivery - GTID
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
78 / 192
![Page 79: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/79.jpg)
Group Replication : Total Order Delivery - GTID
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
79 / 192
![Page 80: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/80.jpg)
Group Replication : Optimistic LockingGroup Replication uses optimistic locking
during a transaction, local (InnoDB) locking happensoptimistically assumes there will be no conflicts across nodes (no communication between nodes necessary)cluster-wide conflict resolution happens only at COMMIT, during certification
Let's first have a look at the traditional locking to compare.
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
80 / 192
![Page 81: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/81.jpg)
Traditional locking
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
81 / 192
![Page 82: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/82.jpg)
Traditional locking
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
82 / 192
![Page 83: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/83.jpg)
Traditional locking
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
83 / 192
![Page 84: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/84.jpg)
Traditional locking
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
84 / 192
![Page 85: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/85.jpg)
Traditional locking
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
85 / 192
![Page 86: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/86.jpg)
Traditional locking
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
86 / 192
![Page 87: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/87.jpg)
Optimistic Locking
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
87 / 192
![Page 88: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/88.jpg)
Optimistic Locking
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
88 / 192
![Page 89: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/89.jpg)
Optimistic Locking
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
89 / 192
![Page 90: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/90.jpg)
Optimistic Locking
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
90 / 192
![Page 91: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/91.jpg)
Optimistic Locking
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
91 / 192
![Page 92: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/92.jpg)
Optimistic Locking
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
92 / 192
![Page 93: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/93.jpg)
Optimistic Locking
The system returns error 149 as certification failed:
ERROR 1180 (HY000): Got error 149 during COMMIT
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
93 / 192
![Page 94: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/94.jpg)
Group Replication : requirementsexclusively works with InnoDB tables only
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
94 / 192
![Page 95: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/95.jpg)
Group Replication : requirementsexclusively works with InnoDB tables onlyevery tables must have a PK defined
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
95 / 192
![Page 96: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/96.jpg)
Group Replication : requirementsexclusively works with InnoDB tables onlyevery tables must have a PK definedonly IPV4 is supported
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
96 / 192
![Page 97: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/97.jpg)
Group Replication : requirementsexclusively works with InnoDB tables onlyevery tables must have a PK definedonly IPV4 is supporteda good network with low latency is important
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
97 / 192
![Page 98: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/98.jpg)
Group Replication : 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 @ 2016 Oracle and/or its affiliates. All rights reserved.
98 / 192
![Page 99: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/99.jpg)
Group Replication : 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 @ 2016 Oracle and/or its affiliates. All rights reserved.
99 / 192
![Page 100: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/100.jpg)
Group Replication : requirements (2)enable GTIDs
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
100 / 192
![Page 101: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/101.jpg)
Group Replication : requirements (2)enable GTIDsreplication meta-data must be stored on system tables
--master-info-repository=TABLE --relay-log-info-repository=TABLE
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
101 / 192
![Page 102: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/102.jpg)
Group Replication : requirements (2)enable GTIDsreplication meta-data must be stored on system tables
--master-info-repository=TABLE --relay-log-info-repository=TABLE
writesets extraction must be enabled
--transaction-write-set-extraction=XXHASH64
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
102 / 192
![Page 103: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/103.jpg)
Group Replication : requirements (2)enable GTIDsreplication meta-data must be stored on 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 be enabled
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
103 / 192
![Page 104: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/104.jpg)
Group Replication : limitationsThere are also some technical limitations:
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
104 / 192
![Page 105: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/105.jpg)
Group Replication : limitationsThere are also some technical limitations:
binlog checksum is not supported
--binlog-checksum=NONE
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
105 / 192
![Page 106: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/106.jpg)
Group Replication : limitationsThere are also some technical limitations:
binlog checksum is not supported
--binlog-checksum=NONE
Savepoints are not supported
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
106 / 192
![Page 107: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/107.jpg)
Group Replication : limitationsThere are also some technical limitations:
binlog checksum is not supported
--binlog-checksum=NONE
Savepoints are not supportedSERIALIZABLE is not supported as transaction isolation level
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
107 / 192
![Page 108: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/108.jpg)
Group Replication : limitationsThere are also some technical limitations:
binlog checksum is not supported
--binlog-checksum=NONE
Savepoints are not supportedSERIALIZABLE is not supported as transaction isolation levelan object cannot be changed concurrently at different servers by two operations,where one of them is a DDL and the other is either a DML or DDL.
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
108 / 192
![Page 109: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/109.jpg)
Is my workload ready for Group Replication ?As the writesets (transactions) are replicated to all available nodes on commit, and asthey are certified on every node, a very large writeset could increase the amount ofcertification errors.
Additionally, changing the same record on all the nodes (hotspot) concurrently will alsocause problems.
And finally, the certification uses the primary key of the tables, a table without PK is alsoa problem.
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
109 / 192
![Page 110: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/110.jpg)
Is my workload ready for Group Replication ?Therefore, when using Group Replication, we should pay attention to these points:
PK is mandatory (and a good one is better)avoid large transactionsavoid hotspot
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
110 / 192
![Page 111: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/111.jpg)
ready ?
Migration from Master-Slave to GR
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
111 / 192
![Page 112: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/112.jpg)
The plan
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
112 / 192
![Page 113: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/113.jpg)
1) We install andsetup MySQL InnoDBCluster on one of thenew servers
The plan
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
113 / 192
![Page 114: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/114.jpg)
2) We restore abackup
3) setupasynchronousreplication on the newserver.
The plan
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
114 / 192
![Page 115: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/115.jpg)
4) We add a newinstance to our group
The plan
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
115 / 192
![Page 116: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/116.jpg)
5) We point theapplication to one ofour new nodes.
6) We wait and checkthat asynchronousreplication is caughtup
7) we stop thoseasynchronous slaves
The plan
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
116 / 192
![Page 117: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/117.jpg)
8) We attach themysql2 slave to thegroup
The plan
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
117 / 192
![Page 118: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/118.jpg)
9) Use MySQL Routerfor directing traffic
The plan
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
118 / 192
![Page 119: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/119.jpg)
MySQL InnoDB Cluster from Labs is alreadyinstalled on mysql3.
Let's take a backup on mysql1:
[mysql1 ~]# xtrabackup --backup \ --target-dir=/tmp/backup \ --user=root \ --password=X --host=127.0.0.1
[mysql1 ~]# xtrabackup --prepare \ --target-dir=/tmp/backup
LAB2: Prepare mysql3Asynchronous slave
119 / 192
![Page 120: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/120.jpg)
LAB2: Prepare mysql3 (2)Asynchronous slave
Copy the backup from mysql1 to mysql3:
[mysql1 ~]# scp -r /tmp/backup mysql3:/tmp
And restore it:
[mysql3 ~]# xtrabackup --copy-back --target-dir=/tmp/backup [mysql3 ~]# chown -R mysql. /var/lib/mysql
120 / 192
![Page 121: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/121.jpg)
LAB3: mysql3 as asynchronous slave (2)Asynchronous slave
Configure /etc/my.cnf:
[mysqld]...server_id=3enforce_gtid_consistency = ongtid_mode = onlog_bin log_slave_updates
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
121 / 192
![Page 122: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/122.jpg)
LAB2: Prepare mysql3 (3)Asynchronous slave
Let's start MySQL on mysql3:
[mysql3 ~]# systemctl start mysqld
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
122 / 192
![Page 123: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/123.jpg)
find the GTIDs purgedchange MASTERset the purged GTIDsstart replication
LAB3: mysql3 as asynchronous slave (1)
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
123 / 192
![Page 124: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/124.jpg)
LAB3: mysql3 as asynchronous slave (2)Find the latest purged GTIDs:
[mysql3 ~]# cat /tmp/backup/xtrabackup_binlog_info mysql-bin.000002 167646328 b346474c-8601-11e6-9b39-08002718d305:1-771
Connect to mysql3 and setup replication:
mysql> CHANGE MASTER TO MASTER_HOST="mysql1", MASTER_USER="repl_async", MASTER_PASSWORD='Xslave', MASTER_AUTO_POSITION=1;
mysql> RESET MASTER;mysql> SET global gtid_purged="VALUE FOUND PREVIOUSLY";
mysql> START SLAVE;
Check that you receive the application's traffic
124 / 192
![Page 125: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/125.jpg)
Disclamer !The following commands to manage and use MySQL InnoDB Cluster are compatible withMySQL InnoDB Cluster 5.7.15 Preview from labs.
Functions may change in future releases.
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
125 / 192
![Page 126: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/126.jpg)
LAB4: MySQL InnoDB ClusterCreate a single instance cluster
Time to use the new MySQL Shell !
[mysql3 ~]# mysqlsh
Let's verify if our server is ready to become a member of a new cluster:
mysql-js> dba.validateInstance('root@mysql3:3306')
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
126 / 192
![Page 127: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/127.jpg)
LAB4: configuration settings (2)
mysql3's my.cnf
Configure /etc/my.cnf:
[mysqld]...server_id=3enforce_gtid_consistency = ongtid_mode = onlog_bin log_slave_updates
binlog_checksum = nonemaster_info_repository = TABLErelay_log_info_repository = TABLEtransaction_write_set_extraction = XXHASH64
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
127 / 192
![Page 128: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/128.jpg)
LAB4: configuration settings (2)
mysql3's my.cnf
Configure /etc/my.cnf:
[mysqld]...server_id=3enforce_gtid_consistency = ongtid_mode = onlog_bin log_slave_updates
binlog_checksum = nonemaster_info_repository = TABLErelay_log_info_repository = TABLEtransaction_write_set_extraction = XXHASH64
[mysql3 ~]# systemctl restart mysqld
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
128 / 192
![Page 129: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/129.jpg)
LAB4: MySQL InnoDB Cluster (3)Create a single instance cluster
[mysql3 ~]# mysqlsh
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
129 / 192
![Page 130: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/130.jpg)
LAB4: MySQL InnoDB Cluster (3)Create a single instance cluster
[mysql3 ~]# mysqlsh
mysql-js> dba.validateInstance('root@mysql3:3306')
mysql-js> \c root@mysql3:3306
mysql-js> cluster = dba.createCluster('plam')
The KEY is the only credential we need to remember to manage our cluster.
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
130 / 192
![Page 131: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/131.jpg)
LAB4: MySQL InnoDB Cluster (3)Create a single instance cluster
[mysql3 ~]# mysqlsh
mysql-js> dba.validateInstance('root@mysql3:3306')
mysql-js> \c root@mysql3:3306
mysql-js> cluster = dba.createCluster('plam')
The KEY is the only credential we need to remember to manage our cluster.
mysql-js> cluster.status()
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
131 / 192
![Page 132: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/132.jpg)
Cluster Statusmysql-js> cluster.status(){ "clusterName": "plam", "defaultReplicaSet": { "status": "Cluster is NOT tolerant to any failures.", "topology": { "mysql3:3306": { "address": "mysql3:3306", "status": "ONLINE", "role": "HA", "mode": "R/W", "leaves": {} } } }}
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
132 / 192
![Page 133: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/133.jpg)
Add mysql4 to the Group:
restore the backupset the purged GTIDsuse MySQL shell
LAB5: add mysql4 to the cluster (1)
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
133 / 192
![Page 134: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/134.jpg)
LAB5: add mysql4 to the cluster (2)Copy the backup from mysql1 to mysql4:
[mysql1 ~]# scp -r /tmp/backup mysql4:/tmp
And restore it:
[mysql4 ~]# xtrabackup --copy-back --target-dir=/tmp/backup [mysql4 ~]# chown -R mysql. /var/lib/mysql
Start MySQL on mysql4:
[mysql4 ~]# systemctl start mysqld
134 / 192
![Page 135: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/135.jpg)
LAB5: MySQL shell to add an instance (3)[mysql4 ~]# mysqlsh
Let's verify the config:
mysql-js> dba.validateInstance('root@mysql4:3306')
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
135 / 192
![Page 136: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/136.jpg)
LAB5: MySQL shell to add an instance (4)Configure /etc/my.cnf:
[mysqld]...server_id=4enforce_gtid_consistency = ongtid_mode = onlog_bin log_slave_updates
binlog_checksum = nonemaster_info_repository = TABLErelay_log_info_repository = TABLEtransaction_write_set_extraction = XXHASH64
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
136 / 192
![Page 137: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/137.jpg)
LAB5: MySQL shell to add an instance (4)Configure /etc/my.cnf:
[mysqld]...server_id=4enforce_gtid_consistency = ongtid_mode = onlog_bin log_slave_updates
binlog_checksum = nonemaster_info_repository = TABLErelay_log_info_repository = TABLEtransaction_write_set_extraction = XXHASH64
[mysql4 ~]# systemctl restart mysqld
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
137 / 192
![Page 138: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/138.jpg)
LAB5: MySQL InnoDB Cluster (4)Group of 2 instances
Find the latest purged GTIDs:
[mysql4 ~]# cat /tmp/backup/xtrabackup_binlog_info mysql-bin.000002 167646328 b346474c-8601-11e6-9b39-08002718d305:1-77177
Connect to mysql4 and set GTID_PURGED
[mysql4 ~]# mysqlsh
mysql-js> \c root@mysql4:3306mysql-js> \sqlmysql-sql> RESET MASTER;mysql-sql> SET global gtid_purged="VALUE FOUND PREVIOUSLY";
138 / 192
![Page 139: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/139.jpg)
LAB5: MySQL InnoDB Cluster (5)mysql-sql> \js
mysql-js> dba.validateInstance('root@mysql4:3306')
mysql-js> \c root@mysql3:3306
mysql-js> cluster = dba.getCluster('plam')
mysql-js> cluster.addInstance("root@mysql4:3306")
mysql-js> cluster.status()
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
139 / 192
![Page 140: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/140.jpg)
Cluster Statusmysql-js> cluster.status(){ "clusterName": "plam", "defaultReplicaSet": { "status": "Cluster is NOT tolerant to any failures.", "topology": { "mysql3:3306": { "address": "mysql3:3306", "status": "ONLINE", "role": "HA", "mode": "R/W", "leaves": { "mysql4:3306": { "address": "mysql4:3306", "status": "RECOVERING", "role": "HA", "mode": "R/O", "leaves": {} } } } } }}
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
140 / 192
![Page 141: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/141.jpg)
Recovering progressOn standard MySQL, monitor the group_replication_recovery channel to seethe progress:
mysql> show slave status for channel 'group_replication_recovery'\G *************************** 1. row *************************** Slave_IO_State: Waiting for master to send event Master_Host: mysql3 Master_User: mysql_innodb_cluster_rpl_user ... Slave_IO_Running: Yes Slave_SQL_Running: Yes ... Retrieved_Gtid_Set: 6e7d7848-860f-11e6-92e4-08002718d305:1-6,7c1f0c2d-860d-11e6-9df7-08002718d305:1-15,b346474c-8601-11e6-9b39-08002718d305:1964-77177,e8c524df-860d-11e6-9df7-08002718d305:1-2 Executed_Gtid_Set: 7c1f0c2d-860d-11e6-9df7-08002718d305:1-7,b346474c-8601-11e6-9b39-08002718d305:1-45408,e8c524df-860d-11e6-9df7-08002718d305:1-2 ...
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
141 / 192
![Page 142: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/142.jpg)
point the applicationto the cluster
Migrate the application
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
142 / 192
![Page 143: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/143.jpg)
LAB6: Migrate the applicationNow we need to point the application to mysql3, this is the only downtime !
...[ 21257s] threads: 4, tps: 12.00, reads: 167.94, writes: 47.98, response time: 18[ 21258s] threads: 4, tps: 6.00, reads: 83.96, writes: 23.99, response time: 14[ 21259s] threads: 4, tps: 7.00, reads: 98.05, writes: 28.01, response time: 16[ 31250s] threads: 4, tps: 8.00, reads: 111.95, writes: 31.99, response time: 30[ 31251s] threads: 4, tps: 11.00, reads: 154.01, writes: 44.00, response time: 13[ 31252s] threads: 4, tps: 11.00, reads: 153.94, writes: 43.98, response time: 12[ 31253s] threads: 4, tps: 10.01, reads: 140.07, writes: 40.02, response time: 17^C[mysql1 ~]# run_app.sh mysql3
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
143 / 192
![Page 144: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/144.jpg)
LAB6: Migrate the applicationMake sure replication is running properly on mysql2 and mysql3.
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
144 / 192
![Page 145: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/145.jpg)
LAB6: Migrate the applicationMake sure replication is running properly on mysql2 and mysql3.
************************** 1. row ***************************... Master_Host: mysql1 Slave_IO_Running: Yes Slave_SQL_Running: No... Last_SQL_Errno: 3100 Last_SQL_Error: Error in Xid_log_event: Commit could not be completed, 'Error on observer while running replication hook 'before_commit'.' Replicate_Ignore_Server_Ids: Master_Server_Id: 1 Master_UUID: 8fbcd944-8760-11e6-9b4e-08002718d305... Last_SQL_Error_Timestamp: 160930 23:04:07 Retrieved_Gtid_Set: 8fbcd944-8760-11e6-9b4e-08002718d305:360-3704 Executed_Gtid_Set: 0b31b4f3-8762-11e6-bb35-08002718d305:1-7,30212757-8762-11e6-ad73-08002718d305:1-2,8fbcd944-8760-11e6-9b4e-08002718d305:1-2652 Auto_Position: 1
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
145 / 192
![Page 146: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/146.jpg)
LAB6: Migrate the applicationFix replication if necessary:
mysql3> start slave;mysql3> show slave status;
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
146 / 192
![Page 147: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/147.jpg)
LAB6: Migrate the applicationFix replication if necessary:
mysql3> start slave;mysql3> show slave status;
Stop asynchronous replication on mysql2 and mysql3:
mysql2> stop slave;mysql3> stop slave;
Make sure gtid_executed range on mysql2 is lower or equal than on mysql3
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
147 / 192
![Page 148: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/148.jpg)
LAB6: Migrate the applicationFix replication if necessary:
mysql3> start slave;mysql3> show slave status;
Stop asynchronous replication on mysql2 and mysql3:
mysql2> stop slave;mysql3> stop slave;
Make sure gtid_executed range on mysql2 is lower or equal than on mysql3
mysql2> set global super_read_only=off;# http://bugs.mysql.com/bug.php?id=83234mysql2> reset slave all;mysql3> reset slave all;
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
148 / 192
![Page 149: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/149.jpg)
previous slave(mysql2) can nowbe part of the cluster
Add a third instance
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
149 / 192
![Page 150: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/150.jpg)
LAB7: Add mysql2 to the groupWe first validate the instance using MySQL shell and we modify the configuration.
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
150 / 192
![Page 151: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/151.jpg)
LAB7: Add mysql2 to the groupWe first validate the instance using MySQL shell and we modify the configuration.
[mysqld]...super_read_only=0server_id=2binlog_checksum = noneenforce_gtid_consistency = ongtid_mode = onlog_bin log_slave_updatesmaster_info_repository = TABLErelay_log_info_repository = TABLEtransaction_write_set_extraction = XXHASH64
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
151 / 192
![Page 152: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/152.jpg)
LAB7: Add mysql2 to the groupWe first validate the instance using MySQL shell and we modify the configuration.
[mysqld]...super_read_only=0server_id=2binlog_checksum = noneenforce_gtid_consistency = ongtid_mode = onlog_bin log_slave_updatesmaster_info_repository = TABLErelay_log_info_repository = TABLEtransaction_write_set_extraction = XXHASH64
[mysql2 ~]# systemctl restart mysqld
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
152 / 192
![Page 153: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/153.jpg)
LAB7: Add mysql2 to the group (2)Back in MySQL shell we add the new instance:
[mysql2 ~]# mysqlsh
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
153 / 192
![Page 154: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/154.jpg)
LAB7: Add mysql2 to the group (2)Back in MySQL shell we add the new instance:
[mysql2 ~]# mysqlsh
mysql-js> dba.validateInstance('root@mysql2:3306')
mysql-js> \c root@mysql3:3306
mysql-js> cluster = dba.getCluster('plam')
mysql-js> cluster.addInstance("root@mysql2:3306")
mysql-js> cluster.status()
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
154 / 192
![Page 155: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/155.jpg)
LAB7: Add mysql2 to the group (3){ "clusterName": "plam", "defaultReplicaSet": { "status": "Cluster tolerant to up to ONE failure.", "topology": { "mysql3:3306": { "address": "mysql3:3306", "status": "ONLINE", "role": "HA", "mode": "R/W", "leaves": { "mysql4:3306": { "address": "mysql4:3306", "status": "ONLINE", "role": "HA", "mode": "R/O", "leaves": {} }, "mysql2:3306": { "address": "mysql2:3306", "status": "ONLINE", "role": "HA", "mode": "R/O", "leaves": {} } } Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
155 / 192
![Page 156: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/156.jpg)
WOOHOOOOW
IT WORKS!
156 / 192
![Page 157: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/157.jpg)
writing to a single server
Single Primary Mode
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
157 / 192
![Page 158: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/158.jpg)
Default = Single Primary ModeBy default, MySQL InnoDB Cluster enables Single Primary Mode.
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
158 / 192
![Page 159: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/159.jpg)
Default = Single Primary ModeBy default, MySQL InnoDB Cluster enables Single Primary Mode.
mysql> show global variables like 'group_replication_single_primary_mode';+---------------------------------------+-------+| Variable_name | Value |+---------------------------------------+-------+| group_replication_single_primary_mode | ON |+---------------------------------------+-------+
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
159 / 192
![Page 160: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/160.jpg)
Default = Single Primary ModeBy default, MySQL InnoDB Cluster enables 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 @ 2016 Oracle and/or its affiliates. All rights reserved.
160 / 192
![Page 161: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/161.jpg)
Who's the Primary Master ?As the Primary Master is elected, all nodes part of the group knows which one waselected. This value is exposed in status variables:
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
161 / 192
![Page 162: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/162.jpg)
Who's the Primary Master ?As the Primary Master is elected, all nodes part of the group knows which one waselected. This value is exposed in status variables:
mysql> show status like 'group_replication_primary_member';+----------------------------------+--------------------------------------+| Variable_name | Value |+----------------------------------+--------------------------------------+| group_replication_primary_member | 28a4e51f-860e-11e6-bdc4-08002718d305 |+----------------------------------+--------------------------------------+
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
162 / 192
![Page 163: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/163.jpg)
Who's the Primary Master ?As the Primary Master is elected, all nodes part of the group knows which one waselected. This value is exposed in status variables:
mysql> show status like 'group_replication_primary_member';+----------------------------------+--------------------------------------+| Variable_name | Value |+----------------------------------+--------------------------------------+| group_replication_primary_member | 28a4e51f-860e-11e6-bdc4-08002718d305 |+----------------------------------+--------------------------------------+
mysql> select member_host as "primary master" from performance_schema.global_status join performance_schema.replication_group_members where variable_name = 'group_replication_primary_member' and member_id=variable_value;+---------------+| primary master|+---------------+| mysql3 |+---------------+
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
163 / 192
![Page 164: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/164.jpg)
get more info
Monitoring
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
164 / 192
![Page 165: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/165.jpg)
Performance SchemaGroup Replication uses Performance_Schema to expose status
mysql3> SELECT * FROM performance_schema.replication_group_members\G *************************** 1. row *************************** CHANNEL_NAME: group_replication_applier MEMBER_ID: 00db47c7-3e23-11e6-afd4-08002774c31b MEMBER_HOST: mysql3.localdomain MEMBER_PORT: 3306 MEMBER_STATE: ONLINE
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
165 / 192
![Page 166: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/166.jpg)
Performance SchemaGroup Replication uses Performance_Schema to expose status
mysql3> SELECT * FROM performance_schema.replication_group_members\G *************************** 1. row *************************** CHANNEL_NAME: group_replication_applier MEMBER_ID: 00db47c7-3e23-11e6-afd4-08002774c31b MEMBER_HOST: mysql3.localdomain MEMBER_PORT: 3306 MEMBER_STATE: ONLINE
mysql3> 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-2 LAST_ERROR_NUMBER: 0 LAST_ERROR_MESSAGE: LAST_ERROR_TIMESTAMP: 0000-00-00 00:00:00
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
166 / 192
![Page 167: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/167.jpg)
Member StateThese are the different possible state for a node member:
ONLINE
OFFLINE
RECOVERING
ERROR: when a node is leaving but the plugin was not instructed to stopUNREACHABLE
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
167 / 192
![Page 168: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/168.jpg)
Status information & metrics
Membersmysql> SELECT * FROM performance_schema.replication_group_members\G
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
168 / 192
![Page 169: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/169.jpg)
Status information & metrics
Membersmysql> SELECT * FROM performance_schema.replication_group_members\G
*************************** 1. row *************************** CHANNEL_NAME: group_replication_applier MEMBER_ID: 00db47c7-3e23-11e6-afd4-08002774c31b MEMBER_HOST: mysql3.localdomain MEMBER_PORT: 3306 MEMBER_STATE: ONLINE *************************** 2. row *************************** CHANNEL_NAME: group_replication_applier MEMBER_ID: e1544c9d-4451-11e6-9f5a-08002774c31b MEMBER_HOST: mysql4.localdomain.localdomain MEMBER_PORT: 3306 MEMBER_STATE: ONLINE
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
169 / 192
![Page 170: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/170.jpg)
Status information & metrics
Connectionsmysql> SELECT * FROM performance_schema.replication_connection_status\G
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
170 / 192
![Page 171: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/171.jpg)
Status information & metrics
Connectionsmysql> 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: 5de4400b-3dd7-11e6-8a71-08002774c31b:1-814089, afb80f36-2bff-11e6-84e0-0800277dd3bf:1-2834 LAST_ERROR_NUMBER: 0 LAST_ERROR_MESSAGE: LAST_ERROR_TIMESTAMP: 0000-00-00 00:00:00 *************************** 2. row *************************** CHANNEL_NAME: group_replication_recovery GROUP_NAME: SOURCE_UUID: THREAD_ID: NULL SERVICE_STATE: OFF
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
171 / 192
![Page 172: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/172.jpg)
Status information & metrics
Local node status mysql> select * from performance_schema.replication_group_member_stats\G
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
172 / 192
![Page 173: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/173.jpg)
Status information & metrics
Local node status mysql> select * from performance_schema.replication_group_member_stats\G
*************************** 1. row *************************** CHANNEL_NAME: group_replication_applier VIEW_ID: 14679667214442885:4 MEMBER_ID: e1544c9d-4451-11e6-9f5a-08002774c31b COUNT_TRANSACTIONS_IN_QUEUE: 0 COUNT_TRANSACTIONS_CHECKED: 5961 COUNT_CONFLICTS_DETECTED: 0 COUNT_TRANSACTIONS_ROWS_VALIDATING: 0 TRANSACTIONS_COMMITTED_ALL_MEMBERS: 5de4400b-3dd7-11e6-8a71-08002774c31b:1-814089, afb80f36-2bff-11e6-84e0-0800277dd3bf:1-5718 LAST_CONFLICT_FREE_TRANSACTION: afb80f36-2bff-11e6-84e0-0800277dd3bf:5718
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
173 / 192
![Page 174: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/174.jpg)
Performance_SchemaYou can find GR information in the following Performance_Schema tables:
replication_applier_con guration
replication_applier_status
replication_applier_status_by_worker
replication_connection_con guration
replication_connection_status
replication_group_member_stats
replication_group_members
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
174 / 192
![Page 175: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/175.jpg)
Status during recovery mysql> SHOW SLAVE STATUS FOR CHANNEL 'group_replication_recovery'\G
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
175 / 192
![Page 176: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/176.jpg)
Status during recovery mysql> SHOW SLAVE STATUS FOR CHANNEL 'group_replication_recovery'\G
*************************** 1. row *************************** Slave_IO_State: Master_Host: <NULL> Master_User: gr_repl Master_Port: 0 ... Relay_Log_File: mysql4-relay-bin-group_replication_recovery.000001 ... Slave_IO_Running: No Slave_SQL_Running: No ... Executed_Gtid_Set: 5de4400b-3dd7-11e6-8a71-08002774c31b:1-814089, afb80f36-2bff-11e6-84e0-0800277dd3bf:1-5718 ... Channel_Name: group_replication_recovery
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
176 / 192
![Page 177: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/177.jpg)
Sys SchemaThe easiest way to detect if a node is a member of the primary component (when thereare partitioning of your nodes due to network issues for example) and therefore a validcandidate for routing queries to it, is to use the sys table.
Additional information for sys can be downloaded athttps://github.com/lefred/mysql_gr_routing_check/blob/master/addition_to_sys.sql
On the primary node:
[mysql3 ~]# mysql < /tmp/gr_addition_to_sys.sql
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
177 / 192
![Page 178: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/178.jpg)
Sys SchemaIs this node part of PRIMARY Partition:
mysql3> SELECT sys.gr_member_in_primary_partition();+------------------------------------+| sys.gr_node_in_primary_partition() |+------------------------------------+| YES |+------------------------------------+
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
178 / 192
![Page 179: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/179.jpg)
Sys SchemaIs this node part of PRIMARY Partition:
mysql3> SELECT sys.gr_member_in_primary_partition();+------------------------------------+| sys.gr_node_in_primary_partition() |+------------------------------------+| YES |+------------------------------------+
To use as healthcheck:
mysql3> SELECT * FROM sys.gr_member_routing_candidate_status;+------------------+-----------+---------------------+----------------------+| viable_candidate | read_only | transactions_behind | transactions_to_cert |+------------------+-----------+---------------------+----------------------+| YES | YES | 0 | 0 |+------------------+-----------+---------------------+----------------------+
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
179 / 192
![Page 180: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/180.jpg)
Sys Schema - Heath CheckOn one of the non Primary nodes, run the following command:
mysql-sql> ush tables with read lock;
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
180 / 192
![Page 181: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/181.jpg)
Sys Schema - Heath CheckOn one of the non Primary nodes, run the following command:
mysql-sql> ush tables with read lock;
Now you can verify what the healthcheck exposes to you:
mysql-sql> SELECT * FROM sys.gr_member_routing_candidate_status;+------------------+-----------+---------------------+----------------------+| viable_candidate | read_only | transactions_behind | transactions_to_cert |+------------------+-----------+---------------------+----------------------+| YES | YES | 950 | 0 |+------------------+-----------+---------------------+----------------------+
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
181 / 192
![Page 182: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/182.jpg)
Sys Schema - Heath CheckOn one of the non Primary nodes, run the following command:
mysql-sql> ush tables with read lock;
Now you can verify what the healthcheck exposes to you:
mysql-sql> SELECT * FROM sys.gr_member_routing_candidate_status;+------------------+-----------+---------------------+----------------------+| viable_candidate | read_only | transactions_behind | transactions_to_cert |+------------------+-----------+---------------------+----------------------+| YES | YES | 950 | 0 |+------------------+-----------+---------------------+----------------------+
mysql-sql> UNLOCK tables;
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
182 / 192
![Page 183: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/183.jpg)
application interaction
MySQL Router
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
183 / 192
![Page 184: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/184.jpg)
MySQL RouterWe will now use mysqlrouter between our application and the cluster.
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
184 / 192
![Page 185: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/185.jpg)
MySQL Router (2)Configure MySQL Router (bootstrap it using an instance):
[mysql2 ~]# mysqlrouter --bootstrap mysql2:3306Please enter the administrative MASTER key for the MySQL InnoDB cluster: MySQL Router has now been con gured for the InnoDB cluster 'plam'.
The following connection information can be used to connect to the cluster.
Classic MySQL protocol connections to cluster 'plam':- Read/Write Connections: localhost:6446- Read/Only Connections: localhost:6447
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
185 / 192
![Page 186: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/186.jpg)
MySQL Router (3)Now let's copy the configuration to mysql1 (our app server) and modify it to listen toport 3306:
[mysql2 ~]# scp /etc/mysqlrouter/mysqlrouter.conf mysql1:/etc/mysqlrouter/
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
186 / 192
![Page 187: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/187.jpg)
MySQL Router (3)Now let's copy the configuration to mysql1 (our app server) and modify it to listen toport 3306:
[mysql2 ~]# scp /etc/mysqlrouter/mysqlrouter.conf mysql1:/etc/mysqlrouter/
[routing:default_rw]-bind_port=6446+bind_port=3306+bind_address=mysql1
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
187 / 192
![Page 188: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/188.jpg)
MySQL Router (3)Now let's copy the configuration to mysql1 (our app server) and modify it to listen toport 3306:
[mysql2 ~]# scp /etc/mysqlrouter/mysqlrouter.conf mysql1:/etc/mysqlrouter/
[routing:default_rw]-bind_port=6446+bind_port=3306+bind_address=mysql1
We can stop mysqld on mysql1 and start mysqlrouter into a screen session:
[mysql1 ~]# systemctl stop mysqld[mysql1 ~]# mysqlrouter
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
188 / 192
![Page 189: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/189.jpg)
MySQL Router (4)Now we can point the application to the router:
[mysql1 ~]# run_app.sh mysql1
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
189 / 192
![Page 190: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/190.jpg)
MySQL Router (4)Now we can point the application to the router:
[mysql1 ~]# run_app.sh mysql1
Check app and kill mysqld on mysql3 (the Primary Master R/W node) !
[mysql3 ~]# kill -9 $(pidof mysqld)
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
190 / 192
![Page 191: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/191.jpg)
MySQL Router (4)Now we can point the application to the router:
[mysql1 ~]# run_app.sh mysql1
Check app and kill mysqld on mysql3 (the Primary Master R/W node) !
[mysql3 ~]# kill -9 $(pidof mysqld)
mysql> select member_host as "primary" from performance_schema.global_status join performance_schema.replication_group_members where variable_name = 'group_replication_primary_member' and member_id=variable_value;+---------+| primary |+---------+| mysql4 |+---------+
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
191 / 192
![Page 192: 1 / 192...1 / 192 MySQL Group Replication in a nutshell MySQL InnoDB Cluster: hands-on tutorial Percona Live Amsterdam - October 2016 Frédéric Descamps - MySQL Community Manager](https://reader030.vdocument.in/reader030/viewer/2022040801/5e39c1cba43dce63f0186cbd/html5/thumbnails/192.jpg)
Thank you !
Questions ?
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.
192 / 192