SlideShare a Scribd company logo
1 of 230
Download to read offline
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 1/230
1 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 2/230
2 / 2302 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 3/230
MySQL InnoDB Cluster in a Nutshell
Hands-On Tutorial
Percona Live USA - Austin, TX 2019
Frédéric Descamps - MySQL Community Manager - Oracle
Kenny Gryp - MySQL Product Manager - Oracle
3 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 4/230
 
Safe Harbor Statement
The following is intended to outline our general product direction. It is intended for information purpose only, and may not be
incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied up in
making purchasing decisions. The development, release and timing of any features or functionality described for Oracle´s product
remains at the sole discretion of Oracle.
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
4 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 5/230
Who are we ?
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
5 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 6/230
Frédéric Descamps
@lefred
MySQL Evangelist
Managing MySQL since 3.23
devops believer
http://about.me/lefred
 
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
6 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 7/230
Kenny Gryp
@gryp
MySQL Product Manager
    High Availability & InnoDB
 
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
7 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 8/230
how will the session proceed?
Agenda
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
8 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 9/230
Agenda
Prepare your workstation
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
9 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 10/230
Agenda
Prepare your workstation
What is MySQL InnoDB Cluster & Group Replication ?
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
10 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 11/230
Agenda
Prepare your workstation
What is MySQL InnoDB Cluster & Group Replication ?
Migrating from Asynchronous Replication to Group Replication
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
11 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 12/230
Agenda
Prepare your workstation
What is MySQL InnoDB Cluster & Group Replication ?
Migrating from Asynchronous Replication to Group Replication
Monitoring
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
12 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 13/230
Agenda
Prepare your workstation
What is MySQL InnoDB Cluster & Group Replication ?
Migrating from Asynchronous Replication to Group Replication
Monitoring
Connecting to the cluster
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
13 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 14/230
Agenda
Prepare your workstation
What is MySQL InnoDB Cluster & Group Replication ?
Migrating from Asynchronous Replication to Group Replication
Monitoring
Connecting to the cluster
Various Configuration Options
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
14 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 15/230
Agenda
Prepare your workstation
What is MySQL InnoDB Cluster & Group Replication ?
Migrating from Asynchronous Replication to Group Replication
Monitoring
Connecting to the cluster
Various Configuration Options
Application Behavior & Consistency Guarantees
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
15 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 16/230
Agenda
Prepare your workstation
What is MySQL InnoDB Cluster & Group Replication ?
Migrating from Asynchronous Replication to Group Replication
Monitoring
Connecting to the cluster
Various Configuration Options
Application Behavior & Consistency Guarantees
Failure Scenarios - Labs
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
16 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 17/230
VirtualBox
Setup your workstation
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
17 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 18/230
Setup your workstation
Install VirtualBox 6.0
On the USB key, COPY MySQLInnoDBCluster_PLUS19.ova and click on it
Ensure you have vboxnet0 network interface
Older VirtualBox: VirtualBox Pref. -> Network -> Host-Only Networks -> +
New VirtualBox: Global Tools -> Host Network Manager -> +
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
18 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 19/230
Login on your workstation
Start all virtual machines (mysql1, mysql2, mysql3 & mysql4)
Try to connect to all VM´s from your terminal or putty (root password is X) :
ssh root@192.168.56.11 mysql1
ssh root@192.168.56.12 mysql2
ssh root@192.168.56.13 mysql3
ssh root@192.168.56.14 mysql4
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
19 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 20/230
LAB1: Current situation
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
20 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 21/230
all running database servers (mysql1 &
mysql2) are using MySQL 5.7.24
LAB1: Current situation
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
21 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 22/230
launch run_app.sh on mysql1 into a
screen session
verify that mysql2 is a running replica
LAB1: Current situation
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
22 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 23/230
Summary
 
ROLE INTERNAL IP
mysql1 master 192.168.56.11
mysql2 replica 192.168.56.12
mysql3 n/a 192.168.56.13
mysql4 n/a 192.168.56.14
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
23 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 24/230
Summary
 
ROLE INTERNAL IP
mysql1 master 192.168.56.11
mysql2 replica 192.168.56.12
mysql3 n/a 192.168.56.13
mysql4 n/a 192.168.56.14
write this down somewhere !
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
24 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 25/230
Easy High Availability
MySQL InnoDB Cluster
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
25 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 26/230
InnoDB
cluster
Ease-of-Use
Extreme Scale-Out
Out-of-Box Solution
Built-in HA
High Performance
Everything Integrated
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
26 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 27/230
InnoDB Cluster's Architecture
Application
MySQL Connector
MySQL Router
MySQL Shell
InnoDB
cluster
Application
MySQL Connector
MySQL Router
Mp
M
M
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
27 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 28/230
Group Replication: heart of MySQL InnoDB Cluster
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
28 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 29/230
Group Replication: heart of MySQL InnoDB Cluster
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
29 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 30/230
MySQL Group Replication
but what is it ?!?
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
30 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 31/230
MySQL Group Replication
but what is it ?!?
GR is a plugin for MySQL, made by MySQL and packaged with MySQL
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
31 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 32/230
MySQL Group Replication
but what is it ?!?
GR is a plugin for MySQL, made by MySQL and packaged with MySQL
GR is an implementation of Replicated Database State Machine theory
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
32 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 33/230
MySQL Group Replication
but what is it ?!?
GR is a plugin for MySQL, made by MySQL and packaged with MySQL
GR is an implementation of Replicated Database State Machine theory
Paxos based protocol
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
33 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 34/230
MySQL Group Replication
but what is it ?!?
GR is a plugin for MySQL, made by MySQL and packaged with MySQL
GR is an implementation of Replicated Database State Machine theory
Paxos based protocol
GR allows to write on all Group Members (cluster nodes) simultaneously while retaining consistency
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
34 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 35/230
MySQL Group Replication
but what is it ?!?
GR is a plugin for MySQL, made by MySQL and packaged with MySQL
GR is an implementation of Replicated Database State Machine theory
Paxos based protocol
GR allows to write on all Group Members (cluster nodes) simultaneously while retaining consistency
GR implements conflict detection and resolution
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
35 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 36/230
MySQL Group Replication
but what is it ?!?
GR is a plugin for MySQL, made by MySQL and packaged with MySQL
GR is an implementation of Replicated Database State Machine theory
Paxos based protocol
GR allows to write on all Group Members (cluster nodes) simultaneously while retaining consistency
GR implements conflict detection and resolution
GR allows automatic distributed recovery
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
36 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 37/230
MySQL Group Replication
but what is it ?!?
GR is a plugin for MySQL, made by MySQL and packaged with MySQL
GR is an implementation of Replicated Database State Machine theory
Paxos based protocol
GR allows to write on all Group Members (cluster nodes) simultaneously while retaining consistency
GR implements conflict detection and resolution
GR allows automatic distributed recovery
Supported on all MySQL platforms !!
Linux, Windows, Solaris, OSX, FreeBSD
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
37 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 38/230
And for users ?
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
38 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 39/230
And for users ?
not longer necessary to handle server fail-over manually or with a complicated script
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
39 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 40/230
And for users ?
not longer necessary to handle server fail-over manually or with a complicated script
GR provides fault tolerance
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
40 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 41/230
And for users ?
not longer necessary to handle server fail-over manually or with a complicated script
GR provides fault tolerance
GR enables update-everywhere setups
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
41 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 42/230
And for users ?
not longer necessary to handle server fail-over manually or with a complicated script
GR provides fault tolerance
GR enables update-everywhere setups
GR handles crashes, failures, re-connects automatically
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
42 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 43/230
And for users ?
not longer necessary to handle server fail-over manually or with a complicated script
GR provides fault tolerance
GR enables update-everywhere setups
GR handles crashes, failures, re-connects automatically
Allows an easy setup of a highly available MySQL service!
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
43 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 44/230
Migrating
from Asynchronous Replication to Group Replication
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
44 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 45/230
The plan
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
45 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 46/230
These are the 10 steps for the migration:
1) We install and setup MySQL InnoDB Cluster on
one of the new servers
The plan
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
46 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 47/230
2) we restore a backup
3) we update to MySQL 8.0
4) setup asynchronous replication on the new
server.
The plan
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
47 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 48/230
5) we add a new instance to our group
The plan
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
48 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 49/230
6) we point the application to one of our new nodes.
7) we wait and check that asynchronous replication
is caught up
8) we stop those asynchronous slaves
The plan
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
49 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 50/230
9) we upgrade and attach mysql2 (previous slave)
to the group
The plan
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
50 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 51/230
10) use MySQL Router for directing traffic
The plan
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
51 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 52/230
LAB2: Verify if your environment can be upgraded to MySQL 8.0
We will first create an admin account on mysql1 that we will use throughout the tutorial:
mysql1> CREATE USER clusteradmin@'%' identi ed by 'mysql';
mysql1> GRANT ALL PRIVILEGES ON *.* TO clusteradmin@'%'
WITH GRANT OPTION;
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
52 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 53/230
LAB2: Verify if your environment can be upgraded to MySQL 8.0 - util
Now, we use MySQL Shell to check if the settings on mysql1 can be upgraded to MySQL 8.0 without problem:
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
53 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 54/230
LAB2: Verify if your environment can be upgraded to MySQL 8.0 - util
Now, we use MySQL Shell to check if the settings on mysql1 can be upgraded to MySQL 8.0 without problem:
# mysqlsh -- util check-for-server-upgrade clusteradmin@mysql1
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
54 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 55/230
LAB2: Verify if your environment can be upgraded to MySQL 8.0 - util
Now, we use MySQL Shell to check if the settings on mysql1 can be upgraded to MySQL 8.0 without problem:
# mysqlsh -- util check-for-server-upgrade clusteradmin@mysql1
Anything special in the output ?
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
55 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 56/230
LAB2: Verify if your environment can be upgraded to MySQL 8.0 - util
Now, we use MySQL Shell to check if the settings on mysql1 can be upgraded to MySQL 8.0 without problem:
# mysqlsh -- util check-for-server-upgrade clusteradmin@mysql1
Anything special in the output ?
# mysqlsh -- util check-for-server-upgrade clusteradmin@mysql1 
--con gPath=/etc/my.cnf
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
56 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 57/230
LAB2: Beautiful MySQL Shell
You can setup a better shell environment :
# mysqlsh
mysql-js> shell.options.setPersist('history.autoSave', 1)
mysql-js> shell.options.setPersist('history.maxSize', 5000)
# cp /usr/share/mysqlsh/prompt/prompt_256pl+aw.json ~/.mysqlsh/prompt.json
# mysqlsh clusteradmin@mysql2
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
57 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 58/230
MySQL 8.0.16 is already installed on mysql3.
Let´s take a backup on mysql1:
[mysql1 ~]# mysqlpump 
--set-gtid-purged=ON 
--exclude-databases=mysql 
--include-users=repl%,clusteradmin%,app% 
> /tmp/backup.sql
Copy the backup from mysql1 to mysql3:
[mysql1 ~]# scp -r /tmp/backup.sql mysql3:/tmp
LAB2: Prepare mysql3 - Asynchronous slave
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
58 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 59/230
restore the dump
change MASTER
start replication
LAB3: mysql3 as asynchronous slave (1)
 
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
59 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 60/230
LAB3: mysql3 as asynchronous slave (2)
Restore backup:
[mysql3 ~]# mysql < /tmp/backup.sql
Connect to mysql3 and setup replication:
mysql3> CHANGE MASTER TO MASTER_HOST="mysql1",
MASTER_USER="repl", MASTER_PASSWORD='X',
MASTER_AUTO_POSITION=1;
mysql3> START SLAVE;
Check that you receive the application´s traffic
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
60 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 61/230
Administration made easy and more...
MySQL InnoDB Cluster
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
61 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 62/230
LAB4: MySQL InnoDB Cluster
Create a single instance cluster (mysql3)
# mysqlsh
Let´s verify if our server is ready to become a member of a new cluster:
mysql-js> dba.checkInstanceCon guration('clusteradmin@mysql3')
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
62 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 63/230
LAB4: MySQL InnoDB Cluster
Create a single instance cluster (mysql3)
# mysqlsh
Let´s verify if our server is ready to become a member of a new cluster:
mysql-js> dba.checkInstanceCon guration('clusteradmin@mysql3')
Change the configuration !
mysql-js> dba.con gureInstance('clusteradmin@mysql3')
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
63 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 64/230
LAB4: MySQL InnoDB Cluster (2)
Wait just a bit if a restart is required (which is not the case here) and create a single instance cluster
mysql-js> dba.checkInstanceCon guration('clusteradmin@mysql3')
mysql-js> c clusteradmin@mysql3
mysql-js> cluster = dba.createCluster('perconalive')
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
64 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 65/230
LAB4: Cluster Status
mysql-js> cluster.status()
{
"clusterName": "perconalive",
"defaultReplicaSet": {
"name": "default",
"primary": "mysql3:3306",
"ssl": "REQUIRED",
"status": "OK_NO_TOLERANCE",
"statusText": "Cluster is NOT tolerant to any failures.",
"topology": {
"mysql3:3306": {
"address": "mysql3:3306",
"mode": "R/W",
"readReplicas": {},
"role": "HA",
"status": "ONLINE",
"version": "8.0.16"
}
},
"topologyMode": "Single-Primary"
},
"groupInformationSourceMember": "mysql3:3306"
}
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
65 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 66/230
Add mysql4 to the Group:
restore the backup
use MySQL Shell
LAB5: add mysql4 to the cluster (1)
 
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
66 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 67/230
LAB5: add mysql4 to the cluster (2)
Copy the backup from mysql1 to mysql4:
[mysql1 ~]# scp -r /tmp/backup.sql mysql4:/tmp
Restore the backup:
[mysql4 ~]# mysql < /tmp/backup.sql
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
67 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 68/230
LAB5: MySQL Shell to add an instance (3)
Let´s add mysql4 (check configuration, check instance and add to cluster all in one command that can be done from the opened
shell in mysql3):
mysql-js> dba.con gureInstance('clusteradmin@mysql4')
mysql-js> cluster.addInstance('clusteradmin@mysql4')
mysql-js> cluster.status()
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
68 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 69/230
Cluster Status
mysql-js> cluster.status()
{
"clusterName": "perconalive",
"defaultReplicaSet": {
"name": "default",
"primary": "mysql3:3306",
"ssl": "REQUIRED",
"status": "OK_NO_TOLERANCE",
"statusText": "Cluster is NOT tolerant to any failures. 1 member is no
"topology": {
"mysql3:3306": {
"address": "mysql3:3306",
"mode": "R/W",
"readReplicas": {},
"role": "HA",
"status": "ONLINE"
},
"mysql4:3306": {
"address": "mysql4:3306",
"mode": "R/O",
"readReplicas": {},
"role": "HA",
"status": "RECOVERING"
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
69 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 70/230
Recovering progress
On standard MySQL, monitor the group_replication_recovery channel to see the progress:
mysql4> 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 @ 2019 Oracle and/or its affiliates. All rights reserved.
70 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 71/230
Cluster Status
{
"clusterName": "perconalive",
"defaultReplicaSet": {
"name": "default",
"primary": "mysql3:3306",
"ssl": "REQUIRED",
"status": "OK_NO_TOLERANCE",
"statusText": "Cluster is NOT tolerant to any failures.",
"topology": {
"mysql3:3306": {
"address": "mysql3:3306",
"mode": "R/W",
"readReplicas": {},
"role": "HA",
"status": "ONLINE"
},
"mysql4:3306": {
"address": "mysql4:3306",
"mode": "R/O",
"readReplicas": {},
"role": "HA",
"status": "ONLINE"
}
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
71 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 72/230
Asynchronous Replication
When a group is created, the asynchronous SQL Thread is stopped and needs to be restarted.
Verify that replication from mysql1 is still running on mysql3, and restart the SQL Thread:
mysql-sql> c clusteradmin@mysql3
mysql-sql> SHOW SLAVE STATUSG
mysql-sql> START SLAVE SQL_THREAD;
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
72 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 73/230
point the application to the cluster
Migrate the application
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
73 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 74/230
LAB6: Migrate the application
Now we need to point the application to mysql3, this is the only downtime !
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
74 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 75/230
LAB6: Migrate the application
Now we need to point the application to mysql3, this is the only downtime !
Make sure the master and replica is in sync
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
75 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 76/230
LAB6: Migrate the application
Now we need to point the application to mysql3, this is the only downtime !
Make sure the master and replica is in sync
Start application, connecting to the Group Replication master (mysql3)
...
[ 21257s] threads: 4, tps: 12.00, reads: 167.94, writes: 47.98, response t
[ 21258s] threads: 4, tps: 6.00, reads: 83.96, writes: 23.99, response t
[ 21259s] threads: 4, tps: 7.00, reads: 98.05, writes: 28.01, response t
[ 31250s] threads: 4, tps: 8.00, reads: 111.95, writes: 31.99, response t
[ 31251s] threads: 4, tps: 11.00, reads: 154.01, writes: 44.00, response t
[ 31252s] threads: 4, tps: 11.00, reads: 153.94, writes: 43.98, response t
[ 31253s] threads: 4, tps: 10.01, reads: 140.07, writes: 40.02, response t
^C
[mysql1 ~]# run_app.sh mysql3
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
76 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 77/230
LAB6: Migrate the application
Make sure gtid_executed range on mysql2 is lower or equal than on mysql3
mysql[2-3]> SHOW GLOBAL VARIABLES LIKE 'gtid_executed'G
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
77 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 78/230
LAB6: Migrate the application
Make sure gtid_executed range on mysql2 is lower or equal than on mysql3
mysql[2-3]> SHOW GLOBAL VARIABLES LIKE 'gtid_executed'G
When they are OK, stop asynchronous replication on mysql2 and mysql3:
mysql2> STOP SLAVE;
mysql3> STOP SLAVE;
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
78 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 79/230
LAB6: Migrate the application
Make sure gtid_executed range on mysql2 is lower or equal than on mysql3
mysql[2-3]> SHOW GLOBAL VARIABLES LIKE 'gtid_executed'G
When they are OK, stop asynchronous replication on mysql2 and mysql3:
mysql2> STOP SLAVE;
mysql3> STOP SLAVE;
Now they can forget about mysql1:
mysql[2-3]> RESET SLAVE ALL FOR CHANNEL '';
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
79 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 80/230
previous slave (mysql2) can now be part of the
cluster
Add a third instance
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
80 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 81/230
LAB7: Add mysql2 to the group
We first upgrade to MySQL 8.0.16 :
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
81 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 82/230
LAB7: Add mysql2 to the group
We first upgrade to MySQL 8.0.16 :
[mysql2 ~]# systemctl stop mysqld
[mysql2 ~]# rpm -Uvh /root/rpms/*rpm --force
[mysql2 ~]# systemctl start mysqld
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
82 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 83/230
LAB7: Add mysql2 to the group
We first upgrade to MySQL 8.0.16 :
[mysql2 ~]# systemctl stop mysqld
[mysql2 ~]# rpm -Uvh /root/rpms/*rpm --force
[mysql2 ~]# systemctl start mysqld
 
No need to run mysql_updgrade as we are using MySQL 8.0.16 ! 😁
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
83 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 84/230
LAB7: Add mysql2 to the group (2)
mysql-js> dba.con gureInstance('clusteradmin@mysql2')
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
84 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 85/230
LAB7: Add mysql2 to the group (2)
mysql-js> dba.con gureInstance('clusteradmin@mysql2')
In case you don´t have the cluster object in your shell anymore, you can still retrieve it:
mysql-js> c clusteradmin@mysql3
mysql-js> cluster = dba.getCluster()
Add mysql2 to the cluster:
mysql-js> cluster.checkInstanceState('clusteradmin@mysql2')
mysql-js> cluster.addInstance("clusteradmin@mysql2")
mysql-js> cluster.status()
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
85 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 86/230
LAB7: Add mysql2 to the group (3)
{
"clusterName": "perconalive",
"defaultReplicaSet": {
"name": "default",
"primary": "mysql3:3306",
"ssl": "REQUIRED",
"status": "OK",
"statusText": "Cluster is ONLINE and can tolerate up to ONE failure.",
"topology": {
"mysql2:3306": {
"address": "mysql2:3306",
"mode": "R/O",
"readReplicas": {},
"role": "HA",
"status": "ONLINE"
},
"mysql3:3306": {
"address": "mysql3:3306",
"mode": "R/W",
"readReplicas": {},
"role": "HA",
"status": "ONLINE"
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
86 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 87/230
get more info
Monitoring
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
87 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 88/230
Performance Schema
Group Replication uses Performance_Schema to expose status
mysql3> SELECT * FROM performance_schema.replication_group_membersG
*************************** 1. row ***************************
CHANNEL_NAME: group_replication_applier
MEMBER_ID: ade14d5c-9e1e-11e7-b034-08002718d305
MEMBER_HOST: mysql4
MEMBER_PORT: 3306
MEMBER_STATE: ONLINE
MEMBER_ROLE: SECONDARY
MEMBER_VERSION: 8.0.16
*************************** 2. row ***************************
CHANNEL_NAME: group_replication_applier
MEMBER_ID: b9d01593-9dfb-11e7-8ca6-08002718d305
MEMBER_HOST: mysql3
MEMBER_PORT: 3306
MEMBER_STATE: ONLINE
MEMBER_ROLE: PRIMARY
MEMBER_VERSION: 8.0.16
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
88 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 89/230
mysql3> SELECT * FROM performance_schema.replication_connection_statusG
*************************** 1. row ***************************
CHANNEL_NAME: group_replication_applier
GROUP_NAME: 8fc848d7-9e1c-11e7-9407...
SOURCE_UUID: 8fc848d7-9e1c-11e7-9407...
THREAD_ID: NULL
SERVICE_STATE: ON
COUNT_RECEIVED_HEARTBEATS: 0
LAST_HEARTBEAT_TIMESTAMP: 0000-00-00 00:00:00
RECEIVED_TRANSACTION_SET: 8fc848d7-9e1c-11e7-9407...
b9d01593-9dfb-11e7-8ca6-08002718d305:1-21,
da2f0910-8767-11e6-b82d-08002718d305:1-164741
LAST_ERROR_NUMBER: 0
LAST_ERROR_MESSAGE:
LAST_ERROR_TIMESTAMP: 0000-00-00 00:00:00
LAST_QUEUED_TRANSACTION: 8fc848d7-9e1c-11e7-9407...
LAST_QUEUED_TRANSACTION_ORIGINAL_COMMIT_TIMESTAMP: 0000-00-00 00:00:00
LAST_QUEUED_TRANSACTION_IMMEDIATE_COMMIT_TIMESTAMP: 0000-00-00 00:00:00
LAST_QUEUED_TRANSACTION_START_QUEUE_TIMESTAMP: 2017-09-20 16:22:36.486...
LAST_QUEUED_TRANSACTION_END_QUEUE_TIMESTAMP: 2017-09-20 16:22:36.486...
QUEUEING_TRANSACTION:
QUEUEING_TRANSACTION_ORIGINAL_COMMIT_TIMESTAMP: 0000-00-00 00:00:00
QUEUEING_TRANSACTION_IMMEDIATE_COMMIT_TIMESTAMP: 0000-00-00 00:00:00
QUEUEING_TRANSACTION_START_QUEUE_TIMESTAMP: 0000-00-00 00:00:00
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
89 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 90/230
Member State
These 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 stop
UNREACHABLE
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
90 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 91/230
Status information & metrics
Members
mysql> select member_host, member_state, member_role,
member_version
from performance_schema.replication_group_members;
+-------------+--------------+-------------+----------------+
| member_host | member_state | member_role | member_version |
+-------------+--------------+-------------+----------------+
| mysql3 | ONLINE | PRIMARY | 8.0.16 |
| mysql4 | ONLINE | SECONDARY | 8.0.16 |
| mysql2 | ONLINE | SECONDARY | 8.0.16 |
+-------------+--------------+-------------+----------------+
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
91 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 92/230
Status information & metrics - connections
To see group_replication_applier and group_replication_recovery:
mysql> SELECT * FROM performance_schema.replication_connection_statusG
8.0
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
92 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 93/230
Status information & metrics
Previously there were only local node statistics, now they are exposed all over the Group
mysql> select * from performance_schema.replication_group_member_statsG
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
93 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 94/230
Status information & metrics
Previously there were only local node statistics, now they are exposed all over the Group
mysql> select * from performance_schema.replication_group_member_statsG
*************************** 1. row ***************************
CHANNEL_NAME: group_replication_applier
VIEW_ID: 15059231192196925:2
MEMBER_ID: ade14d5c-9e1e-11e7-b034-08002...
COUNT_TRANSACTIONS_IN_QUEUE: 0
COUNT_TRANSACTIONS_CHECKED: 27992
COUNT_CONFLICTS_DETECTED: 0
COUNT_TRANSACTIONS_ROWS_VALIDATING: 0
TRANSACTIONS_COMMITTED_ALL_MEMBERS: 8fc848d7-9e1c-11e7-9407-08002...
b9d01593-9dfb-11e7-8ca6-08002718d305:1-21,
da2f0910-8767-11e6-b82d-08002718d305:1-164741
LAST_CONFLICT_FREE_TRANSACTION: 8fc848d7-9e1c-11e7-9407-08002...
COUNT_TRANSACTIONS_REMOTE_IN_APPLIER_QUEUE: 0
COUNT_TRANSACTIONS_REMOTE_APPLIED: 27992
COUNT_TRANSACTIONS_LOCAL_PROPOSED: 0
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
94 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 95/230
*************************** 2. row ***************************
CHANNEL_NAME: group_replication_applier
VIEW_ID: 15059231192196925:2
MEMBER_ID: b9d01593-9dfb-11e7-8ca6-08002...
COUNT_TRANSACTIONS_IN_QUEUE: 0
COUNT_TRANSACTIONS_CHECKED: 28000
COUNT_CONFLICTS_DETECTED: 0
COUNT_TRANSACTIONS_ROWS_VALIDATING: 0
TRANSACTIONS_COMMITTED_ALL_MEMBERS: 8fc848d7-9e1c-11e7-9407-08002...
b9d01593-9dfb-11e7-8ca6-08002718d305:1-21,
da2f0910-8767-11e6-b82d-08002718d305:1-164741
LAST_CONFLICT_FREE_TRANSACTION: 8fc848d7-9e1c-11e7-9407-08002...
COUNT_TRANSACTIONS_REMOTE_IN_APPLIER_QUEUE: 0
COUNT_TRANSACTIONS_REMOTE_APPLIED: 1
COUNT_TRANSACTIONS_LOCAL_PROPOSED: 28000
COUNT_TRANSACTIONS_LOCAL_ROLLBACK: 0
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
95 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 96/230
Performance_Schema
You 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 @ 2019 Oracle and/or its affiliates. All rights reserved.
96 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 97/230
Get the info from the MySQL Shell
It´s also possible to get more info using the Shell:
mysql-js> cluster.status({extended: true})
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
97 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 98/230
Get the info from the MySQL Shell
It´s also possible to get more info using the Shell:
mysql-js> cluster.status({extended: true})
In the next release you will also be able to see info from each members:
mysql-js> cluster.status({queryMembers: true})
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
98 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 99/230
Status during recovery
mysql> SHOW SLAVE STATUS FOR CHANNEL 'group_replication_recovery'G
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
99 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 100/230
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 @ 2019 Oracle and/or its affiliates. All rights reserved.
100 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 101/230
Sys Schema
The easiest way to detect if a node is a member of the primary component (when there are partitioning of your nodes due to
network issues for example) and therefore a valid candidate for routing queries to it, is to use the sys table.
Additional information for sys can be found at https://goo.gl/XFp3bt
On the primary node:
[mysql3 ~]# mysql < /root/addition_to_sys_8.0.2.sql
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
101 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 102/230
Sys Schema
Is this node part of PRIMARY Partition:
mysql3> SELECT sys.gr_member_in_primary_partition();
+------------------------------------+
| sys.gr_node_in_primary_partition() |
+------------------------------------+
| YES |
+------------------------------------+
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
102 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 103/230
Sys Schema
Is 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 @ 2019 Oracle and/or its affiliates. All rights reserved.
103 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 104/230
LAB8: Sys Schema - Health Check
On one of the non Primary nodes, run the following command:
mysql-sql> ush tables with read lock;
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
104 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 105/230
LAB8: Sys Schema - Health Check
On 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 @ 2019 Oracle and/or its affiliates. All rights reserved.
105 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 106/230
LAB8: Sys Schema - Health Check
On 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 @ 2019 Oracle and/or its affiliates. All rights reserved.
106 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 107/230
LAB9: Reporting in MySQL Shell 8.0.16
Since 8.0.16, it´s possible in MySQL Shell to create User Defined Reports.
We will create a report to monitor the asynchronous replication used in the recovery channel and see the progress of it.
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
107 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 108/230
LAB9: Reporting in MySQL Shell 8.0.16
Since 8.0.16, it´s possible in MySQL Shell to create User Defined Reports.
We will create a report to monitor the asynchronous replication used in the recovery channel and see the progress of it.
Let´s start by stopping group replication on mysql2:
mysql2> stop group_replication;
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
108 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 109/230
LAB9: Reporting in MySQL Shell 8.0.16 (2)
Now it´s time to create the folder where the User Defined Reports can be installed:
# mkdir ~/.mysqlsh/init.d
# cd ~/.mysqlsh/init.d
And we can download the report:
wget https://tinyurl.com/gr-recovery -O gr_recovery_progress.py
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
109 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 110/230
LAB9: Reporting in MySQL Shell 8.0.16 (2)
Now it´s time to create the folder where the User Defined Reports can be installed:
# mkdir ~/.mysqlsh/init.d
# cd ~/.mysqlsh/init.d
And we can download the report:
wget https://tinyurl.com/gr-recovery -O gr_recovery_progress.py
mysqlsh clusteradmin@mysql2
mysql-js> show
Available reports: gr_recovery_progress, query.
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
110 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 111/230
LAB9: Reporting in MySQL Shell 8.0.16 (3)
Now we can put back mysql2 in the group and use the new report query:
mysql-js> sql start group_replication
mysql-js> show gr_recovery_progress
+----------------+
| trx_to_recover |
+----------------+
| 8673 |
+----------------+
You can also try watch gr_recovery_progress
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
111 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 112/230
Connecting to the cluster
MySQL Router
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
112 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 113/230
MySQL Router
MySQL Router is lightweight middleware that provides transparent routing between your application and backend MySQL Servers.
It can be used for a wide variety of use cases, such as providing high availability and scalability by effectively routing database
traffic to appropriate backend MySQL Servers.
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
113 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 114/230
MySQL Router
MySQL Router is lightweight middleware that provides transparent routing between your application and backend MySQL Servers.
It can be used for a wide variety of use cases, such as providing high availability and scalability by effectively routing database
traffic to appropriate backend MySQL Servers.
MySQL Router doesn´t require any specific configuration. It configures itself automatically (bootstrap) using MySQL InnoDB Cluster
´s metadata.
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
114 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 115/230
LAB10: MySQL Router
We will now use mysqlrouter between our application and the cluster.
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
115 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 116/230
LAB10: MySQL Router (2)
Configure MySQL Router that will run on the app server (mysql1). We bootstrap it using the Primary-Master:
[root@mysql1 ˜]# mysqlrouter --bootstrap clusteradmin@mysql3:3306 
--user mysqlrouter
Please enter MySQL password for clusteradmin:
Bootstrapping system MySQL Router instance...
Checking for old Router accounts
Creating account mysql_router1_rvbecwmlc6uf@'%'
MySQL Router has now been con gured for the InnoDB cluster 'perconalive'.
The following connection information can be used to connect to the cluster
after MySQL Router has been started with generated con guration..
Classic MySQL protocol connections to cluster 'perconalive':
- Read/Write Connections: localhost:6446
- Read/Only Connections: localhost:6447
X protocol connections to cluster 'perconalive':
- Read/Write Connections: localhost:64460
- Read/Only Connections: localhost:64470
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
116 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 117/230
LAB10: MySQL Router (3)
Now let´s modify the configuration file to listen on port 3306:
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
117 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 118/230
LAB10: MySQL Router (3)
Now let´s modify the configuration file to listen on port 3306:
in /etc/mysqlrouter/mysqlrouter.conf:
[routing:perconalive_default_rw]
-bind_port=6446
+bind_port=3306
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
118 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 119/230
LAB10: MySQL Router (3)
Now let´s modify the configuration file to listen on port 3306:
in /etc/mysqlrouter/mysqlrouter.conf:
[routing:perconalive_default_rw]
-bind_port=6446
+bind_port=3306
We can stop mysqld on mysql1 and start mysqlrouter:
[mysql1 ~]# systemctl stop mysqld
[mysql1 ~]# systemctl start mysqlrouter
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
119 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 120/230
LAB10: MySQL Router (5)
Now we can point the application to the router (back to mysql1):
[mysql1 ~]# run_app.sh
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
120 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 121/230
LAB10: MySQL Router (5)
Now we can point the application to the router (back to mysql1):
[mysql1 ~]# run_app.sh
Check app and kill mysqld on mysql3 (the Primary Master R/W node) !
[mysql3 ~]# failure-scenario.sh kill-node
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
121 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 122/230
LAB10: MySQL Router (5)
Now we can point the application to the router (back to mysql1):
[mysql1 ~]# run_app.sh
Check app and kill mysqld on mysql3 (the Primary Master R/W node) !
[mysql3 ~]# failure-scenario.sh kill-node
mysql2> select member_host as `primary`
from performance_schema.replication_group_members
where member_role='PRIMARY';
+----------+
| primary |
+----------+
| mysql4 |
+----------+
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
122 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 123/230
ProxySQL / HA Proxy / F5 / ...
3rd party router/proxy
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
123 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 124/230
3rd party router/proxy
MySQL InnoDB Cluster can also work with third party router / proxy.
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
124 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 125/230
3rd party router/proxy
MySQL InnoDB Cluster can also work with third party router / proxy.
If you need some specific features that are not yet available in MySQL Router, like transparent R/W splitting, then you can use your
software of choice.
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
125 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 126/230
3rd party router/proxy
MySQL InnoDB Cluster can also work with third party router / proxy.
If you need some specific features that are not yet available in MySQL Router, like transparent R/W splitting, then you can use your
software of choice.
The important part of such implementation is to use a good health check to verify if the MySQL server you plan to route the traffic
is in a valid state.
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
126 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 127/230
3rd party router/proxy
MySQL InnoDB Cluster can also work with third party router / proxy.
If you need some specific features that are not yet available in MySQL Router, like transparent R/W splitting, then you can use your
software of choice.
The important part of such implementation is to use a good health check to verify if the MySQL server you plan to route the traffic
is in a valid state.
MySQL Router implements that natively, and it´s very easy to deploy.
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
127 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 128/230
ProxySQL also has native support for Group Replication which
makes it maybe the best choice for advanced users.
3rd party router/proxy
MySQL InnoDB Cluster can also work with third party router / proxy.
If you need some specific features that are not yet available in MySQL Router, like transparent R/W splitting, then you can use your
software of choice.
The important part of such implementation is to use a good health check to verify if the MySQL server you plan to route the traffic
is in a valid state.
MySQL Router implements that natively, and it´s very easy to deploy.
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
128 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 129/230
operational tasks
Recovering Node
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
129 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 130/230
Recovering Nodes/Members
The old master (mysql3) got killed.
Start it again:
mysql3# systemctl start mysqld
The node will automatically join the group again
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
130 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 131/230
You know... There are ways...
Various Configuration Options
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
131 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 132/230
Various Configuration Options
Single & Multiple Primary Mode
Network Partitions
What to do?
when will a node leave?
when will a node be expelled?
what should a node do when it´s gone?
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
132 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 133/230
Default = Single Primary Mode
By default, MySQL InnoDB Cluster enables Single Primary Mode.
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
133 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 134/230
Default = Single Primary Mode
By 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 @ 2019 Oracle and/or its affiliates. All rights reserved.
134 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 135/230
Default = Single Primary Mode
By 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 the rest of the members act as hot-
standbys (SECONDARY).
The group itself coordinates and configures itself automatically to determine which member will act as the PRIMARY, through a
leader election mechanism.
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
135 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 136/230
Who´s the Primary Master ?
You can already see it in the output of cluster.status()
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
136 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 137/230
Who´s the Primary Master ?
You can already see it in the output of cluster.status()
But you can also check in performance_schema:
mysql> select member_host
from performance_schema.replication_group_members
where member_role='PRIMARY';
+-------------+
| member_host |
+-------------+
| mysql3 |
+-------------+
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
137 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 138/230
Create a Multi-Primary Cluster:
It´s also possible to create a Multi-Primary Cluster using the Shell:
mysql-js> cluster=dba.createCluster('perconalive',{multiMaster: true})
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
138 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 139/230
Create a Multi-Primary Cluster:
It´s also possible to create a Multi-Primary Cluster using the Shell:
mysql-js> cluster=dba.createCluster('perconalive',{multiMaster: true})
A new InnoDB cluster will be created on instance 'clusteradmin@mysql3:3306'.
The MySQL InnoDB cluster is going to be setup in advanced Multi-Master Mode.
Before continuing you have to con rm that you understand the requirements and
limitations of Multi-Master Mode. Please read the manual before proceeding.
I have read the MySQL InnoDB cluster manual and I understand the requirements
and limitations of advanced Multi-Master Mode.
Con rm [y|N]:
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
139 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 140/230
Create a Multi-Primary Cluster:
It´s also possible to create a Multi-Primary Cluster using the Shell:
mysql-js> cluster=dba.createCluster('perconalive',{multiMaster: true})
A new InnoDB cluster will be created on instance 'clusteradmin@mysql3:3306'.
The MySQL InnoDB cluster is going to be setup in advanced Multi-Master Mode.
Before continuing you have to con rm that you understand the requirements and
limitations of Multi-Master Mode. Please read the manual before proceeding.
I have read the MySQL InnoDB cluster manual and I understand the requirements
and limitations of advanced Multi-Master Mode.
Con rm [y|N]:
Or you can force it to avoid interaction (for automation) :
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
140 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 141/230
Create a Multi-Primary Cluster:
It´s also possible to create a Multi-Primary Cluster using the Shell:
mysql-js> cluster=dba.createCluster('perconalive',{multiMaster: true})
A new InnoDB cluster will be created on instance 'clusteradmin@mysql3:3306'.
The MySQL InnoDB cluster is going to be setup in advanced Multi-Master Mode.
Before continuing you have to con rm that you understand the requirements and
limitations of Multi-Master Mode. Please read the manual before proceeding.
I have read the MySQL InnoDB cluster manual and I understand the requirements
and limitations of advanced Multi-Master Mode.
Con rm [y|N]:
Or you can force it to avoid interaction (for automation) :
> cluster=dba.createCluster('perconalive',{multiMaster: true, force: true})
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
141 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 142/230
Dynamically change to Multi Primary Mode (UDFs)
Change to/from single primary mode online:
mysql3> SELECT group_replication_switch_to_multi_primary_mode();
mysql3> SELECT group_replication_switch_to_single_primary_mode();
Choose primary node
mysql3> SELECT group_replication_set_as_primary(server_uuid);
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
142 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 143/230
Dynamically change to Multi Primary Mode (UDFs)
mysql3> SELECT group_replication_switch_to_multi_primary_mode();
+--------------------------------------------------+
| group_replication_switch_to_multi_primary_mode() |
+--------------------------------------------------+
| Mode switched to multi-primary successfully. |
+--------------------------------------------------+
mysql3> select member_host
from performance_schema.replication_group_members
where member_role='PRIMARY';
+-------------+
| member_host |
+-------------+
| mysql2 |
| mysql3 |
| mysql4 |
+-------------+
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
143 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 144/230
Dynamically change Mode: UDFs VS Metadata
However, this should be done from the MySQL Shell to avoid metadata inconsistencies.
Try to get the cluster status:
JS> cluster.status()
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
144 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 145/230
Dynamically change Mode: UDFs VS Metadata
However, this should be done from the MySQL Shell to avoid metadata inconsistencies.
Try to get the cluster status:
JS> cluster.status()
What do you see ?
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
145 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 146/230
Dynamically change Mode: UDFs VS Metadata
However, this should be done from the MySQL Shell to avoid metadata inconsistencies.
Try to get the cluster status:
JS> cluster.status()
What do you see ?
Fix it:
JS> cluster.rescan()
JS> cluster.status()
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
146 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 147/230
Dynamically change to Single Primary Mode - Shell
Switch back to Single Primary Mode:
JS> cluster.switchToSinglePrimaryMode()
JS> cluster.status()
Other MySQL Shell syntax:
(do not execute !)
JS> cluster.setPrimaryInstance('mysql1:3306')
JS> cluster.switchToMultiPrimaryMode()
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
147 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 148/230
Network Partitions
What happens when mysql4 is being network partitioned?
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
148 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 149/230
Network Partitions - Quorum Calculations
3 notes, each 1 vote.
Majority is when a partition sees +50%
Minority is when a partition sees <=50%
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
149 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 150/230
Network Partitions - Quorum Calculations
3 notes, each 1 vote.
Majority is when a partition sees +50%
Minority is when a partition sees <=50%
mysql2 and mysql3 can still connect to eachother, 2 votes out of 3
= 66% = MAJORITY
mysql4 can only see itself, 1 vote out of 3
= 33% = MINORITY
Majority network partition is mysql2 and mysql3
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
150 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 151/230
Network Partitions - Quorum Calculations
With even amount of nodes:
it is possible to have 50% for each partition
both will have minority
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
151 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 152/230
Network Partitions - Actions by Majority
mysql2 and mysql3 actions:
1. wait 5 seconds, then suspect mysql4 is gone
2. expel mysql4 after group_replication_member_expel_timeout seconds (default 0, immediately)
do not put the variable too high, between suspect and expel
members cannot be added/removed
no new leader can be elected
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
152 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 153/230
Network Partitions - Actions by Minority
mysql4 actions:
1. wait 5 seconds before suspecting itself to lost connection to the majority
2. wait group_replication_unreachable_majority_timeout
(default 0, forever)
3. when timeout: group_replication_autorejoin_tries
(default 0 times)
retries every 5 minutes
4. Only then group_replication_exit_state_action
READ_ONLY: allow stale reads to be served (latest default)
ABORT_SERVER: Shutdown MySQL
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
153 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 154/230
LAB11: Network Partitions - Default
Let´s network partition mysql4!
Check logs (we have log_error_verbosity=3)
mysql3# tail -f /var/log/mysqld.log &
mysql4# tail -f /var/log/mysqld.log &
On mysql4, run:
mysql4# failure-scenario.sh network-partition begin
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
154 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 155/230
LAB11: Network Partitions - Default
mysql3
'[GCS] Installed site start={ed88d526 1339 0} boot_key={ed88d526 1328 0}
event_horizon=10 node 1'
'[GCS] Group is able to support up to communication protocol version 8.0.16'
'Members removed from the group: mysql4:3306'
'Group membership changed to mysql3:3306, mysql2:3306 on view 1557809996177
'[GCS] Failure reading from fd=-1 n=18446744073709551615'
mysql4
'Member with address mysql2:3306 has become unreachable.'
'Member with address mysql3:3306 has become unreachable.'
'This server is not able to reach a majority of members in the group.
This server will now block all updates. The server will remain blocked
until contact with the majority is restored. It is possible to use
group_replication_force_members to force a new group membership.'
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
155 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 156/230
LAB11: Network Partition - Default
mysql4# failure-scenario.sh network-partition end
Does the node come back?
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
156 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 157/230
LAB11: Network Partition - Default
mysql4# failure-scenario.sh network-partition end
Does the node come back?
NO: it was expelled:
'Member with address mysql2:3306 is reachable again.'
'Member with address mysql3:3306 is reachable again.'
'The member has resumed contact with a majority of the members in the group.
Regular operation is restored and transactions are unblocked.'
'[GCS] Re-using server node 0 host mysql2'
'[GCS] Re-using server node 1 host mysql3'
'[GCS] Installed site start={ed88d526 1339 0} boot_key={ed88d526 1328 0}
event_horizon=10 node 4294967295'
'[GCS] Node has already been removed: mysql4:33061 15578108329721490.'
'Member was expelled from the group due to network failures,
changing member status to ERROR.'
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
157 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 158/230
LAB11: Network Partition - Default
Fix with shell:
JS>cluster.rejoinInstance('clusteradmin@mysql4')
Rejoining the instance to the InnoDB cluster. Depending on the original
problem that made the instance unavailable, the rejoin operation might not be
successful and further manual steps will be needed to x the underlying
problem.
Please monitor the output of the rejoin operation and take necessary action if
the instance cannot rejoin.
Rejoining instance to the cluster ...
The instance 'mysql4' was successfully rejoined on the cluster.
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
158 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 159/230
LAB12: Network Partitions - With Retries
Let´s try again, but let´s configure retries:
mysql4> SET GLOBAL group_replication_autorejoin_tries=2; # default is 0
mysql4# failure-scenario.sh network-partition begin && sleep 10 && 
failure-scenario.sh network-partition end
Did mysql4 join the group again?
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
159 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 160/230
LAB12: Network Partitions - With Retries
Did mysql4 join the group again? YES!
'Member with address mysql2:3306 is reachable again.'
'The member has resumed contact with a majority of the members in the group.
Regular operation is restored and transactions are unblocked.'
'Member with address mysql3:3306 is reachable again.'
'[GCS] Re-using server node 0 host mysql2'
'[GCS] Re-using server node 1 host mysql3'
'[GCS] Installed site start={ed88d526 2445 0} boot_key={ed88d526 2434 0}
event_horizon=10 node 4294967295'
'[GCS] Node has already been removed: mysql4:33061 15578118987619030.'
'Member was expelled from the group due to network failures,
changing member status to ERROR.'
'Started auto-rejoin procedure attempt 1 of 2'
...
'This server was declared online within the replication group.'
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
160 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 161/230
LAB12: Network Partitions - monitoring auto-rejoin
It´s possible to verify if there is an auto-rejoin:
SELECT COUNT(*) FROM performance_schema.events_stages_current WHERE EVENT_NAME LIKE '%auto-rejoin%';
View the amount of retries so far:
SELECT WORK_COMPLETED FROM performance_schema.events_stages_current WHERE EVENT_NAME LIKE '%auto-rejoin%';
Estimated time remaining until next retry:
SELECT (300.0 - ((TIMER_WAIT*10e-12) - 300.0 * num_retries)) AS time_remaining FROM
(SELECT COUNT(*) - 1 AS num_retries FROM
performance_schema.events_stages_current WHERE EVENT_NAME LIKE '%auto-rejoin%') AS T,
performance_schema.events_stages_current WHERE EVENT_NAME LIKE '%auto-rejoin%';
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
161 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 162/230
be aware of the behavior change & take control
Application Behavior & Consistency Guarantees
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
162 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 163/230
Application Behavior & Consistency Guarantees
Group Conflicts
Configurable Consistency Guarantees
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
163 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 164/230
Group Conflicts
Local vs. Group:
Local Conflicts are handled using InnoDB's row locking.
Conflicts between different nodes are handled with "first committer wins!"
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
164 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 165/230
Group Conflicts
Local vs. Group:
Local Conflicts are handled using InnoDB's row locking.
Conflicts between different nodes are handled with "first committer wins!"
Group Conflicts:
happen only in Multi-Primary Mode
happen if 2 transactions are updating/deleting the same records on two different members of the group,
will be detected only during group certification (after at least one has committed) (Optimistic Locking)
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
165 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 166/230
LAB13: Group Conflicts
Let´s see this in action !
First switch to Multi-Primary Mode:
mysql-js> cluster.switchToMultiPrimaryMode()
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
166 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 167/230
LAB13: Group Conflicts
Let´s see this in action !
First switch to Multi-Primary Mode:
mysql-js> cluster.switchToMultiPrimaryMode()
Now on mysql2 start the following transaction:
mysql2> start transaction;
mysql2> update app.sbtest1 set k=k+50000 where id = 2000;
Note that we don't commit the transaction yet
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
167 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 168/230
LAB13: Group Conflicts (2)
Now on mysql4 we also create a new transaction:
mysql4> start transaction;
mysql4> update app.sbtest1 set k=k+200 where id > 1999 and id < 2010;
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
168 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 169/230
LAB13: Group Conflicts (2)
Now on mysql4 we also create a new transaction:
mysql4> start transaction;
mysql4> update app.sbtest1 set k=k+200 where id > 1999 and id < 2010;
Now commit the one in mysql4:
mysql4> commit;
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
169 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 170/230
LAB13: Group Conflicts (3)
What do you see on mysql2 ´s session ?
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
170 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 171/230
LAB13: Group Conflicts (3)
What do you see on mysql2 ´s session ?
If you try any statement you will see:
ERROR: 1213: Deadlock found when trying to get lock; try restarting transaction
If you try to commit you will see:
ERROR: 1180: Got error 149 - 'Lock deadlock; Retry transaction' during COMMIT
This happens because a conflict was detected during certification !
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
171 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 172/230
Group Conflicts (4)
2 types of Group Conflicts:
Conflicts detected by InnoDB high priority transactions (previous lab)
Conflicts detected by Group Replication:
Commit 2 transactions at almost the same time:
ERROR 3101 (40000): Plugin instructed the server
to rollback the current transaction.
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
172 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 173/230
Group Conflicts (5)
Check these in Performance_Schema (or using cluster.status({extended: true}):
SELECT MEMBER_ID,COUNT_CONFLICTS_DETECTED,COUNT_TRANSACTIONS_LOCAL_ROLLBACK
FROM performance_schema.replication_group_member_statsG
*************************** 1. row ***************************
MEMBER_ID: 130942a7-75c4-11e9-b75d-08002718d305
COUNT_CONFLICTS_DETECTED: 1
COUNT_TRANSACTIONS_LOCAL_ROLLBACK: 0
*************************** 2. row ***************************
MEMBER_ID: 265d96f7-7333-11e9-b4c9-08002718d305
COUNT_CONFLICTS_DETECTED: 1
COUNT_TRANSACTIONS_LOCAL_ROLLBACK: 1
*************************** 3. row ***************************
MEMBER_ID: 6361b4e3-75c2-11e9-851b-08002718d305
COUNT_CONFLICTS_DETECTED: 1
COUNT_TRANSACTIONS_LOCAL_ROLLBACK: 0
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
173 / 230
5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial
file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 174/230
Configurable Consistency Guarantees
Default consistency guarantee is EVENTUAL
if you write some data on nodeA,
if you immediately read it on nodeB,
it might be there... or not yet.
Since MySQL 8.0.14, you can configure various transaction consistency guarantees
mysql> show variables like 'group_replication_consistency';
+-------------------------------+----------+
| Variable_name | Value |
+-------------------------------+----------+
| group_replication_consistency | EVENTUAL |
+-------------------------------+----------+
Copyright @ 2019 Oracle and/or its affiliates. All rights reserved.
174 / 230
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial
MySQL InnoDB Cluster and Group Replication in a Nutshell:  hands-on tutorial

More Related Content

What's hot

MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11Kenny Gryp
 
Optimizing MariaDB for maximum performance
Optimizing MariaDB for maximum performanceOptimizing MariaDB for maximum performance
Optimizing MariaDB for maximum performanceMariaDB plc
 
MySQL InnoDB Cluster - A complete High Availability solution for MySQL
MySQL InnoDB Cluster - A complete High Availability solution for MySQLMySQL InnoDB Cluster - A complete High Availability solution for MySQL
MySQL InnoDB Cluster - A complete High Availability solution for MySQLOlivier DASINI
 
Wars of MySQL Cluster ( InnoDB Cluster VS Galera )
Wars of MySQL Cluster ( InnoDB Cluster VS Galera ) Wars of MySQL Cluster ( InnoDB Cluster VS Galera )
Wars of MySQL Cluster ( InnoDB Cluster VS Galera ) Mydbops
 
Always on 可用性グループ 構築時のポイント
Always on 可用性グループ 構築時のポイントAlways on 可用性グループ 構築時のポイント
Always on 可用性グループ 構築時のポイントMasayuki Ozawa
 
MySQL Database Architectures - 2020-10
MySQL Database Architectures -  2020-10MySQL Database Architectures -  2020-10
MySQL Database Architectures - 2020-10Kenny Gryp
 
Highly efficient backups with percona xtrabackup
Highly efficient backups with percona xtrabackupHighly efficient backups with percona xtrabackup
Highly efficient backups with percona xtrabackupNilnandan Joshi
 
MySQL Day Roma - MySQL Shell and Visual Studio Code Extension
MySQL Day Roma - MySQL Shell and Visual Studio Code ExtensionMySQL Day Roma - MySQL Shell and Visual Studio Code Extension
MySQL Day Roma - MySQL Shell and Visual Studio Code ExtensionFrederic Descamps
 
MySQL Parallel Replication: All the 5.7 and 8.0 Details (LOGICAL_CLOCK)
MySQL Parallel Replication: All the 5.7 and 8.0 Details (LOGICAL_CLOCK)MySQL Parallel Replication: All the 5.7 and 8.0 Details (LOGICAL_CLOCK)
MySQL Parallel Replication: All the 5.7 and 8.0 Details (LOGICAL_CLOCK)Jean-François Gagné
 
Introduction to MySQL InnoDB Cluster
Introduction to MySQL InnoDB ClusterIntroduction to MySQL InnoDB Cluster
Introduction to MySQL InnoDB ClusterFrederic Descamps
 
Galera cluster for high availability
Galera cluster for high availability Galera cluster for high availability
Galera cluster for high availability Mydbops
 
Differences between MariaDB 10.3 & MySQL 8.0
Differences between MariaDB 10.3 & MySQL 8.0Differences between MariaDB 10.3 & MySQL 8.0
Differences between MariaDB 10.3 & MySQL 8.0Colin Charles
 
MySQL InnoDB Cluster: Management and Troubleshooting with MySQL Shell
MySQL InnoDB Cluster: Management and Troubleshooting with MySQL ShellMySQL InnoDB Cluster: Management and Troubleshooting with MySQL Shell
MySQL InnoDB Cluster: Management and Troubleshooting with MySQL ShellMiguel Araújo
 
MySQL InnoDB Cluster - Group Replication
MySQL InnoDB Cluster - Group ReplicationMySQL InnoDB Cluster - Group Replication
MySQL InnoDB Cluster - Group ReplicationFrederic Descamps
 
Intro ProxySQL
Intro ProxySQLIntro ProxySQL
Intro ProxySQLI Goo Lee
 
MySQL Database Architectures - High Availability and Disaster Recovery Solution
MySQL Database Architectures - High Availability and Disaster Recovery SolutionMySQL Database Architectures - High Availability and Disaster Recovery Solution
MySQL Database Architectures - High Availability and Disaster Recovery SolutionMiguel Araújo
 
Disaster Recovery with MySQL InnoDB ClusterSet - What is it and how do I use it?
Disaster Recovery with MySQL InnoDB ClusterSet - What is it and how do I use it?Disaster Recovery with MySQL InnoDB ClusterSet - What is it and how do I use it?
Disaster Recovery with MySQL InnoDB ClusterSet - What is it and how do I use it?Miguel Araújo
 
Best practices for MySQL High Availability
Best practices for MySQL High AvailabilityBest practices for MySQL High Availability
Best practices for MySQL High AvailabilityColin Charles
 
HA環境構築のベスト・プラクティス
HA環境構築のベスト・プラクティスHA環境構築のベスト・プラクティス
HA環境構築のベスト・プラクティスEnterpriseDB
 
OpenStack Ironic - Bare Metal-as-a-Service
OpenStack Ironic - Bare Metal-as-a-ServiceOpenStack Ironic - Bare Metal-as-a-Service
OpenStack Ironic - Bare Metal-as-a-ServiceRamon Acedo Rodriguez
 

What's hot (20)

MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
 
Optimizing MariaDB for maximum performance
Optimizing MariaDB for maximum performanceOptimizing MariaDB for maximum performance
Optimizing MariaDB for maximum performance
 
MySQL InnoDB Cluster - A complete High Availability solution for MySQL
MySQL InnoDB Cluster - A complete High Availability solution for MySQLMySQL InnoDB Cluster - A complete High Availability solution for MySQL
MySQL InnoDB Cluster - A complete High Availability solution for MySQL
 
Wars of MySQL Cluster ( InnoDB Cluster VS Galera )
Wars of MySQL Cluster ( InnoDB Cluster VS Galera ) Wars of MySQL Cluster ( InnoDB Cluster VS Galera )
Wars of MySQL Cluster ( InnoDB Cluster VS Galera )
 
Always on 可用性グループ 構築時のポイント
Always on 可用性グループ 構築時のポイントAlways on 可用性グループ 構築時のポイント
Always on 可用性グループ 構築時のポイント
 
MySQL Database Architectures - 2020-10
MySQL Database Architectures -  2020-10MySQL Database Architectures -  2020-10
MySQL Database Architectures - 2020-10
 
Highly efficient backups with percona xtrabackup
Highly efficient backups with percona xtrabackupHighly efficient backups with percona xtrabackup
Highly efficient backups with percona xtrabackup
 
MySQL Day Roma - MySQL Shell and Visual Studio Code Extension
MySQL Day Roma - MySQL Shell and Visual Studio Code ExtensionMySQL Day Roma - MySQL Shell and Visual Studio Code Extension
MySQL Day Roma - MySQL Shell and Visual Studio Code Extension
 
MySQL Parallel Replication: All the 5.7 and 8.0 Details (LOGICAL_CLOCK)
MySQL Parallel Replication: All the 5.7 and 8.0 Details (LOGICAL_CLOCK)MySQL Parallel Replication: All the 5.7 and 8.0 Details (LOGICAL_CLOCK)
MySQL Parallel Replication: All the 5.7 and 8.0 Details (LOGICAL_CLOCK)
 
Introduction to MySQL InnoDB Cluster
Introduction to MySQL InnoDB ClusterIntroduction to MySQL InnoDB Cluster
Introduction to MySQL InnoDB Cluster
 
Galera cluster for high availability
Galera cluster for high availability Galera cluster for high availability
Galera cluster for high availability
 
Differences between MariaDB 10.3 & MySQL 8.0
Differences between MariaDB 10.3 & MySQL 8.0Differences between MariaDB 10.3 & MySQL 8.0
Differences between MariaDB 10.3 & MySQL 8.0
 
MySQL InnoDB Cluster: Management and Troubleshooting with MySQL Shell
MySQL InnoDB Cluster: Management and Troubleshooting with MySQL ShellMySQL InnoDB Cluster: Management and Troubleshooting with MySQL Shell
MySQL InnoDB Cluster: Management and Troubleshooting with MySQL Shell
 
MySQL InnoDB Cluster - Group Replication
MySQL InnoDB Cluster - Group ReplicationMySQL InnoDB Cluster - Group Replication
MySQL InnoDB Cluster - Group Replication
 
Intro ProxySQL
Intro ProxySQLIntro ProxySQL
Intro ProxySQL
 
MySQL Database Architectures - High Availability and Disaster Recovery Solution
MySQL Database Architectures - High Availability and Disaster Recovery SolutionMySQL Database Architectures - High Availability and Disaster Recovery Solution
MySQL Database Architectures - High Availability and Disaster Recovery Solution
 
Disaster Recovery with MySQL InnoDB ClusterSet - What is it and how do I use it?
Disaster Recovery with MySQL InnoDB ClusterSet - What is it and how do I use it?Disaster Recovery with MySQL InnoDB ClusterSet - What is it and how do I use it?
Disaster Recovery with MySQL InnoDB ClusterSet - What is it and how do I use it?
 
Best practices for MySQL High Availability
Best practices for MySQL High AvailabilityBest practices for MySQL High Availability
Best practices for MySQL High Availability
 
HA環境構築のベスト・プラクティス
HA環境構築のベスト・プラクティスHA環境構築のベスト・プラクティス
HA環境構築のベスト・プラクティス
 
OpenStack Ironic - Bare Metal-as-a-Service
OpenStack Ironic - Bare Metal-as-a-ServiceOpenStack Ironic - Bare Metal-as-a-Service
OpenStack Ironic - Bare Metal-as-a-Service
 

Similar to MySQL InnoDB Cluster and Group Replication in a Nutshell: hands-on tutorial

How to operate MySQL InnoDB Cluster with MySQL Shell
How to operate MySQL InnoDB Cluster with MySQL ShellHow to operate MySQL InnoDB Cluster with MySQL Shell
How to operate MySQL InnoDB Cluster with MySQL ShellFrederic Descamps
 
MySQL Shell: the best DBA tool ?
MySQL Shell: the best DBA tool ?MySQL Shell: the best DBA tool ?
MySQL Shell: the best DBA tool ?Frederic Descamps
 
MySQL Shell : the best DBA tool ?
MySQL Shell : the best DBA tool ?MySQL Shell : the best DBA tool ?
MySQL Shell : the best DBA tool ?Frederic Descamps
 
MySQL InnoDB Cluster and Group Replication in a Nutshell
MySQL InnoDB Cluster and Group Replication in a NutshellMySQL InnoDB Cluster and Group Replication in a Nutshell
MySQL InnoDB Cluster and Group Replication in a NutshellFrederic Descamps
 
MySQL InnoDB Cluster in a Nutshell - Hands-on Lab
MySQL InnoDB Cluster in a Nutshell - Hands-on LabMySQL InnoDB Cluster in a Nutshell - Hands-on Lab
MySQL InnoDB Cluster in a Nutshell - Hands-on LabFrederic Descamps
 
MySQL Innovation Day Chicago - MySQL HA So Easy : That's insane !!
MySQL Innovation Day Chicago  - MySQL HA So Easy : That's insane !!MySQL Innovation Day Chicago  - MySQL HA So Easy : That's insane !!
MySQL Innovation Day Chicago - MySQL HA So Easy : That's insane !!Frederic Descamps
 
MySQL Group Replication: the magic explained v.2
MySQL Group Replication: the magic explained v.2MySQL Group Replication: the magic explained v.2
MySQL Group Replication: the magic explained v.2Frederic Descamps
 
MySQL 8.0 InnoDB Cluster - Easiest Tutorial
MySQL 8.0 InnoDB Cluster - Easiest TutorialMySQL 8.0 InnoDB Cluster - Easiest Tutorial
MySQL 8.0 InnoDB Cluster - Easiest TutorialFrederic Descamps
 
How to write efficient and correct MySQL recipes for you configuration manage...
How to write efficient and correct MySQL recipes for you configuration manage...How to write efficient and correct MySQL recipes for you configuration manage...
How to write efficient and correct MySQL recipes for you configuration manage...Frederic Descamps
 
MySQL 8.0 Document Store - how to mix NoSQL & SQL in MySQL 8.0
MySQL 8.0 Document Store - how to mix NoSQL & SQL in MySQL 8.0MySQL 8.0 Document Store - how to mix NoSQL & SQL in MySQL 8.0
MySQL 8.0 Document Store - how to mix NoSQL & SQL in MySQL 8.0Frederic Descamps
 
DataOpsbarcelona 2019: Deep dive into MySQL Group Replication... the magic e...
DataOpsbarcelona 2019:  Deep dive into MySQL Group Replication... the magic e...DataOpsbarcelona 2019:  Deep dive into MySQL Group Replication... the magic e...
DataOpsbarcelona 2019: Deep dive into MySQL Group Replication... the magic e...Frederic Descamps
 
20191001 bkk-secret-of inno-db_clusterv1
20191001 bkk-secret-of inno-db_clusterv120191001 bkk-secret-of inno-db_clusterv1
20191001 bkk-secret-of inno-db_clusterv1Ivan Ma
 
Oracle Open World 2018 / Code One : MySQL 8.0 High Availability with MySQL I...
Oracle Open World 2018 / Code One  : MySQL 8.0 High Availability with MySQL I...Oracle Open World 2018 / Code One  : MySQL 8.0 High Availability with MySQL I...
Oracle Open World 2018 / Code One : MySQL 8.0 High Availability with MySQL I...Frederic Descamps
 
DataOps Barcelona - MySQL HA so easy... that's insane !
DataOps Barcelona - MySQL HA so easy... that's insane !DataOps Barcelona - MySQL HA so easy... that's insane !
DataOps Barcelona - MySQL HA so easy... that's insane !Frederic Descamps
 
20200613 my sql-ha-deployment
20200613 my sql-ha-deployment20200613 my sql-ha-deployment
20200613 my sql-ha-deploymentIvan Ma
 
MySQL Group Replication - HandsOn Tutorial
MySQL Group Replication - HandsOn TutorialMySQL Group Replication - HandsOn Tutorial
MySQL Group Replication - HandsOn TutorialKenny Gryp
 
MySQL Group Replicatio in a nutshell - MySQL InnoDB Cluster
MySQL Group Replicatio  in a nutshell - MySQL InnoDB ClusterMySQL Group Replicatio  in a nutshell - MySQL InnoDB Cluster
MySQL Group Replicatio in a nutshell - MySQL InnoDB ClusterFrederic Descamps
 
MySQL Shell: the best DBA tool !
MySQL Shell: the best DBA tool !MySQL Shell: the best DBA tool !
MySQL Shell: the best DBA tool !Frederic Descamps
 
MySQL Shell - the best DBA tool !
MySQL Shell - the best DBA tool !MySQL Shell - the best DBA tool !
MySQL Shell - the best DBA tool !Frederic Descamps
 

Similar to MySQL InnoDB Cluster and Group Replication in a Nutshell: hands-on tutorial (20)

How to operate MySQL InnoDB Cluster with MySQL Shell
How to operate MySQL InnoDB Cluster with MySQL ShellHow to operate MySQL InnoDB Cluster with MySQL Shell
How to operate MySQL InnoDB Cluster with MySQL Shell
 
MySQL Shell: the best DBA tool ?
MySQL Shell: the best DBA tool ?MySQL Shell: the best DBA tool ?
MySQL Shell: the best DBA tool ?
 
MySQL Shell : the best DBA tool ?
MySQL Shell : the best DBA tool ?MySQL Shell : the best DBA tool ?
MySQL Shell : the best DBA tool ?
 
MySQL InnoDB Cluster and Group Replication in a Nutshell
MySQL InnoDB Cluster and Group Replication in a NutshellMySQL InnoDB Cluster and Group Replication in a Nutshell
MySQL InnoDB Cluster and Group Replication in a Nutshell
 
MySQL InnoDB Cluster in a Nutshell - Hands-on Lab
MySQL InnoDB Cluster in a Nutshell - Hands-on LabMySQL InnoDB Cluster in a Nutshell - Hands-on Lab
MySQL InnoDB Cluster in a Nutshell - Hands-on Lab
 
MySQL Innovation Day Chicago - MySQL HA So Easy : That's insane !!
MySQL Innovation Day Chicago  - MySQL HA So Easy : That's insane !!MySQL Innovation Day Chicago  - MySQL HA So Easy : That's insane !!
MySQL Innovation Day Chicago - MySQL HA So Easy : That's insane !!
 
MySQL Group Replication: the magic explained v.2
MySQL Group Replication: the magic explained v.2MySQL Group Replication: the magic explained v.2
MySQL Group Replication: the magic explained v.2
 
Sunshine php my sql 8.0 v2
Sunshine php my sql 8.0 v2Sunshine php my sql 8.0 v2
Sunshine php my sql 8.0 v2
 
MySQL 8.0 InnoDB Cluster - Easiest Tutorial
MySQL 8.0 InnoDB Cluster - Easiest TutorialMySQL 8.0 InnoDB Cluster - Easiest Tutorial
MySQL 8.0 InnoDB Cluster - Easiest Tutorial
 
How to write efficient and correct MySQL recipes for you configuration manage...
How to write efficient and correct MySQL recipes for you configuration manage...How to write efficient and correct MySQL recipes for you configuration manage...
How to write efficient and correct MySQL recipes for you configuration manage...
 
MySQL 8.0 Document Store - how to mix NoSQL & SQL in MySQL 8.0
MySQL 8.0 Document Store - how to mix NoSQL & SQL in MySQL 8.0MySQL 8.0 Document Store - how to mix NoSQL & SQL in MySQL 8.0
MySQL 8.0 Document Store - how to mix NoSQL & SQL in MySQL 8.0
 
DataOpsbarcelona 2019: Deep dive into MySQL Group Replication... the magic e...
DataOpsbarcelona 2019:  Deep dive into MySQL Group Replication... the magic e...DataOpsbarcelona 2019:  Deep dive into MySQL Group Replication... the magic e...
DataOpsbarcelona 2019: Deep dive into MySQL Group Replication... the magic e...
 
20191001 bkk-secret-of inno-db_clusterv1
20191001 bkk-secret-of inno-db_clusterv120191001 bkk-secret-of inno-db_clusterv1
20191001 bkk-secret-of inno-db_clusterv1
 
Oracle Open World 2018 / Code One : MySQL 8.0 High Availability with MySQL I...
Oracle Open World 2018 / Code One  : MySQL 8.0 High Availability with MySQL I...Oracle Open World 2018 / Code One  : MySQL 8.0 High Availability with MySQL I...
Oracle Open World 2018 / Code One : MySQL 8.0 High Availability with MySQL I...
 
DataOps Barcelona - MySQL HA so easy... that's insane !
DataOps Barcelona - MySQL HA so easy... that's insane !DataOps Barcelona - MySQL HA so easy... that's insane !
DataOps Barcelona - MySQL HA so easy... that's insane !
 
20200613 my sql-ha-deployment
20200613 my sql-ha-deployment20200613 my sql-ha-deployment
20200613 my sql-ha-deployment
 
MySQL Group Replication - HandsOn Tutorial
MySQL Group Replication - HandsOn TutorialMySQL Group Replication - HandsOn Tutorial
MySQL Group Replication - HandsOn Tutorial
 
MySQL Group Replicatio in a nutshell - MySQL InnoDB Cluster
MySQL Group Replicatio  in a nutshell - MySQL InnoDB ClusterMySQL Group Replicatio  in a nutshell - MySQL InnoDB Cluster
MySQL Group Replicatio in a nutshell - MySQL InnoDB Cluster
 
MySQL Shell: the best DBA tool !
MySQL Shell: the best DBA tool !MySQL Shell: the best DBA tool !
MySQL Shell: the best DBA tool !
 
MySQL Shell - the best DBA tool !
MySQL Shell - the best DBA tool !MySQL Shell - the best DBA tool !
MySQL Shell - the best DBA tool !
 

More from Frederic Descamps

MySQL Innovation & Cloud Day - Document Store avec MySQL HeatWave Database Se...
MySQL Innovation & Cloud Day - Document Store avec MySQL HeatWave Database Se...MySQL Innovation & Cloud Day - Document Store avec MySQL HeatWave Database Se...
MySQL Innovation & Cloud Day - Document Store avec MySQL HeatWave Database Se...Frederic Descamps
 
RivieraJUG - MySQL Indexes and Histograms
RivieraJUG - MySQL Indexes and HistogramsRivieraJUG - MySQL Indexes and Histograms
RivieraJUG - MySQL Indexes and HistogramsFrederic Descamps
 
RivieraJUG - MySQL 8.0 - What's new for developers.pdf
RivieraJUG - MySQL 8.0 - What's new for developers.pdfRivieraJUG - MySQL 8.0 - What's new for developers.pdf
RivieraJUG - MySQL 8.0 - What's new for developers.pdfFrederic Descamps
 
MySQL User Group NL - MySQL 8
MySQL User Group NL - MySQL 8MySQL User Group NL - MySQL 8
MySQL User Group NL - MySQL 8Frederic Descamps
 
State of the Dolphin - May 2022
State of the Dolphin - May 2022State of the Dolphin - May 2022
State of the Dolphin - May 2022Frederic Descamps
 
Percona Live 2022 - MySQL Shell for Visual Studio Code
Percona Live 2022 - MySQL Shell for Visual Studio CodePercona Live 2022 - MySQL Shell for Visual Studio Code
Percona Live 2022 - MySQL Shell for Visual Studio CodeFrederic Descamps
 
Percona Live 2022 - The Evolution of a MySQL Database System
Percona Live 2022 - The Evolution of a MySQL Database SystemPercona Live 2022 - The Evolution of a MySQL Database System
Percona Live 2022 - The Evolution of a MySQL Database SystemFrederic Descamps
 
Percona Live 2022 - MySQL Architectures
Percona Live 2022 - MySQL ArchitecturesPercona Live 2022 - MySQL Architectures
Percona Live 2022 - MySQL ArchitecturesFrederic Descamps
 
LinuxFest Northwest 2022 - The Evolution of a MySQL Database System
LinuxFest Northwest 2022 - The Evolution of a MySQL Database SystemLinuxFest Northwest 2022 - The Evolution of a MySQL Database System
LinuxFest Northwest 2022 - The Evolution of a MySQL Database SystemFrederic Descamps
 
Open Source 101 2022 - MySQL Indexes and Histograms
Open Source 101 2022 - MySQL Indexes and HistogramsOpen Source 101 2022 - MySQL Indexes and Histograms
Open Source 101 2022 - MySQL Indexes and HistogramsFrederic Descamps
 
Pi Day 2022 - from IoT to MySQL HeatWave Database Service
Pi Day 2022 -  from IoT to MySQL HeatWave Database ServicePi Day 2022 -  from IoT to MySQL HeatWave Database Service
Pi Day 2022 - from IoT to MySQL HeatWave Database ServiceFrederic Descamps
 
Confoo 2022 - le cycle d'une instance MySQL
Confoo 2022  - le cycle d'une instance MySQLConfoo 2022  - le cycle d'une instance MySQL
Confoo 2022 - le cycle d'une instance MySQLFrederic Descamps
 
FOSDEM 2022 MySQL Devroom: MySQL 8.0 - Logical Backups, Snapshots and Point-...
FOSDEM 2022 MySQL Devroom:  MySQL 8.0 - Logical Backups, Snapshots and Point-...FOSDEM 2022 MySQL Devroom:  MySQL 8.0 - Logical Backups, Snapshots and Point-...
FOSDEM 2022 MySQL Devroom: MySQL 8.0 - Logical Backups, Snapshots and Point-...Frederic Descamps
 
Les nouveautés de MySQL 8.0
Les nouveautés de MySQL 8.0Les nouveautés de MySQL 8.0
Les nouveautés de MySQL 8.0Frederic Descamps
 
Les nouveautés de MySQL 8.0
Les nouveautés de MySQL 8.0Les nouveautés de MySQL 8.0
Les nouveautés de MySQL 8.0Frederic Descamps
 
State of The Dolphin - May 2021
State of The Dolphin - May 2021State of The Dolphin - May 2021
State of The Dolphin - May 2021Frederic Descamps
 
Deploying Magento on OCI with MDS
Deploying Magento on OCI with MDSDeploying Magento on OCI with MDS
Deploying Magento on OCI with MDSFrederic Descamps
 
From single MySQL instance to High Availability: the journey to MySQL InnoDB ...
From single MySQL instance to High Availability: the journey to MySQL InnoDB ...From single MySQL instance to High Availability: the journey to MySQL InnoDB ...
From single MySQL instance to High Availability: the journey to MySQL InnoDB ...Frederic Descamps
 
Cloud native - Why to use MySQL 8.0 and how to use it on oci with MDS
Cloud native -  Why to use MySQL 8.0 and how to use it on oci with MDSCloud native -  Why to use MySQL 8.0 and how to use it on oci with MDS
Cloud native - Why to use MySQL 8.0 and how to use it on oci with MDSFrederic Descamps
 

More from Frederic Descamps (20)

MySQL Innovation & Cloud Day - Document Store avec MySQL HeatWave Database Se...
MySQL Innovation & Cloud Day - Document Store avec MySQL HeatWave Database Se...MySQL Innovation & Cloud Day - Document Store avec MySQL HeatWave Database Se...
MySQL Innovation & Cloud Day - Document Store avec MySQL HeatWave Database Se...
 
RivieraJUG - MySQL Indexes and Histograms
RivieraJUG - MySQL Indexes and HistogramsRivieraJUG - MySQL Indexes and Histograms
RivieraJUG - MySQL Indexes and Histograms
 
RivieraJUG - MySQL 8.0 - What's new for developers.pdf
RivieraJUG - MySQL 8.0 - What's new for developers.pdfRivieraJUG - MySQL 8.0 - What's new for developers.pdf
RivieraJUG - MySQL 8.0 - What's new for developers.pdf
 
MySQL User Group NL - MySQL 8
MySQL User Group NL - MySQL 8MySQL User Group NL - MySQL 8
MySQL User Group NL - MySQL 8
 
State of the Dolphin - May 2022
State of the Dolphin - May 2022State of the Dolphin - May 2022
State of the Dolphin - May 2022
 
Percona Live 2022 - MySQL Shell for Visual Studio Code
Percona Live 2022 - MySQL Shell for Visual Studio CodePercona Live 2022 - MySQL Shell for Visual Studio Code
Percona Live 2022 - MySQL Shell for Visual Studio Code
 
Percona Live 2022 - The Evolution of a MySQL Database System
Percona Live 2022 - The Evolution of a MySQL Database SystemPercona Live 2022 - The Evolution of a MySQL Database System
Percona Live 2022 - The Evolution of a MySQL Database System
 
Percona Live 2022 - MySQL Architectures
Percona Live 2022 - MySQL ArchitecturesPercona Live 2022 - MySQL Architectures
Percona Live 2022 - MySQL Architectures
 
LinuxFest Northwest 2022 - The Evolution of a MySQL Database System
LinuxFest Northwest 2022 - The Evolution of a MySQL Database SystemLinuxFest Northwest 2022 - The Evolution of a MySQL Database System
LinuxFest Northwest 2022 - The Evolution of a MySQL Database System
 
Open Source 101 2022 - MySQL Indexes and Histograms
Open Source 101 2022 - MySQL Indexes and HistogramsOpen Source 101 2022 - MySQL Indexes and Histograms
Open Source 101 2022 - MySQL Indexes and Histograms
 
Pi Day 2022 - from IoT to MySQL HeatWave Database Service
Pi Day 2022 -  from IoT to MySQL HeatWave Database ServicePi Day 2022 -  from IoT to MySQL HeatWave Database Service
Pi Day 2022 - from IoT to MySQL HeatWave Database Service
 
Confoo 2022 - le cycle d'une instance MySQL
Confoo 2022  - le cycle d'une instance MySQLConfoo 2022  - le cycle d'une instance MySQL
Confoo 2022 - le cycle d'une instance MySQL
 
FOSDEM 2022 MySQL Devroom: MySQL 8.0 - Logical Backups, Snapshots and Point-...
FOSDEM 2022 MySQL Devroom:  MySQL 8.0 - Logical Backups, Snapshots and Point-...FOSDEM 2022 MySQL Devroom:  MySQL 8.0 - Logical Backups, Snapshots and Point-...
FOSDEM 2022 MySQL Devroom: MySQL 8.0 - Logical Backups, Snapshots and Point-...
 
Les nouveautés de MySQL 8.0
Les nouveautés de MySQL 8.0Les nouveautés de MySQL 8.0
Les nouveautés de MySQL 8.0
 
Les nouveautés de MySQL 8.0
Les nouveautés de MySQL 8.0Les nouveautés de MySQL 8.0
Les nouveautés de MySQL 8.0
 
State of The Dolphin - May 2021
State of The Dolphin - May 2021State of The Dolphin - May 2021
State of The Dolphin - May 2021
 
MySQL Shell for DBAs
MySQL Shell for DBAsMySQL Shell for DBAs
MySQL Shell for DBAs
 
Deploying Magento on OCI with MDS
Deploying Magento on OCI with MDSDeploying Magento on OCI with MDS
Deploying Magento on OCI with MDS
 
From single MySQL instance to High Availability: the journey to MySQL InnoDB ...
From single MySQL instance to High Availability: the journey to MySQL InnoDB ...From single MySQL instance to High Availability: the journey to MySQL InnoDB ...
From single MySQL instance to High Availability: the journey to MySQL InnoDB ...
 
Cloud native - Why to use MySQL 8.0 and how to use it on oci with MDS
Cloud native -  Why to use MySQL 8.0 and how to use it on oci with MDSCloud native -  Why to use MySQL 8.0 and how to use it on oci with MDS
Cloud native - Why to use MySQL 8.0 and how to use it on oci with MDS
 

Recently uploaded

Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsAndrey Dotsenko
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsPrecisely
 

Recently uploaded (20)

Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power Systems
 

MySQL InnoDB Cluster and Group Replication in a Nutshell: hands-on tutorial

  • 1. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 1/230 1 / 230
  • 2. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 2/230 2 / 2302 / 230
  • 3. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 3/230 MySQL InnoDB Cluster in a Nutshell Hands-On Tutorial Percona Live USA - Austin, TX 2019 Frédéric Descamps - MySQL Community Manager - Oracle Kenny Gryp - MySQL Product Manager - Oracle 3 / 230
  • 4. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 4/230   Safe Harbor Statement The following is intended to outline our general product direction. It is intended for information purpose only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied up in making purchasing decisions. The development, release and timing of any features or functionality described for Oracle´s product remains at the sole discretion of Oracle. Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 4 / 230
  • 5. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 5/230 Who are we ? Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 5 / 230
  • 6. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 6/230 Frédéric Descamps @lefred MySQL Evangelist Managing MySQL since 3.23 devops believer http://about.me/lefred   Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 6 / 230
  • 7. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 7/230 Kenny Gryp @gryp MySQL Product Manager     High Availability & InnoDB   Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 7 / 230
  • 8. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 8/230 how will the session proceed? Agenda Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 8 / 230
  • 9. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 9/230 Agenda Prepare your workstation Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 9 / 230
  • 10. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 10/230 Agenda Prepare your workstation What is MySQL InnoDB Cluster & Group Replication ? Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 10 / 230
  • 11. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 11/230 Agenda Prepare your workstation What is MySQL InnoDB Cluster & Group Replication ? Migrating from Asynchronous Replication to Group Replication Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 11 / 230
  • 12. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 12/230 Agenda Prepare your workstation What is MySQL InnoDB Cluster & Group Replication ? Migrating from Asynchronous Replication to Group Replication Monitoring Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 12 / 230
  • 13. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 13/230 Agenda Prepare your workstation What is MySQL InnoDB Cluster & Group Replication ? Migrating from Asynchronous Replication to Group Replication Monitoring Connecting to the cluster Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 13 / 230
  • 14. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 14/230 Agenda Prepare your workstation What is MySQL InnoDB Cluster & Group Replication ? Migrating from Asynchronous Replication to Group Replication Monitoring Connecting to the cluster Various Configuration Options Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 14 / 230
  • 15. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 15/230 Agenda Prepare your workstation What is MySQL InnoDB Cluster & Group Replication ? Migrating from Asynchronous Replication to Group Replication Monitoring Connecting to the cluster Various Configuration Options Application Behavior & Consistency Guarantees Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 15 / 230
  • 16. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 16/230 Agenda Prepare your workstation What is MySQL InnoDB Cluster & Group Replication ? Migrating from Asynchronous Replication to Group Replication Monitoring Connecting to the cluster Various Configuration Options Application Behavior & Consistency Guarantees Failure Scenarios - Labs Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 16 / 230
  • 17. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 17/230 VirtualBox Setup your workstation Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 17 / 230
  • 18. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 18/230 Setup your workstation Install VirtualBox 6.0 On the USB key, COPY MySQLInnoDBCluster_PLUS19.ova and click on it Ensure you have vboxnet0 network interface Older VirtualBox: VirtualBox Pref. -> Network -> Host-Only Networks -> + New VirtualBox: Global Tools -> Host Network Manager -> + Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 18 / 230
  • 19. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 19/230 Login on your workstation Start all virtual machines (mysql1, mysql2, mysql3 & mysql4) Try to connect to all VM´s from your terminal or putty (root password is X) : ssh root@192.168.56.11 mysql1 ssh root@192.168.56.12 mysql2 ssh root@192.168.56.13 mysql3 ssh root@192.168.56.14 mysql4 Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 19 / 230
  • 20. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 20/230 LAB1: Current situation Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 20 / 230
  • 21. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 21/230 all running database servers (mysql1 & mysql2) are using MySQL 5.7.24 LAB1: Current situation Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 21 / 230
  • 22. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 22/230 launch run_app.sh on mysql1 into a screen session verify that mysql2 is a running replica LAB1: Current situation Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 22 / 230
  • 23. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 23/230 Summary   ROLE INTERNAL IP mysql1 master 192.168.56.11 mysql2 replica 192.168.56.12 mysql3 n/a 192.168.56.13 mysql4 n/a 192.168.56.14 Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 23 / 230
  • 24. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 24/230 Summary   ROLE INTERNAL IP mysql1 master 192.168.56.11 mysql2 replica 192.168.56.12 mysql3 n/a 192.168.56.13 mysql4 n/a 192.168.56.14 write this down somewhere ! Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 24 / 230
  • 25. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 25/230 Easy High Availability MySQL InnoDB Cluster Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 25 / 230
  • 26. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 26/230 InnoDB cluster Ease-of-Use Extreme Scale-Out Out-of-Box Solution Built-in HA High Performance Everything Integrated Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 26 / 230
  • 27. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 27/230 InnoDB Cluster's Architecture Application MySQL Connector MySQL Router MySQL Shell InnoDB cluster Application MySQL Connector MySQL Router Mp M M Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 27 / 230
  • 28. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 28/230 Group Replication: heart of MySQL InnoDB Cluster Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 28 / 230
  • 29. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 29/230 Group Replication: heart of MySQL InnoDB Cluster Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 29 / 230
  • 30. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 30/230 MySQL Group Replication but what is it ?!? Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 30 / 230
  • 31. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 31/230 MySQL Group Replication but what is it ?!? GR is a plugin for MySQL, made by MySQL and packaged with MySQL Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 31 / 230
  • 32. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 32/230 MySQL Group Replication but what is it ?!? GR is a plugin for MySQL, made by MySQL and packaged with MySQL GR is an implementation of Replicated Database State Machine theory Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 32 / 230
  • 33. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 33/230 MySQL Group Replication but what is it ?!? GR is a plugin for MySQL, made by MySQL and packaged with MySQL GR is an implementation of Replicated Database State Machine theory Paxos based protocol Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 33 / 230
  • 34. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 34/230 MySQL Group Replication but what is it ?!? GR is a plugin for MySQL, made by MySQL and packaged with MySQL GR is an implementation of Replicated Database State Machine theory Paxos based protocol GR allows to write on all Group Members (cluster nodes) simultaneously while retaining consistency Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 34 / 230
  • 35. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 35/230 MySQL Group Replication but what is it ?!? GR is a plugin for MySQL, made by MySQL and packaged with MySQL GR is an implementation of Replicated Database State Machine theory Paxos based protocol GR allows to write on all Group Members (cluster nodes) simultaneously while retaining consistency GR implements conflict detection and resolution Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 35 / 230
  • 36. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 36/230 MySQL Group Replication but what is it ?!? GR is a plugin for MySQL, made by MySQL and packaged with MySQL GR is an implementation of Replicated Database State Machine theory Paxos based protocol GR allows to write on all Group Members (cluster nodes) simultaneously while retaining consistency GR implements conflict detection and resolution GR allows automatic distributed recovery Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 36 / 230
  • 37. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 37/230 MySQL Group Replication but what is it ?!? GR is a plugin for MySQL, made by MySQL and packaged with MySQL GR is an implementation of Replicated Database State Machine theory Paxos based protocol GR allows to write on all Group Members (cluster nodes) simultaneously while retaining consistency GR implements conflict detection and resolution GR allows automatic distributed recovery Supported on all MySQL platforms !! Linux, Windows, Solaris, OSX, FreeBSD Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 37 / 230
  • 38. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 38/230 And for users ? Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 38 / 230
  • 39. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 39/230 And for users ? not longer necessary to handle server fail-over manually or with a complicated script Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 39 / 230
  • 40. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 40/230 And for users ? not longer necessary to handle server fail-over manually or with a complicated script GR provides fault tolerance Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 40 / 230
  • 41. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 41/230 And for users ? not longer necessary to handle server fail-over manually or with a complicated script GR provides fault tolerance GR enables update-everywhere setups Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 41 / 230
  • 42. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 42/230 And for users ? not longer necessary to handle server fail-over manually or with a complicated script GR provides fault tolerance GR enables update-everywhere setups GR handles crashes, failures, re-connects automatically Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 42 / 230
  • 43. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 43/230 And for users ? not longer necessary to handle server fail-over manually or with a complicated script GR provides fault tolerance GR enables update-everywhere setups GR handles crashes, failures, re-connects automatically Allows an easy setup of a highly available MySQL service! Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 43 / 230
  • 44. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 44/230 Migrating from Asynchronous Replication to Group Replication Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 44 / 230
  • 45. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 45/230 The plan Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 45 / 230
  • 46. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 46/230 These are the 10 steps for the migration: 1) We install and setup MySQL InnoDB Cluster on one of the new servers The plan Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 46 / 230
  • 47. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 47/230 2) we restore a backup 3) we update to MySQL 8.0 4) setup asynchronous replication on the new server. The plan Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 47 / 230
  • 48. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 48/230 5) we add a new instance to our group The plan Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 48 / 230
  • 49. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 49/230 6) we point the application to one of our new nodes. 7) we wait and check that asynchronous replication is caught up 8) we stop those asynchronous slaves The plan Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 49 / 230
  • 50. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 50/230 9) we upgrade and attach mysql2 (previous slave) to the group The plan Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 50 / 230
  • 51. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 51/230 10) use MySQL Router for directing traffic The plan Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 51 / 230
  • 52. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 52/230 LAB2: Verify if your environment can be upgraded to MySQL 8.0 We will first create an admin account on mysql1 that we will use throughout the tutorial: mysql1> CREATE USER clusteradmin@'%' identi ed by 'mysql'; mysql1> GRANT ALL PRIVILEGES ON *.* TO clusteradmin@'%' WITH GRANT OPTION; Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 52 / 230
  • 53. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 53/230 LAB2: Verify if your environment can be upgraded to MySQL 8.0 - util Now, we use MySQL Shell to check if the settings on mysql1 can be upgraded to MySQL 8.0 without problem: Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 53 / 230
  • 54. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 54/230 LAB2: Verify if your environment can be upgraded to MySQL 8.0 - util Now, we use MySQL Shell to check if the settings on mysql1 can be upgraded to MySQL 8.0 without problem: # mysqlsh -- util check-for-server-upgrade clusteradmin@mysql1 Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 54 / 230
  • 55. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 55/230 LAB2: Verify if your environment can be upgraded to MySQL 8.0 - util Now, we use MySQL Shell to check if the settings on mysql1 can be upgraded to MySQL 8.0 without problem: # mysqlsh -- util check-for-server-upgrade clusteradmin@mysql1 Anything special in the output ? Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 55 / 230
  • 56. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 56/230 LAB2: Verify if your environment can be upgraded to MySQL 8.0 - util Now, we use MySQL Shell to check if the settings on mysql1 can be upgraded to MySQL 8.0 without problem: # mysqlsh -- util check-for-server-upgrade clusteradmin@mysql1 Anything special in the output ? # mysqlsh -- util check-for-server-upgrade clusteradmin@mysql1 --con gPath=/etc/my.cnf Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 56 / 230
  • 57. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 57/230 LAB2: Beautiful MySQL Shell You can setup a better shell environment : # mysqlsh mysql-js> shell.options.setPersist('history.autoSave', 1) mysql-js> shell.options.setPersist('history.maxSize', 5000) # cp /usr/share/mysqlsh/prompt/prompt_256pl+aw.json ~/.mysqlsh/prompt.json # mysqlsh clusteradmin@mysql2 Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 57 / 230
  • 58. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 58/230 MySQL 8.0.16 is already installed on mysql3. Let´s take a backup on mysql1: [mysql1 ~]# mysqlpump --set-gtid-purged=ON --exclude-databases=mysql --include-users=repl%,clusteradmin%,app% > /tmp/backup.sql Copy the backup from mysql1 to mysql3: [mysql1 ~]# scp -r /tmp/backup.sql mysql3:/tmp LAB2: Prepare mysql3 - Asynchronous slave Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 58 / 230
  • 59. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 59/230 restore the dump change MASTER start replication LAB3: mysql3 as asynchronous slave (1)   Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 59 / 230
  • 60. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 60/230 LAB3: mysql3 as asynchronous slave (2) Restore backup: [mysql3 ~]# mysql < /tmp/backup.sql Connect to mysql3 and setup replication: mysql3> CHANGE MASTER TO MASTER_HOST="mysql1", MASTER_USER="repl", MASTER_PASSWORD='X', MASTER_AUTO_POSITION=1; mysql3> START SLAVE; Check that you receive the application´s traffic Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 60 / 230
  • 61. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 61/230 Administration made easy and more... MySQL InnoDB Cluster Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 61 / 230
  • 62. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 62/230 LAB4: MySQL InnoDB Cluster Create a single instance cluster (mysql3) # mysqlsh Let´s verify if our server is ready to become a member of a new cluster: mysql-js> dba.checkInstanceCon guration('clusteradmin@mysql3') Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 62 / 230
  • 63. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 63/230 LAB4: MySQL InnoDB Cluster Create a single instance cluster (mysql3) # mysqlsh Let´s verify if our server is ready to become a member of a new cluster: mysql-js> dba.checkInstanceCon guration('clusteradmin@mysql3') Change the configuration ! mysql-js> dba.con gureInstance('clusteradmin@mysql3') Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 63 / 230
  • 64. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 64/230 LAB4: MySQL InnoDB Cluster (2) Wait just a bit if a restart is required (which is not the case here) and create a single instance cluster mysql-js> dba.checkInstanceCon guration('clusteradmin@mysql3') mysql-js> c clusteradmin@mysql3 mysql-js> cluster = dba.createCluster('perconalive') Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 64 / 230
  • 65. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 65/230 LAB4: Cluster Status mysql-js> cluster.status() { "clusterName": "perconalive", "defaultReplicaSet": { "name": "default", "primary": "mysql3:3306", "ssl": "REQUIRED", "status": "OK_NO_TOLERANCE", "statusText": "Cluster is NOT tolerant to any failures.", "topology": { "mysql3:3306": { "address": "mysql3:3306", "mode": "R/W", "readReplicas": {}, "role": "HA", "status": "ONLINE", "version": "8.0.16" } }, "topologyMode": "Single-Primary" }, "groupInformationSourceMember": "mysql3:3306" } Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 65 / 230
  • 66. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 66/230 Add mysql4 to the Group: restore the backup use MySQL Shell LAB5: add mysql4 to the cluster (1)   Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 66 / 230
  • 67. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 67/230 LAB5: add mysql4 to the cluster (2) Copy the backup from mysql1 to mysql4: [mysql1 ~]# scp -r /tmp/backup.sql mysql4:/tmp Restore the backup: [mysql4 ~]# mysql < /tmp/backup.sql Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 67 / 230
  • 68. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 68/230 LAB5: MySQL Shell to add an instance (3) Let´s add mysql4 (check configuration, check instance and add to cluster all in one command that can be done from the opened shell in mysql3): mysql-js> dba.con gureInstance('clusteradmin@mysql4') mysql-js> cluster.addInstance('clusteradmin@mysql4') mysql-js> cluster.status() Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 68 / 230
  • 69. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 69/230 Cluster Status mysql-js> cluster.status() { "clusterName": "perconalive", "defaultReplicaSet": { "name": "default", "primary": "mysql3:3306", "ssl": "REQUIRED", "status": "OK_NO_TOLERANCE", "statusText": "Cluster is NOT tolerant to any failures. 1 member is no "topology": { "mysql3:3306": { "address": "mysql3:3306", "mode": "R/W", "readReplicas": {}, "role": "HA", "status": "ONLINE" }, "mysql4:3306": { "address": "mysql4:3306", "mode": "R/O", "readReplicas": {}, "role": "HA", "status": "RECOVERING" Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 69 / 230
  • 70. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 70/230 Recovering progress On standard MySQL, monitor the group_replication_recovery channel to see the progress: mysql4> 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 @ 2019 Oracle and/or its affiliates. All rights reserved. 70 / 230
  • 71. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 71/230 Cluster Status { "clusterName": "perconalive", "defaultReplicaSet": { "name": "default", "primary": "mysql3:3306", "ssl": "REQUIRED", "status": "OK_NO_TOLERANCE", "statusText": "Cluster is NOT tolerant to any failures.", "topology": { "mysql3:3306": { "address": "mysql3:3306", "mode": "R/W", "readReplicas": {}, "role": "HA", "status": "ONLINE" }, "mysql4:3306": { "address": "mysql4:3306", "mode": "R/O", "readReplicas": {}, "role": "HA", "status": "ONLINE" } Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 71 / 230
  • 72. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 72/230 Asynchronous Replication When a group is created, the asynchronous SQL Thread is stopped and needs to be restarted. Verify that replication from mysql1 is still running on mysql3, and restart the SQL Thread: mysql-sql> c clusteradmin@mysql3 mysql-sql> SHOW SLAVE STATUSG mysql-sql> START SLAVE SQL_THREAD; Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 72 / 230
  • 73. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 73/230 point the application to the cluster Migrate the application Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 73 / 230
  • 74. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 74/230 LAB6: Migrate the application Now we need to point the application to mysql3, this is the only downtime ! Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 74 / 230
  • 75. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 75/230 LAB6: Migrate the application Now we need to point the application to mysql3, this is the only downtime ! Make sure the master and replica is in sync Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 75 / 230
  • 76. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 76/230 LAB6: Migrate the application Now we need to point the application to mysql3, this is the only downtime ! Make sure the master and replica is in sync Start application, connecting to the Group Replication master (mysql3) ... [ 21257s] threads: 4, tps: 12.00, reads: 167.94, writes: 47.98, response t [ 21258s] threads: 4, tps: 6.00, reads: 83.96, writes: 23.99, response t [ 21259s] threads: 4, tps: 7.00, reads: 98.05, writes: 28.01, response t [ 31250s] threads: 4, tps: 8.00, reads: 111.95, writes: 31.99, response t [ 31251s] threads: 4, tps: 11.00, reads: 154.01, writes: 44.00, response t [ 31252s] threads: 4, tps: 11.00, reads: 153.94, writes: 43.98, response t [ 31253s] threads: 4, tps: 10.01, reads: 140.07, writes: 40.02, response t ^C [mysql1 ~]# run_app.sh mysql3 Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 76 / 230
  • 77. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 77/230 LAB6: Migrate the application Make sure gtid_executed range on mysql2 is lower or equal than on mysql3 mysql[2-3]> SHOW GLOBAL VARIABLES LIKE 'gtid_executed'G Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 77 / 230
  • 78. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 78/230 LAB6: Migrate the application Make sure gtid_executed range on mysql2 is lower or equal than on mysql3 mysql[2-3]> SHOW GLOBAL VARIABLES LIKE 'gtid_executed'G When they are OK, stop asynchronous replication on mysql2 and mysql3: mysql2> STOP SLAVE; mysql3> STOP SLAVE; Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 78 / 230
  • 79. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 79/230 LAB6: Migrate the application Make sure gtid_executed range on mysql2 is lower or equal than on mysql3 mysql[2-3]> SHOW GLOBAL VARIABLES LIKE 'gtid_executed'G When they are OK, stop asynchronous replication on mysql2 and mysql3: mysql2> STOP SLAVE; mysql3> STOP SLAVE; Now they can forget about mysql1: mysql[2-3]> RESET SLAVE ALL FOR CHANNEL ''; Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 79 / 230
  • 80. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 80/230 previous slave (mysql2) can now be part of the cluster Add a third instance Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 80 / 230
  • 81. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 81/230 LAB7: Add mysql2 to the group We first upgrade to MySQL 8.0.16 : Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 81 / 230
  • 82. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 82/230 LAB7: Add mysql2 to the group We first upgrade to MySQL 8.0.16 : [mysql2 ~]# systemctl stop mysqld [mysql2 ~]# rpm -Uvh /root/rpms/*rpm --force [mysql2 ~]# systemctl start mysqld Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 82 / 230
  • 83. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 83/230 LAB7: Add mysql2 to the group We first upgrade to MySQL 8.0.16 : [mysql2 ~]# systemctl stop mysqld [mysql2 ~]# rpm -Uvh /root/rpms/*rpm --force [mysql2 ~]# systemctl start mysqld   No need to run mysql_updgrade as we are using MySQL 8.0.16 ! 😁 Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 83 / 230
  • 84. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 84/230 LAB7: Add mysql2 to the group (2) mysql-js> dba.con gureInstance('clusteradmin@mysql2') Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 84 / 230
  • 85. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 85/230 LAB7: Add mysql2 to the group (2) mysql-js> dba.con gureInstance('clusteradmin@mysql2') In case you don´t have the cluster object in your shell anymore, you can still retrieve it: mysql-js> c clusteradmin@mysql3 mysql-js> cluster = dba.getCluster() Add mysql2 to the cluster: mysql-js> cluster.checkInstanceState('clusteradmin@mysql2') mysql-js> cluster.addInstance("clusteradmin@mysql2") mysql-js> cluster.status() Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 85 / 230
  • 86. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 86/230 LAB7: Add mysql2 to the group (3) { "clusterName": "perconalive", "defaultReplicaSet": { "name": "default", "primary": "mysql3:3306", "ssl": "REQUIRED", "status": "OK", "statusText": "Cluster is ONLINE and can tolerate up to ONE failure.", "topology": { "mysql2:3306": { "address": "mysql2:3306", "mode": "R/O", "readReplicas": {}, "role": "HA", "status": "ONLINE" }, "mysql3:3306": { "address": "mysql3:3306", "mode": "R/W", "readReplicas": {}, "role": "HA", "status": "ONLINE" Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 86 / 230
  • 87. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 87/230 get more info Monitoring Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 87 / 230
  • 88. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 88/230 Performance Schema Group Replication uses Performance_Schema to expose status mysql3> SELECT * FROM performance_schema.replication_group_membersG *************************** 1. row *************************** CHANNEL_NAME: group_replication_applier MEMBER_ID: ade14d5c-9e1e-11e7-b034-08002718d305 MEMBER_HOST: mysql4 MEMBER_PORT: 3306 MEMBER_STATE: ONLINE MEMBER_ROLE: SECONDARY MEMBER_VERSION: 8.0.16 *************************** 2. row *************************** CHANNEL_NAME: group_replication_applier MEMBER_ID: b9d01593-9dfb-11e7-8ca6-08002718d305 MEMBER_HOST: mysql3 MEMBER_PORT: 3306 MEMBER_STATE: ONLINE MEMBER_ROLE: PRIMARY MEMBER_VERSION: 8.0.16 Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 88 / 230
  • 89. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 89/230 mysql3> SELECT * FROM performance_schema.replication_connection_statusG *************************** 1. row *************************** CHANNEL_NAME: group_replication_applier GROUP_NAME: 8fc848d7-9e1c-11e7-9407... SOURCE_UUID: 8fc848d7-9e1c-11e7-9407... THREAD_ID: NULL SERVICE_STATE: ON COUNT_RECEIVED_HEARTBEATS: 0 LAST_HEARTBEAT_TIMESTAMP: 0000-00-00 00:00:00 RECEIVED_TRANSACTION_SET: 8fc848d7-9e1c-11e7-9407... b9d01593-9dfb-11e7-8ca6-08002718d305:1-21, da2f0910-8767-11e6-b82d-08002718d305:1-164741 LAST_ERROR_NUMBER: 0 LAST_ERROR_MESSAGE: LAST_ERROR_TIMESTAMP: 0000-00-00 00:00:00 LAST_QUEUED_TRANSACTION: 8fc848d7-9e1c-11e7-9407... LAST_QUEUED_TRANSACTION_ORIGINAL_COMMIT_TIMESTAMP: 0000-00-00 00:00:00 LAST_QUEUED_TRANSACTION_IMMEDIATE_COMMIT_TIMESTAMP: 0000-00-00 00:00:00 LAST_QUEUED_TRANSACTION_START_QUEUE_TIMESTAMP: 2017-09-20 16:22:36.486... LAST_QUEUED_TRANSACTION_END_QUEUE_TIMESTAMP: 2017-09-20 16:22:36.486... QUEUEING_TRANSACTION: QUEUEING_TRANSACTION_ORIGINAL_COMMIT_TIMESTAMP: 0000-00-00 00:00:00 QUEUEING_TRANSACTION_IMMEDIATE_COMMIT_TIMESTAMP: 0000-00-00 00:00:00 QUEUEING_TRANSACTION_START_QUEUE_TIMESTAMP: 0000-00-00 00:00:00 Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 89 / 230
  • 90. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 90/230 Member State These 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 stop UNREACHABLE Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 90 / 230
  • 91. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 91/230 Status information & metrics Members mysql> select member_host, member_state, member_role, member_version from performance_schema.replication_group_members; +-------------+--------------+-------------+----------------+ | member_host | member_state | member_role | member_version | +-------------+--------------+-------------+----------------+ | mysql3 | ONLINE | PRIMARY | 8.0.16 | | mysql4 | ONLINE | SECONDARY | 8.0.16 | | mysql2 | ONLINE | SECONDARY | 8.0.16 | +-------------+--------------+-------------+----------------+ Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 91 / 230
  • 92. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 92/230 Status information & metrics - connections To see group_replication_applier and group_replication_recovery: mysql> SELECT * FROM performance_schema.replication_connection_statusG 8.0 Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 92 / 230
  • 93. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 93/230 Status information & metrics Previously there were only local node statistics, now they are exposed all over the Group mysql> select * from performance_schema.replication_group_member_statsG Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 93 / 230
  • 94. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 94/230 Status information & metrics Previously there were only local node statistics, now they are exposed all over the Group mysql> select * from performance_schema.replication_group_member_statsG *************************** 1. row *************************** CHANNEL_NAME: group_replication_applier VIEW_ID: 15059231192196925:2 MEMBER_ID: ade14d5c-9e1e-11e7-b034-08002... COUNT_TRANSACTIONS_IN_QUEUE: 0 COUNT_TRANSACTIONS_CHECKED: 27992 COUNT_CONFLICTS_DETECTED: 0 COUNT_TRANSACTIONS_ROWS_VALIDATING: 0 TRANSACTIONS_COMMITTED_ALL_MEMBERS: 8fc848d7-9e1c-11e7-9407-08002... b9d01593-9dfb-11e7-8ca6-08002718d305:1-21, da2f0910-8767-11e6-b82d-08002718d305:1-164741 LAST_CONFLICT_FREE_TRANSACTION: 8fc848d7-9e1c-11e7-9407-08002... COUNT_TRANSACTIONS_REMOTE_IN_APPLIER_QUEUE: 0 COUNT_TRANSACTIONS_REMOTE_APPLIED: 27992 COUNT_TRANSACTIONS_LOCAL_PROPOSED: 0 Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 94 / 230
  • 95. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 95/230 *************************** 2. row *************************** CHANNEL_NAME: group_replication_applier VIEW_ID: 15059231192196925:2 MEMBER_ID: b9d01593-9dfb-11e7-8ca6-08002... COUNT_TRANSACTIONS_IN_QUEUE: 0 COUNT_TRANSACTIONS_CHECKED: 28000 COUNT_CONFLICTS_DETECTED: 0 COUNT_TRANSACTIONS_ROWS_VALIDATING: 0 TRANSACTIONS_COMMITTED_ALL_MEMBERS: 8fc848d7-9e1c-11e7-9407-08002... b9d01593-9dfb-11e7-8ca6-08002718d305:1-21, da2f0910-8767-11e6-b82d-08002718d305:1-164741 LAST_CONFLICT_FREE_TRANSACTION: 8fc848d7-9e1c-11e7-9407-08002... COUNT_TRANSACTIONS_REMOTE_IN_APPLIER_QUEUE: 0 COUNT_TRANSACTIONS_REMOTE_APPLIED: 1 COUNT_TRANSACTIONS_LOCAL_PROPOSED: 28000 COUNT_TRANSACTIONS_LOCAL_ROLLBACK: 0 Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 95 / 230
  • 96. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 96/230 Performance_Schema You 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 @ 2019 Oracle and/or its affiliates. All rights reserved. 96 / 230
  • 97. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 97/230 Get the info from the MySQL Shell It´s also possible to get more info using the Shell: mysql-js> cluster.status({extended: true}) Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 97 / 230
  • 98. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 98/230 Get the info from the MySQL Shell It´s also possible to get more info using the Shell: mysql-js> cluster.status({extended: true}) In the next release you will also be able to see info from each members: mysql-js> cluster.status({queryMembers: true}) Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 98 / 230
  • 99. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 99/230 Status during recovery mysql> SHOW SLAVE STATUS FOR CHANNEL 'group_replication_recovery'G Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 99 / 230
  • 100. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 100/230 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 @ 2019 Oracle and/or its affiliates. All rights reserved. 100 / 230
  • 101. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 101/230 Sys Schema The easiest way to detect if a node is a member of the primary component (when there are partitioning of your nodes due to network issues for example) and therefore a valid candidate for routing queries to it, is to use the sys table. Additional information for sys can be found at https://goo.gl/XFp3bt On the primary node: [mysql3 ~]# mysql < /root/addition_to_sys_8.0.2.sql Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 101 / 230
  • 102. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 102/230 Sys Schema Is this node part of PRIMARY Partition: mysql3> SELECT sys.gr_member_in_primary_partition(); +------------------------------------+ | sys.gr_node_in_primary_partition() | +------------------------------------+ | YES | +------------------------------------+ Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 102 / 230
  • 103. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 103/230 Sys Schema Is 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 @ 2019 Oracle and/or its affiliates. All rights reserved. 103 / 230
  • 104. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 104/230 LAB8: Sys Schema - Health Check On one of the non Primary nodes, run the following command: mysql-sql> ush tables with read lock; Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 104 / 230
  • 105. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 105/230 LAB8: Sys Schema - Health Check On 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 @ 2019 Oracle and/or its affiliates. All rights reserved. 105 / 230
  • 106. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 106/230 LAB8: Sys Schema - Health Check On 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 @ 2019 Oracle and/or its affiliates. All rights reserved. 106 / 230
  • 107. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 107/230 LAB9: Reporting in MySQL Shell 8.0.16 Since 8.0.16, it´s possible in MySQL Shell to create User Defined Reports. We will create a report to monitor the asynchronous replication used in the recovery channel and see the progress of it. Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 107 / 230
  • 108. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 108/230 LAB9: Reporting in MySQL Shell 8.0.16 Since 8.0.16, it´s possible in MySQL Shell to create User Defined Reports. We will create a report to monitor the asynchronous replication used in the recovery channel and see the progress of it. Let´s start by stopping group replication on mysql2: mysql2> stop group_replication; Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 108 / 230
  • 109. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 109/230 LAB9: Reporting in MySQL Shell 8.0.16 (2) Now it´s time to create the folder where the User Defined Reports can be installed: # mkdir ~/.mysqlsh/init.d # cd ~/.mysqlsh/init.d And we can download the report: wget https://tinyurl.com/gr-recovery -O gr_recovery_progress.py Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 109 / 230
  • 110. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 110/230 LAB9: Reporting in MySQL Shell 8.0.16 (2) Now it´s time to create the folder where the User Defined Reports can be installed: # mkdir ~/.mysqlsh/init.d # cd ~/.mysqlsh/init.d And we can download the report: wget https://tinyurl.com/gr-recovery -O gr_recovery_progress.py mysqlsh clusteradmin@mysql2 mysql-js> show Available reports: gr_recovery_progress, query. Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 110 / 230
  • 111. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 111/230 LAB9: Reporting in MySQL Shell 8.0.16 (3) Now we can put back mysql2 in the group and use the new report query: mysql-js> sql start group_replication mysql-js> show gr_recovery_progress +----------------+ | trx_to_recover | +----------------+ | 8673 | +----------------+ You can also try watch gr_recovery_progress Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 111 / 230
  • 112. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 112/230 Connecting to the cluster MySQL Router Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 112 / 230
  • 113. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 113/230 MySQL Router MySQL Router is lightweight middleware that provides transparent routing between your application and backend MySQL Servers. It can be used for a wide variety of use cases, such as providing high availability and scalability by effectively routing database traffic to appropriate backend MySQL Servers. Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 113 / 230
  • 114. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 114/230 MySQL Router MySQL Router is lightweight middleware that provides transparent routing between your application and backend MySQL Servers. It can be used for a wide variety of use cases, such as providing high availability and scalability by effectively routing database traffic to appropriate backend MySQL Servers. MySQL Router doesn´t require any specific configuration. It configures itself automatically (bootstrap) using MySQL InnoDB Cluster ´s metadata. Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 114 / 230
  • 115. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 115/230 LAB10: MySQL Router We will now use mysqlrouter between our application and the cluster. Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 115 / 230
  • 116. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 116/230 LAB10: MySQL Router (2) Configure MySQL Router that will run on the app server (mysql1). We bootstrap it using the Primary-Master: [root@mysql1 ˜]# mysqlrouter --bootstrap clusteradmin@mysql3:3306 --user mysqlrouter Please enter MySQL password for clusteradmin: Bootstrapping system MySQL Router instance... Checking for old Router accounts Creating account mysql_router1_rvbecwmlc6uf@'%' MySQL Router has now been con gured for the InnoDB cluster 'perconalive'. The following connection information can be used to connect to the cluster after MySQL Router has been started with generated con guration.. Classic MySQL protocol connections to cluster 'perconalive': - Read/Write Connections: localhost:6446 - Read/Only Connections: localhost:6447 X protocol connections to cluster 'perconalive': - Read/Write Connections: localhost:64460 - Read/Only Connections: localhost:64470 Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 116 / 230
  • 117. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 117/230 LAB10: MySQL Router (3) Now let´s modify the configuration file to listen on port 3306: Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 117 / 230
  • 118. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 118/230 LAB10: MySQL Router (3) Now let´s modify the configuration file to listen on port 3306: in /etc/mysqlrouter/mysqlrouter.conf: [routing:perconalive_default_rw] -bind_port=6446 +bind_port=3306 Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 118 / 230
  • 119. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 119/230 LAB10: MySQL Router (3) Now let´s modify the configuration file to listen on port 3306: in /etc/mysqlrouter/mysqlrouter.conf: [routing:perconalive_default_rw] -bind_port=6446 +bind_port=3306 We can stop mysqld on mysql1 and start mysqlrouter: [mysql1 ~]# systemctl stop mysqld [mysql1 ~]# systemctl start mysqlrouter Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 119 / 230
  • 120. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 120/230 LAB10: MySQL Router (5) Now we can point the application to the router (back to mysql1): [mysql1 ~]# run_app.sh Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 120 / 230
  • 121. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 121/230 LAB10: MySQL Router (5) Now we can point the application to the router (back to mysql1): [mysql1 ~]# run_app.sh Check app and kill mysqld on mysql3 (the Primary Master R/W node) ! [mysql3 ~]# failure-scenario.sh kill-node Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 121 / 230
  • 122. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 122/230 LAB10: MySQL Router (5) Now we can point the application to the router (back to mysql1): [mysql1 ~]# run_app.sh Check app and kill mysqld on mysql3 (the Primary Master R/W node) ! [mysql3 ~]# failure-scenario.sh kill-node mysql2> select member_host as `primary` from performance_schema.replication_group_members where member_role='PRIMARY'; +----------+ | primary | +----------+ | mysql4 | +----------+ Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 122 / 230
  • 123. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 123/230 ProxySQL / HA Proxy / F5 / ... 3rd party router/proxy Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 123 / 230
  • 124. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 124/230 3rd party router/proxy MySQL InnoDB Cluster can also work with third party router / proxy. Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 124 / 230
  • 125. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 125/230 3rd party router/proxy MySQL InnoDB Cluster can also work with third party router / proxy. If you need some specific features that are not yet available in MySQL Router, like transparent R/W splitting, then you can use your software of choice. Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 125 / 230
  • 126. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 126/230 3rd party router/proxy MySQL InnoDB Cluster can also work with third party router / proxy. If you need some specific features that are not yet available in MySQL Router, like transparent R/W splitting, then you can use your software of choice. The important part of such implementation is to use a good health check to verify if the MySQL server you plan to route the traffic is in a valid state. Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 126 / 230
  • 127. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 127/230 3rd party router/proxy MySQL InnoDB Cluster can also work with third party router / proxy. If you need some specific features that are not yet available in MySQL Router, like transparent R/W splitting, then you can use your software of choice. The important part of such implementation is to use a good health check to verify if the MySQL server you plan to route the traffic is in a valid state. MySQL Router implements that natively, and it´s very easy to deploy. Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 127 / 230
  • 128. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 128/230 ProxySQL also has native support for Group Replication which makes it maybe the best choice for advanced users. 3rd party router/proxy MySQL InnoDB Cluster can also work with third party router / proxy. If you need some specific features that are not yet available in MySQL Router, like transparent R/W splitting, then you can use your software of choice. The important part of such implementation is to use a good health check to verify if the MySQL server you plan to route the traffic is in a valid state. MySQL Router implements that natively, and it´s very easy to deploy. Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 128 / 230
  • 129. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 129/230 operational tasks Recovering Node Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 129 / 230
  • 130. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 130/230 Recovering Nodes/Members The old master (mysql3) got killed. Start it again: mysql3# systemctl start mysqld The node will automatically join the group again Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 130 / 230
  • 131. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 131/230 You know... There are ways... Various Configuration Options Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 131 / 230
  • 132. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 132/230 Various Configuration Options Single & Multiple Primary Mode Network Partitions What to do? when will a node leave? when will a node be expelled? what should a node do when it´s gone? Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 132 / 230
  • 133. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 133/230 Default = Single Primary Mode By default, MySQL InnoDB Cluster enables Single Primary Mode. Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 133 / 230
  • 134. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 134/230 Default = Single Primary Mode By 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 @ 2019 Oracle and/or its affiliates. All rights reserved. 134 / 230
  • 135. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 135/230 Default = Single Primary Mode By 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 the rest of the members act as hot- standbys (SECONDARY). The group itself coordinates and configures itself automatically to determine which member will act as the PRIMARY, through a leader election mechanism. Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 135 / 230
  • 136. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 136/230 Who´s the Primary Master ? You can already see it in the output of cluster.status() Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 136 / 230
  • 137. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 137/230 Who´s the Primary Master ? You can already see it in the output of cluster.status() But you can also check in performance_schema: mysql> select member_host from performance_schema.replication_group_members where member_role='PRIMARY'; +-------------+ | member_host | +-------------+ | mysql3 | +-------------+ Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 137 / 230
  • 138. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 138/230 Create a Multi-Primary Cluster: It´s also possible to create a Multi-Primary Cluster using the Shell: mysql-js> cluster=dba.createCluster('perconalive',{multiMaster: true}) Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 138 / 230
  • 139. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 139/230 Create a Multi-Primary Cluster: It´s also possible to create a Multi-Primary Cluster using the Shell: mysql-js> cluster=dba.createCluster('perconalive',{multiMaster: true}) A new InnoDB cluster will be created on instance 'clusteradmin@mysql3:3306'. The MySQL InnoDB cluster is going to be setup in advanced Multi-Master Mode. Before continuing you have to con rm that you understand the requirements and limitations of Multi-Master Mode. Please read the manual before proceeding. I have read the MySQL InnoDB cluster manual and I understand the requirements and limitations of advanced Multi-Master Mode. Con rm [y|N]: Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 139 / 230
  • 140. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 140/230 Create a Multi-Primary Cluster: It´s also possible to create a Multi-Primary Cluster using the Shell: mysql-js> cluster=dba.createCluster('perconalive',{multiMaster: true}) A new InnoDB cluster will be created on instance 'clusteradmin@mysql3:3306'. The MySQL InnoDB cluster is going to be setup in advanced Multi-Master Mode. Before continuing you have to con rm that you understand the requirements and limitations of Multi-Master Mode. Please read the manual before proceeding. I have read the MySQL InnoDB cluster manual and I understand the requirements and limitations of advanced Multi-Master Mode. Con rm [y|N]: Or you can force it to avoid interaction (for automation) : Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 140 / 230
  • 141. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 141/230 Create a Multi-Primary Cluster: It´s also possible to create a Multi-Primary Cluster using the Shell: mysql-js> cluster=dba.createCluster('perconalive',{multiMaster: true}) A new InnoDB cluster will be created on instance 'clusteradmin@mysql3:3306'. The MySQL InnoDB cluster is going to be setup in advanced Multi-Master Mode. Before continuing you have to con rm that you understand the requirements and limitations of Multi-Master Mode. Please read the manual before proceeding. I have read the MySQL InnoDB cluster manual and I understand the requirements and limitations of advanced Multi-Master Mode. Con rm [y|N]: Or you can force it to avoid interaction (for automation) : > cluster=dba.createCluster('perconalive',{multiMaster: true, force: true}) Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 141 / 230
  • 142. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 142/230 Dynamically change to Multi Primary Mode (UDFs) Change to/from single primary mode online: mysql3> SELECT group_replication_switch_to_multi_primary_mode(); mysql3> SELECT group_replication_switch_to_single_primary_mode(); Choose primary node mysql3> SELECT group_replication_set_as_primary(server_uuid); Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 142 / 230
  • 143. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 143/230 Dynamically change to Multi Primary Mode (UDFs) mysql3> SELECT group_replication_switch_to_multi_primary_mode(); +--------------------------------------------------+ | group_replication_switch_to_multi_primary_mode() | +--------------------------------------------------+ | Mode switched to multi-primary successfully. | +--------------------------------------------------+ mysql3> select member_host from performance_schema.replication_group_members where member_role='PRIMARY'; +-------------+ | member_host | +-------------+ | mysql2 | | mysql3 | | mysql4 | +-------------+ Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 143 / 230
  • 144. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 144/230 Dynamically change Mode: UDFs VS Metadata However, this should be done from the MySQL Shell to avoid metadata inconsistencies. Try to get the cluster status: JS> cluster.status() Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 144 / 230
  • 145. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 145/230 Dynamically change Mode: UDFs VS Metadata However, this should be done from the MySQL Shell to avoid metadata inconsistencies. Try to get the cluster status: JS> cluster.status() What do you see ? Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 145 / 230
  • 146. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 146/230 Dynamically change Mode: UDFs VS Metadata However, this should be done from the MySQL Shell to avoid metadata inconsistencies. Try to get the cluster status: JS> cluster.status() What do you see ? Fix it: JS> cluster.rescan() JS> cluster.status() Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 146 / 230
  • 147. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 147/230 Dynamically change to Single Primary Mode - Shell Switch back to Single Primary Mode: JS> cluster.switchToSinglePrimaryMode() JS> cluster.status() Other MySQL Shell syntax: (do not execute !) JS> cluster.setPrimaryInstance('mysql1:3306') JS> cluster.switchToMultiPrimaryMode() Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 147 / 230
  • 148. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 148/230 Network Partitions What happens when mysql4 is being network partitioned? Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 148 / 230
  • 149. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 149/230 Network Partitions - Quorum Calculations 3 notes, each 1 vote. Majority is when a partition sees +50% Minority is when a partition sees <=50% Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 149 / 230
  • 150. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 150/230 Network Partitions - Quorum Calculations 3 notes, each 1 vote. Majority is when a partition sees +50% Minority is when a partition sees <=50% mysql2 and mysql3 can still connect to eachother, 2 votes out of 3 = 66% = MAJORITY mysql4 can only see itself, 1 vote out of 3 = 33% = MINORITY Majority network partition is mysql2 and mysql3 Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 150 / 230
  • 151. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 151/230 Network Partitions - Quorum Calculations With even amount of nodes: it is possible to have 50% for each partition both will have minority Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 151 / 230
  • 152. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 152/230 Network Partitions - Actions by Majority mysql2 and mysql3 actions: 1. wait 5 seconds, then suspect mysql4 is gone 2. expel mysql4 after group_replication_member_expel_timeout seconds (default 0, immediately) do not put the variable too high, between suspect and expel members cannot be added/removed no new leader can be elected Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 152 / 230
  • 153. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 153/230 Network Partitions - Actions by Minority mysql4 actions: 1. wait 5 seconds before suspecting itself to lost connection to the majority 2. wait group_replication_unreachable_majority_timeout (default 0, forever) 3. when timeout: group_replication_autorejoin_tries (default 0 times) retries every 5 minutes 4. Only then group_replication_exit_state_action READ_ONLY: allow stale reads to be served (latest default) ABORT_SERVER: Shutdown MySQL Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 153 / 230
  • 154. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 154/230 LAB11: Network Partitions - Default Let´s network partition mysql4! Check logs (we have log_error_verbosity=3) mysql3# tail -f /var/log/mysqld.log & mysql4# tail -f /var/log/mysqld.log & On mysql4, run: mysql4# failure-scenario.sh network-partition begin Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 154 / 230
  • 155. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 155/230 LAB11: Network Partitions - Default mysql3 '[GCS] Installed site start={ed88d526 1339 0} boot_key={ed88d526 1328 0} event_horizon=10 node 1' '[GCS] Group is able to support up to communication protocol version 8.0.16' 'Members removed from the group: mysql4:3306' 'Group membership changed to mysql3:3306, mysql2:3306 on view 1557809996177 '[GCS] Failure reading from fd=-1 n=18446744073709551615' mysql4 'Member with address mysql2:3306 has become unreachable.' 'Member with address mysql3:3306 has become unreachable.' 'This server is not able to reach a majority of members in the group. This server will now block all updates. The server will remain blocked until contact with the majority is restored. It is possible to use group_replication_force_members to force a new group membership.' Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 155 / 230
  • 156. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 156/230 LAB11: Network Partition - Default mysql4# failure-scenario.sh network-partition end Does the node come back? Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 156 / 230
  • 157. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 157/230 LAB11: Network Partition - Default mysql4# failure-scenario.sh network-partition end Does the node come back? NO: it was expelled: 'Member with address mysql2:3306 is reachable again.' 'Member with address mysql3:3306 is reachable again.' 'The member has resumed contact with a majority of the members in the group. Regular operation is restored and transactions are unblocked.' '[GCS] Re-using server node 0 host mysql2' '[GCS] Re-using server node 1 host mysql3' '[GCS] Installed site start={ed88d526 1339 0} boot_key={ed88d526 1328 0} event_horizon=10 node 4294967295' '[GCS] Node has already been removed: mysql4:33061 15578108329721490.' 'Member was expelled from the group due to network failures, changing member status to ERROR.' Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 157 / 230
  • 158. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 158/230 LAB11: Network Partition - Default Fix with shell: JS>cluster.rejoinInstance('clusteradmin@mysql4') Rejoining the instance to the InnoDB cluster. Depending on the original problem that made the instance unavailable, the rejoin operation might not be successful and further manual steps will be needed to x the underlying problem. Please monitor the output of the rejoin operation and take necessary action if the instance cannot rejoin. Rejoining instance to the cluster ... The instance 'mysql4' was successfully rejoined on the cluster. Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 158 / 230
  • 159. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 159/230 LAB12: Network Partitions - With Retries Let´s try again, but let´s configure retries: mysql4> SET GLOBAL group_replication_autorejoin_tries=2; # default is 0 mysql4# failure-scenario.sh network-partition begin && sleep 10 && failure-scenario.sh network-partition end Did mysql4 join the group again? Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 159 / 230
  • 160. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 160/230 LAB12: Network Partitions - With Retries Did mysql4 join the group again? YES! 'Member with address mysql2:3306 is reachable again.' 'The member has resumed contact with a majority of the members in the group. Regular operation is restored and transactions are unblocked.' 'Member with address mysql3:3306 is reachable again.' '[GCS] Re-using server node 0 host mysql2' '[GCS] Re-using server node 1 host mysql3' '[GCS] Installed site start={ed88d526 2445 0} boot_key={ed88d526 2434 0} event_horizon=10 node 4294967295' '[GCS] Node has already been removed: mysql4:33061 15578118987619030.' 'Member was expelled from the group due to network failures, changing member status to ERROR.' 'Started auto-rejoin procedure attempt 1 of 2' ... 'This server was declared online within the replication group.' Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 160 / 230
  • 161. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 161/230 LAB12: Network Partitions - monitoring auto-rejoin It´s possible to verify if there is an auto-rejoin: SELECT COUNT(*) FROM performance_schema.events_stages_current WHERE EVENT_NAME LIKE '%auto-rejoin%'; View the amount of retries so far: SELECT WORK_COMPLETED FROM performance_schema.events_stages_current WHERE EVENT_NAME LIKE '%auto-rejoin%'; Estimated time remaining until next retry: SELECT (300.0 - ((TIMER_WAIT*10e-12) - 300.0 * num_retries)) AS time_remaining FROM (SELECT COUNT(*) - 1 AS num_retries FROM performance_schema.events_stages_current WHERE EVENT_NAME LIKE '%auto-rejoin%') AS T, performance_schema.events_stages_current WHERE EVENT_NAME LIKE '%auto-rejoin%'; Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 161 / 230
  • 162. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 162/230 be aware of the behavior change & take control Application Behavior & Consistency Guarantees Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 162 / 230
  • 163. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 163/230 Application Behavior & Consistency Guarantees Group Conflicts Configurable Consistency Guarantees Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 163 / 230
  • 164. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 164/230 Group Conflicts Local vs. Group: Local Conflicts are handled using InnoDB's row locking. Conflicts between different nodes are handled with "first committer wins!" Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 164 / 230
  • 165. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 165/230 Group Conflicts Local vs. Group: Local Conflicts are handled using InnoDB's row locking. Conflicts between different nodes are handled with "first committer wins!" Group Conflicts: happen only in Multi-Primary Mode happen if 2 transactions are updating/deleting the same records on two different members of the group, will be detected only during group certification (after at least one has committed) (Optimistic Locking) Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 165 / 230
  • 166. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 166/230 LAB13: Group Conflicts Let´s see this in action ! First switch to Multi-Primary Mode: mysql-js> cluster.switchToMultiPrimaryMode() Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 166 / 230
  • 167. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 167/230 LAB13: Group Conflicts Let´s see this in action ! First switch to Multi-Primary Mode: mysql-js> cluster.switchToMultiPrimaryMode() Now on mysql2 start the following transaction: mysql2> start transaction; mysql2> update app.sbtest1 set k=k+50000 where id = 2000; Note that we don't commit the transaction yet Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 167 / 230
  • 168. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 168/230 LAB13: Group Conflicts (2) Now on mysql4 we also create a new transaction: mysql4> start transaction; mysql4> update app.sbtest1 set k=k+200 where id > 1999 and id < 2010; Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 168 / 230
  • 169. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 169/230 LAB13: Group Conflicts (2) Now on mysql4 we also create a new transaction: mysql4> start transaction; mysql4> update app.sbtest1 set k=k+200 where id > 1999 and id < 2010; Now commit the one in mysql4: mysql4> commit; Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 169 / 230
  • 170. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 170/230 LAB13: Group Conflicts (3) What do you see on mysql2 ´s session ? Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 170 / 230
  • 171. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 171/230 LAB13: Group Conflicts (3) What do you see on mysql2 ´s session ? If you try any statement you will see: ERROR: 1213: Deadlock found when trying to get lock; try restarting transaction If you try to commit you will see: ERROR: 1180: Got error 149 - 'Lock deadlock; Retry transaction' during COMMIT This happens because a conflict was detected during certification ! Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 171 / 230
  • 172. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 172/230 Group Conflicts (4) 2 types of Group Conflicts: Conflicts detected by InnoDB high priority transactions (previous lab) Conflicts detected by Group Replication: Commit 2 transactions at almost the same time: ERROR 3101 (40000): Plugin instructed the server to rollback the current transaction. Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 172 / 230
  • 173. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 173/230 Group Conflicts (5) Check these in Performance_Schema (or using cluster.status({extended: true}): SELECT MEMBER_ID,COUNT_CONFLICTS_DETECTED,COUNT_TRANSACTIONS_LOCAL_ROLLBACK FROM performance_schema.replication_group_member_statsG *************************** 1. row *************************** MEMBER_ID: 130942a7-75c4-11e9-b75d-08002718d305 COUNT_CONFLICTS_DETECTED: 1 COUNT_TRANSACTIONS_LOCAL_ROLLBACK: 0 *************************** 2. row *************************** MEMBER_ID: 265d96f7-7333-11e9-b4c9-08002718d305 COUNT_CONFLICTS_DETECTED: 1 COUNT_TRANSACTIONS_LOCAL_ROLLBACK: 1 *************************** 3. row *************************** MEMBER_ID: 6361b4e3-75c2-11e9-851b-08002718d305 COUNT_CONFLICTS_DETECTED: 1 COUNT_TRANSACTIONS_LOCAL_ROLLBACK: 0 Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 173 / 230
  • 174. 5/25/2019 MySQL InnoDB Cluster and Group Replication in a Nutshell: Hands-On Tutorial file:///home/fred/workspace/MySQL-InnoDB-Cluster---Nutshell/MySQL InnoDB Cluster - Nutshell.html#226 174/230 Configurable Consistency Guarantees Default consistency guarantee is EVENTUAL if you write some data on nodeA, if you immediately read it on nodeB, it might be there... or not yet. Since MySQL 8.0.14, you can configure various transaction consistency guarantees mysql> show variables like 'group_replication_consistency'; +-------------------------------+----------+ | Variable_name | Value | +-------------------------------+----------+ | group_replication_consistency | EVENTUAL | +-------------------------------+----------+ Copyright @ 2019 Oracle and/or its affiliates. All rights reserved. 174 / 230