SlideShare a Scribd company logo
1 / 63
2 / 63
MySQL InnoDB Cluster in a Nutshell:
Hands-On Tutorial HOL7316
   
Oracle OpenWorld 2017
 
 
Frédéric Descamps - MySQL Community Manager - Oracle
Matt Lord - MySQL Product Manager - Oracle
3 / 63
 
Safe Harbor Statement
The following is intended to outline our general product direction. It is intended for
information purpose only, and may not be incorporated into any contract. It is not a
commitment to deliver any material, code, or functionality, and should not be relied up in
making purchasing decisions. The development, release and timing of any features or
functionality described for Oracle´s product remains at the sole discretion of Oracle.
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
4 / 63
Who are we ?
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
5 / 63
Matt Lord
@mattalord
MySQL Product Manager
living in USA 󾓦
 
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
6 / 63
Frédéric Descamps
@lefred
MySQL Evangelist
Managing MySQL since 3.23
devops believer
living in Belgium 🇧🇪
http://about.me/lefred
 
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
7 / 63
ready ?
agenda
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
8 / 63
Agenda
Prepare your workstation
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
9 / 63
Agenda
Prepare your workstation
Install your first cluster
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
10 / 63
VirtualBox
Setup your workstation
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
11 / 63
Setup your workstation
boot your VM(HOL7316)
login to your VMusing
login: oracle
password: oracle
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
12 / 63
LAB1: MySQL Shell
start the shell:
[holuser@localhost]$ mysqlsh
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
13 / 63
LAB1: MySQL Shell
start the shell:
[holuser@localhost]$ mysqlsh
Change between JavaScript, Python and SQL mode
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
14 / 63
LAB1: MySQL Shell
start the shell:
[holuser@localhost]$ mysqlsh
Change between JavaScript, Python and SQL mode
get the Admin API's help
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
15 / 63
Easy High Availability
MySQL InnoDB Cluster
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
16 / 63
InnoDB
cluster
Ease-of-Use
Extreme Scale-Out
Out-of-Box Solution
Built-in HA
High Performance
Everything Integrated
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
17 / 63
InnoDB Cluster's Architecture
Application
MySQL Connector
MySQL Router
MySQL Shell
InnoDB
cluster
Application
MySQL Connector
MySQL Router
Mp
M
M
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
18 / 63
Group Replication: heart of MySQL InnoDB
Cluster
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
19 / 63
Group Replication: heart of MySQL InnoDB
Cluster
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
20 / 63
MySQL Group Replication
but what is it ?!?
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
21 / 63
MySQL Group Replication
but what is it ?!?
GR is a plugin for MySQL, made by MySQL and packaged with MySQL
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
22 / 63
MySQL Group Replication
but what is it ?!?
GR is a plugin for MySQL, made by MySQL and packaged with MySQL
GR is an implementation of Replicated Database State Machine theory
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
23 / 63
MySQL Group Replication
but what is it ?!?
GR is a plugin for MySQL, made by MySQL and packaged with MySQL
GR is an implementation of Replicated Database State Machine theory
Paxos based protocol
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
24 / 63
MySQL Group Replication
but what is it ?!?
GR is a plugin for MySQL, made by MySQL and packaged with MySQL
GR is an implementation of Replicated Database State Machine theory
Paxos based protocol
GR allows to write on all Group Members (cluster nodes) simultaneously while
retaining consistency
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
25 / 63
MySQL Group Replication
but what is it ?!?
GR is a plugin for MySQL, made by MySQL and packaged with MySQL
GR is an implementation of Replicated Database State Machine theory
Paxos based protocol
GR allows to write on all Group Members (cluster nodes) simultaneously while
retaining consistency
GR implements conflict detection and resolution
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
26 / 63
MySQL Group Replication
but what is it ?!?
GR is a plugin for MySQL, made by MySQL and packaged with MySQL
GR is an implementation of Replicated Database State Machine theory
Paxos based protocol
GR allows to write on all Group Members (cluster nodes) simultaneously while
retaining consistency
GR implements conflict detection and resolution
GR allows automatic distributed recovery
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
27 / 63
MySQL Group Replication
but what is it ?!?
GR is a plugin for MySQL, made by MySQL and packaged with MySQL
GR is an implementation of Replicated Database State Machine theory
Paxos based protocol
GR allows to write on all Group Members (cluster nodes) simultaneously while
retaining consistency
GR implements conflict detection and resolution
GR allows automatic distributed recovery
Supported on all MySQL platforms !!
Linux, Windows, Solaris, OSX, FreeBSD
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
28 / 63
And for users ?
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
29 / 63
And for users ?
not longer necessary to handle server fail-over manually or with a complicated script
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
30 / 63
And for users ?
not longer necessary to handle server fail-over manually or with a complicated script
GR provides fault tolerance
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
31 / 63
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 @ 2017 Oracle and/or its affiliates. All rights reserved.
32 / 63
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 @ 2017 Oracle and/or its affiliates. All rights reserved.
33 / 63
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 @ 2017 Oracle and/or its affiliates. All rights reserved.
34 / 63
ready ?
Sanbdox instances
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
35 / 63
MySQL Instances:
Deploy 3 sandbox instances using these ports:
instance1: 4306
instance2: 4406
instance3: 4506
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
36 / 63
MySQL Instances:
Deploy 3 sandbox instances using these ports:
instance1: 4306
instance2: 4406
instance3: 4506
MySQL-JS> dba.deploySandboxInstance(4306)
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
37 / 63
configuration
Verify the instances
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
38 / 63
Instance Configuration
Validate the configuration using the Shell:
MySQL-JS> dba.checkInstanceCon guration('root@localhost:4406')
MySQL-JS> dba.checkInstanceCon guration('root@localhost:4506')
MySQL-JS> dba.checkInstanceCon guration('root@localhost:4606')
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
39 / 63
Instance Configuration
Validate the configuration using the Shell:
MySQL-JS> dba.checkInstanceCon guration('root@localhost:4406')
MySQL-JS> dba.checkInstanceCon guration('root@localhost:4506')
MySQL-JS> dba.checkInstanceCon guration('root@localhost:4606')
Check on the board what could happen
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
40 / 63
going HA
Create the InnoDB Cluster
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
41 / 63
MySQL InnoDB Cluster
Connect to one instance and create a cluster fromit
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
42 / 63
MySQL InnoDB Cluster
Connect to one instance and create a cluster fromit
MySQL-JS> c root@localhost:4406
MySQL-JS> cluster=dba.createCluster('oow17')
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
43 / 63
MySQL InnoDB Cluster
Connect to one instance and create a cluster fromit
MySQL-JS> c root@localhost:4406
MySQL-JS> cluster=dba.createCluster('oow17')
Check the status:
MySQL-JS> cluster.status()
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
44 / 63
Administration made easy and more...
MySQL-Shell Summary
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
45 / 63
MySQL Shell in Summary
The MySQL Shell is an interactive Javascript, Python, or SQL interface supporting
development and administration for MySQL. MySQL Shell includes the AdminAPI--available
in JavaScript and Python--which enables you to set up and manage InnoDB clusters. It
provides a modern and fluent API which hides the complexity associated with configuring,
provisioning, and managing an InnoDB cluster, without sacrificing power, flexibility, or
security.
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
46 / 63
Default = Single Primary Mode
By default, MySQL InnoDB Cluster enables Single Primary Mode.
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
47 / 63
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 @ 2017 Oracle and/or its affiliates. All rights reserved.
48 / 63
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 @ 2017 Oracle and/or its affiliates. All rights reserved.
49 / 63
Who´s the Primary Master ? old fashion style
As the Primary Master is elected, all nodes part of the group knows which one was
elected. This value is exposed in status variables:
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
50 / 63
Who´s the Primary Master ? old fashion style
As the Primary Master is elected, all nodes part of the group knows which one was
elected. This value is exposed in status variables:
mysql> show status like 'group_replication_primary_member';
+----------------------------------+--------------------------------------+
| Variable_name | Value |
+----------------------------------+--------------------------------------+
| group_replication_primary_member | 28a4e51f-860e-11e6-bdc4-08002718d305 |
+----------------------------------+--------------------------------------+
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
51 / 63
Who´s the Primary Master ? old fashion style
As the Primary Master is elected, all nodes part of the group knows which one was
elected. This value is exposed in status variables:
mysql> show status like 'group_replication_primary_member';
+----------------------------------+--------------------------------------+
| Variable_name | Value |
+----------------------------------+--------------------------------------+
| group_replication_primary_member | 28a4e51f-860e-11e6-bdc4-08002718d305 |
+----------------------------------+--------------------------------------+
mysql> select member_host as "primary master"
from performance_schema.global_status
join performance_schema.replication_group_members
where variable_name = 'group_replication_primary_member'
and member_id=variable_value;
+---------------+
| primary master|
+---------------+
| mysql3 |
+---------------+
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
52 / 63
Who´s the Primary Master ? new fashion style
mysql> select member_host
from performance_schema.replication_group_members
where member_role='PRIMARY';
+-------------+
| member_host |
+-------------+
| mysql3 |
+-------------+
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
53 / 63
Create a Multi-Primary Cluster:
It´s also possible to create a Multi-Primary Cluster using the Shell:
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
54 / 63
Create a Multi-Primary Cluster:
It´s also possible to create a Multi-Primary Cluster using the Shell:
mysql-js> cluster=dba.createCluster('oow17',{multiMaster: true})
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
55 / 63
Create a Multi-Primary Cluster:
It´s also possible to create a Multi-Primary Cluster using the Shell:
mysql-js> cluster=dba.createCluster('oow17',{multiMaster: true})
A new InnoDB cluster will be created on instance 'root@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 @ 2017 Oracle and/or its affiliates. All rights reserved.
56 / 63
Create a Multi-Primary Cluster:
It´s also possible to create a Multi-Primary Cluster using the Shell:
mysql-js> cluster=dba.createCluster('oow17',{multiMaster: true})
A new InnoDB cluster will be created on instance 'root@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 @ 2017 Oracle and/or its affiliates. All rights reserved.
57 / 63
Create a Multi-Primary Cluster:
It´s also possible to create a Multi-Primary Cluster using the Shell:
mysql-js> cluster=dba.createCluster('oow17',{multiMaster: true})
A new InnoDB cluster will be created on instance 'root@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('oow17',{multiMaster: true, force: true})
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
58 / 63
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 @ 2017 Oracle and/or its affiliates. All rights reserved.
59 / 63
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 @ 2017 Oracle and/or its affiliates. All rights reserved.
60 / 63
MySQL Router
Configure MySQL Router: we bootstrap it using the Primary-Master:
[root@mysql1 ~]# mysqlrouter --bootstrap localhost:4306 --user mysqlrouter
Please enter MySQL password for root:
WARNING: The MySQL server does not have SSL ...
Bootstrapping system MySQL Router instance...
MySQL Router has now been con gured for the InnoDB cluster 'oow17'.
The following connection information can be used to connect to the cluster.
Classic MySQL protocol connections to cluster 'oow17':
- Read/Write Connections: localhost:6446
- Read/Only Connections: localhost:6447
X protocol connections to cluster 'oow17':
- Read/Write Connections: localhost:64460
- Read/Only Connections: localhost:64470
[root@mysql1 ~]# chown -R mysqlrouter. /var/lib/mysqlrouter
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
61 / 63
MySQL Router (2)
Connect to MySQL using the MySQL Shell or MySQL client through the router (port 6446):
[root@mysql1 ~]# mysqlh root@localhost:6446 --sql
mysql-sql> select @@hostname, sleep(360);
Check in which node this query is running.
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
62 / 63
Thank you !
Any Questions ?
Copyright @ 2017 Oracle and/or its affiliates. All rights reserved.
63 / 63

More Related Content

PDF
MySQL Document Store - How to replace a NoSQL database by MySQL without effor...
PDF
MySQL Document Store - when SQL & NoSQL live together... in peace!
PDF
Introduction to MySQL InnoDB Cluster
PDF
FOSDEM MySQL & Friends Devroom, February 2018 MySQL Point-in-Time Recovery l...
PDF
MySQL InnoDB Cluster and Group Replication in a Nutshell
PDF
MySQL Community Meetup in China : Innovation driven by the Community
PDF
pre-FOSDEM MySQL day, February 2018 - MySQL Document Store
PDF
DataOps barcelona - MySQL 8.0 document store: NoSQL with all the benefits of ...
MySQL Document Store - How to replace a NoSQL database by MySQL without effor...
MySQL Document Store - when SQL & NoSQL live together... in peace!
Introduction to MySQL InnoDB Cluster
FOSDEM MySQL & Friends Devroom, February 2018 MySQL Point-in-Time Recovery l...
MySQL InnoDB Cluster and Group Replication in a Nutshell
MySQL Community Meetup in China : Innovation driven by the Community
pre-FOSDEM MySQL day, February 2018 - MySQL Document Store
DataOps barcelona - MySQL 8.0 document store: NoSQL with all the benefits of ...

What's hot (20)

PDF
DataOps Barcelona - MySQL HA so easy... that's insane !
PDF
Introduction to MySQL InnoDB Cluster
PDF
Introduction to MySQL InnoDB Cluster
PDF
MySQL User Group NL: MySQL 8.0 Document Store- NoSQL with all the benefits of...
PDF
MySQL InnoDB Cluster and Group Replication in a nutshell hands-on tutorial
PDF
MySQL Innovation: from 5.7 to 8.0
PDF
Introduction to MySQL Document Store
PDF
Introduction to MySQL InnoDB Cluster
PDF
Swedish MySQL User Group - MySQL InnoDB Cluster
PDF
Webinar Slides: MySQL HA/DR/Geo-Scale - High Noon #5: Oracle’s InnoDB Cluster
PDF
Oracle Open World 2018 / Code One : MySQL 8.0 Document Store
PDF
MySQL Innovation Day Chicago - MySQL HA So Easy : That's insane !!
PDF
High Availability in MySQL 8 using InnoDB Cluster
PDF
Inexpensive Datamasking for MySQL with ProxySQL - data anonymization for deve...
PDF
Oracle Open World 2018 / Code One : MySQL 8.0 High Availability with MySQL I...
PDF
MySQL innodb cluster and Group Replication in a nutshell - hands-on tutorial ...
PDF
Percona Live Europe 2018 MySQL Group Replication... the magic explained
PDF
MySQL InnoDB Cluster and Group Replication in a Nutshell: hands-on tutorial
PDF
Cloud native - Why to use MySQL 8.0 and how to use it on oci with MDS
PDF
From single MySQL instance to High Availability: the journey to MySQL InnoDB ...
DataOps Barcelona - MySQL HA so easy... that's insane !
Introduction to MySQL InnoDB Cluster
Introduction to MySQL InnoDB Cluster
MySQL User Group NL: MySQL 8.0 Document Store- NoSQL with all the benefits of...
MySQL InnoDB Cluster and Group Replication in a nutshell hands-on tutorial
MySQL Innovation: from 5.7 to 8.0
Introduction to MySQL Document Store
Introduction to MySQL InnoDB Cluster
Swedish MySQL User Group - MySQL InnoDB Cluster
Webinar Slides: MySQL HA/DR/Geo-Scale - High Noon #5: Oracle’s InnoDB Cluster
Oracle Open World 2018 / Code One : MySQL 8.0 Document Store
MySQL Innovation Day Chicago - MySQL HA So Easy : That's insane !!
High Availability in MySQL 8 using InnoDB Cluster
Inexpensive Datamasking for MySQL with ProxySQL - data anonymization for deve...
Oracle Open World 2018 / Code One : MySQL 8.0 High Availability with MySQL I...
MySQL innodb cluster and Group Replication in a nutshell - hands-on tutorial ...
Percona Live Europe 2018 MySQL Group Replication... the magic explained
MySQL InnoDB Cluster and Group Replication in a Nutshell: hands-on tutorial
Cloud native - Why to use MySQL 8.0 and how to use it on oci with MDS
From single MySQL instance to High Availability: the journey to MySQL InnoDB ...
Ad

Similar to MySQL InnoDB Cluster in a Nutshell - Hands-on Lab (20)

PDF
MySQL Day Paris 2016 - MySQL HA: InnoDB Cluster and NDB Cluster
PDF
MySQL 8.0 InnoDB Cluster - Easiest Tutorial
PDF
devops Days Belgium Ghent 2016
PDF
MySQL InnoDB Cluster - Meetup Oracle MySQL / AFUP Paris
PDF
MySQL InnoDB Cluster and MySQL Group Replication @HKOSC 2017
PDF
MySQL HA
PDF
MySQL InnoDB Cluster: High Availability Made Easy!
PDF
How to operate MySQL InnoDB Cluster with MySQL Shell
PDF
Percona Live 2022 - MySQL Architectures
PDF
MySQL Shell - The Best MySQL DBA Tool
PDF
MySQL InnoDB Cluster and NDB Cluster
PDF
20191001 bkk-secret-of inno-db_clusterv1
PDF
MySQL 8.0 : High Availability Solution for Everybody
PDF
MySQL InnoDB Cluster and Group Replication - OSI 2017 Bangalore
PDF
MySQL Database Architectures - 2020-10
PDF
FOSDEM'18: MySQL InnoDB Cluster - MySQL HA Made Easy!
PDF
20200613 my sql-ha-deployment
PDF
MySQL Shell: the daily tool for devs and admins. By Vittorio Cioe.
PDF
Another MySQL HA Solution for ProxySQL Users, Easy and All Integrated: MySQL ...
PDF
MySQL for Oracle DBA -- Rocky Mountain Oracle User Group Training Days '15
MySQL Day Paris 2016 - MySQL HA: InnoDB Cluster and NDB Cluster
MySQL 8.0 InnoDB Cluster - Easiest Tutorial
devops Days Belgium Ghent 2016
MySQL InnoDB Cluster - Meetup Oracle MySQL / AFUP Paris
MySQL InnoDB Cluster and MySQL Group Replication @HKOSC 2017
MySQL HA
MySQL InnoDB Cluster: High Availability Made Easy!
How to operate MySQL InnoDB Cluster with MySQL Shell
Percona Live 2022 - MySQL Architectures
MySQL Shell - The Best MySQL DBA Tool
MySQL InnoDB Cluster and NDB Cluster
20191001 bkk-secret-of inno-db_clusterv1
MySQL 8.0 : High Availability Solution for Everybody
MySQL InnoDB Cluster and Group Replication - OSI 2017 Bangalore
MySQL Database Architectures - 2020-10
FOSDEM'18: MySQL InnoDB Cluster - MySQL HA Made Easy!
20200613 my sql-ha-deployment
MySQL Shell: the daily tool for devs and admins. By Vittorio Cioe.
Another MySQL HA Solution for ProxySQL Users, Easy and All Integrated: MySQL ...
MySQL for Oracle DBA -- Rocky Mountain Oracle User Group Training Days '15
Ad

More from Frederic Descamps (20)

PDF
MySQL Innovation & Cloud Day - Document Store avec MySQL HeatWave Database Se...
PDF
MySQL Day Roma - MySQL Shell and Visual Studio Code Extension
PDF
RivieraJUG - MySQL Indexes and Histograms
PDF
RivieraJUG - MySQL 8.0 - What's new for developers.pdf
PDF
MySQL User Group NL - MySQL 8
PDF
State of the Dolphin - May 2022
PDF
Percona Live 2022 - MySQL Shell for Visual Studio Code
PDF
Percona Live 2022 - The Evolution of a MySQL Database System
PDF
LinuxFest Northwest 2022 - The Evolution of a MySQL Database System
PDF
Open Source 101 2022 - MySQL Indexes and Histograms
PDF
Pi Day 2022 - from IoT to MySQL HeatWave Database Service
PDF
Confoo 2022 - le cycle d'une instance MySQL
PDF
FOSDEM 2022 MySQL Devroom: MySQL 8.0 - Logical Backups, Snapshots and Point-...
PDF
Les nouveautés de MySQL 8.0
PDF
Les nouveautés de MySQL 8.0
PDF
State of The Dolphin - May 2021
PDF
MySQL Shell for DBAs
PDF
Deploying Magento on OCI with MDS
PDF
MySQL Router REST API
PDF
MySQL Database Service Webinar: Installing Drupal in oci with mds
MySQL Innovation & Cloud Day - Document Store avec MySQL HeatWave Database Se...
MySQL Day Roma - MySQL Shell and Visual Studio Code Extension
RivieraJUG - MySQL Indexes and Histograms
RivieraJUG - MySQL 8.0 - What's new for developers.pdf
MySQL User Group NL - MySQL 8
State of the Dolphin - May 2022
Percona Live 2022 - MySQL Shell for Visual Studio Code
Percona Live 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
Pi Day 2022 - from IoT to MySQL HeatWave Database Service
Confoo 2022 - le cycle d'une instance MySQL
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.0
State of The Dolphin - May 2021
MySQL Shell for DBAs
Deploying Magento on OCI with MDS
MySQL Router REST API
MySQL Database Service Webinar: Installing Drupal in oci with mds

Recently uploaded (20)

PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
Machine Learning_overview_presentation.pptx
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Electronic commerce courselecture one. Pdf
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Review of recent advances in non-invasive hemoglobin estimation
The Rise and Fall of 3GPP – Time for a Sabbatical?
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Digital-Transformation-Roadmap-for-Companies.pptx
Machine Learning_overview_presentation.pptx
Unlocking AI with Model Context Protocol (MCP)
Electronic commerce courselecture one. Pdf
sap open course for s4hana steps from ECC to s4
Chapter 3 Spatial Domain Image Processing.pdf
Per capita expenditure prediction using model stacking based on satellite ima...
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Advanced methodologies resolving dimensionality complications for autism neur...
Assigned Numbers - 2025 - Bluetooth® Document
gpt5_lecture_notes_comprehensive_20250812015547.pdf
The AUB Centre for AI in Media Proposal.docx
Reach Out and Touch Someone: Haptics and Empathic Computing
“AI and Expert System Decision Support & Business Intelligence Systems”
20250228 LYD VKU AI Blended-Learning.pptx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf

MySQL InnoDB Cluster in a Nutshell - Hands-on Lab

  • 3. MySQL InnoDB Cluster in a Nutshell: Hands-On Tutorial HOL7316     Oracle OpenWorld 2017     Frédéric Descamps - MySQL Community Manager - Oracle Matt Lord - MySQL Product Manager - Oracle 3 / 63
  • 4.   Safe Harbor Statement The following is intended to outline our general product direction. It is intended for information purpose only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied up in making purchasing decisions. The development, release and timing of any features or functionality described for Oracle´s product remains at the sole discretion of Oracle. Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 4 / 63
  • 5. Who are we ? Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 5 / 63
  • 6. Matt Lord @mattalord MySQL Product Manager living in USA 󾓦   Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 6 / 63
  • 7. Frédéric Descamps @lefred MySQL Evangelist Managing MySQL since 3.23 devops believer living in Belgium 🇧🇪 http://about.me/lefred   Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 7 / 63
  • 8. ready ? agenda Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 8 / 63
  • 9. Agenda Prepare your workstation Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 9 / 63
  • 10. Agenda Prepare your workstation Install your first cluster Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 10 / 63
  • 11. VirtualBox Setup your workstation Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 11 / 63
  • 12. Setup your workstation boot your VM(HOL7316) login to your VMusing login: oracle password: oracle Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 12 / 63
  • 13. LAB1: MySQL Shell start the shell: [holuser@localhost]$ mysqlsh Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 13 / 63
  • 14. LAB1: MySQL Shell start the shell: [holuser@localhost]$ mysqlsh Change between JavaScript, Python and SQL mode Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 14 / 63
  • 15. LAB1: MySQL Shell start the shell: [holuser@localhost]$ mysqlsh Change between JavaScript, Python and SQL mode get the Admin API's help Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 15 / 63
  • 16. Easy High Availability MySQL InnoDB Cluster Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 16 / 63
  • 17. InnoDB cluster Ease-of-Use Extreme Scale-Out Out-of-Box Solution Built-in HA High Performance Everything Integrated Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 17 / 63
  • 18. InnoDB Cluster's Architecture Application MySQL Connector MySQL Router MySQL Shell InnoDB cluster Application MySQL Connector MySQL Router Mp M M Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 18 / 63
  • 19. Group Replication: heart of MySQL InnoDB Cluster Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 19 / 63
  • 20. Group Replication: heart of MySQL InnoDB Cluster Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 20 / 63
  • 21. MySQL Group Replication but what is it ?!? Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 21 / 63
  • 22. MySQL Group Replication but what is it ?!? GR is a plugin for MySQL, made by MySQL and packaged with MySQL Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 22 / 63
  • 23. MySQL Group Replication but what is it ?!? GR is a plugin for MySQL, made by MySQL and packaged with MySQL GR is an implementation of Replicated Database State Machine theory Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 23 / 63
  • 24. 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 @ 2017 Oracle and/or its affiliates. All rights reserved. 24 / 63
  • 25. 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 @ 2017 Oracle and/or its affiliates. All rights reserved. 25 / 63
  • 26. 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 @ 2017 Oracle and/or its affiliates. All rights reserved. 26 / 63
  • 27. 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 @ 2017 Oracle and/or its affiliates. All rights reserved. 27 / 63
  • 28. 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 @ 2017 Oracle and/or its affiliates. All rights reserved. 28 / 63
  • 29. And for users ? Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 29 / 63
  • 30. And for users ? not longer necessary to handle server fail-over manually or with a complicated script Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 30 / 63
  • 31. And for users ? not longer necessary to handle server fail-over manually or with a complicated script GR provides fault tolerance Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 31 / 63
  • 32. 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 @ 2017 Oracle and/or its affiliates. All rights reserved. 32 / 63
  • 33. 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 @ 2017 Oracle and/or its affiliates. All rights reserved. 33 / 63
  • 34. 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 @ 2017 Oracle and/or its affiliates. All rights reserved. 34 / 63
  • 35. ready ? Sanbdox instances Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 35 / 63
  • 36. MySQL Instances: Deploy 3 sandbox instances using these ports: instance1: 4306 instance2: 4406 instance3: 4506 Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 36 / 63
  • 37. MySQL Instances: Deploy 3 sandbox instances using these ports: instance1: 4306 instance2: 4406 instance3: 4506 MySQL-JS> dba.deploySandboxInstance(4306) Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 37 / 63
  • 38. configuration Verify the instances Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 38 / 63
  • 39. Instance Configuration Validate the configuration using the Shell: MySQL-JS> dba.checkInstanceCon guration('root@localhost:4406') MySQL-JS> dba.checkInstanceCon guration('root@localhost:4506') MySQL-JS> dba.checkInstanceCon guration('root@localhost:4606') Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 39 / 63
  • 40. Instance Configuration Validate the configuration using the Shell: MySQL-JS> dba.checkInstanceCon guration('root@localhost:4406') MySQL-JS> dba.checkInstanceCon guration('root@localhost:4506') MySQL-JS> dba.checkInstanceCon guration('root@localhost:4606') Check on the board what could happen Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 40 / 63
  • 41. going HA Create the InnoDB Cluster Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 41 / 63
  • 42. MySQL InnoDB Cluster Connect to one instance and create a cluster fromit Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 42 / 63
  • 43. MySQL InnoDB Cluster Connect to one instance and create a cluster fromit MySQL-JS> c root@localhost:4406 MySQL-JS> cluster=dba.createCluster('oow17') Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 43 / 63
  • 44. MySQL InnoDB Cluster Connect to one instance and create a cluster fromit MySQL-JS> c root@localhost:4406 MySQL-JS> cluster=dba.createCluster('oow17') Check the status: MySQL-JS> cluster.status() Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 44 / 63
  • 45. Administration made easy and more... MySQL-Shell Summary Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 45 / 63
  • 46. MySQL Shell in Summary The MySQL Shell is an interactive Javascript, Python, or SQL interface supporting development and administration for MySQL. MySQL Shell includes the AdminAPI--available in JavaScript and Python--which enables you to set up and manage InnoDB clusters. It provides a modern and fluent API which hides the complexity associated with configuring, provisioning, and managing an InnoDB cluster, without sacrificing power, flexibility, or security. Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 46 / 63
  • 47. Default = Single Primary Mode By default, MySQL InnoDB Cluster enables Single Primary Mode. Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 47 / 63
  • 48. 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 @ 2017 Oracle and/or its affiliates. All rights reserved. 48 / 63
  • 49. 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 @ 2017 Oracle and/or its affiliates. All rights reserved. 49 / 63
  • 50. Who´s the Primary Master ? old fashion style As the Primary Master is elected, all nodes part of the group knows which one was elected. This value is exposed in status variables: Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 50 / 63
  • 51. Who´s the Primary Master ? old fashion style As the Primary Master is elected, all nodes part of the group knows which one was elected. This value is exposed in status variables: mysql> show status like 'group_replication_primary_member'; +----------------------------------+--------------------------------------+ | Variable_name | Value | +----------------------------------+--------------------------------------+ | group_replication_primary_member | 28a4e51f-860e-11e6-bdc4-08002718d305 | +----------------------------------+--------------------------------------+ Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 51 / 63
  • 52. Who´s the Primary Master ? old fashion style As the Primary Master is elected, all nodes part of the group knows which one was elected. This value is exposed in status variables: mysql> show status like 'group_replication_primary_member'; +----------------------------------+--------------------------------------+ | Variable_name | Value | +----------------------------------+--------------------------------------+ | group_replication_primary_member | 28a4e51f-860e-11e6-bdc4-08002718d305 | +----------------------------------+--------------------------------------+ mysql> select member_host as "primary master" from performance_schema.global_status join performance_schema.replication_group_members where variable_name = 'group_replication_primary_member' and member_id=variable_value; +---------------+ | primary master| +---------------+ | mysql3 | +---------------+ Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 52 / 63
  • 53. Who´s the Primary Master ? new fashion style mysql> select member_host from performance_schema.replication_group_members where member_role='PRIMARY'; +-------------+ | member_host | +-------------+ | mysql3 | +-------------+ Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 53 / 63
  • 54. Create a Multi-Primary Cluster: It´s also possible to create a Multi-Primary Cluster using the Shell: Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 54 / 63
  • 55. Create a Multi-Primary Cluster: It´s also possible to create a Multi-Primary Cluster using the Shell: mysql-js> cluster=dba.createCluster('oow17',{multiMaster: true}) Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 55 / 63
  • 56. Create a Multi-Primary Cluster: It´s also possible to create a Multi-Primary Cluster using the Shell: mysql-js> cluster=dba.createCluster('oow17',{multiMaster: true}) A new InnoDB cluster will be created on instance 'root@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 @ 2017 Oracle and/or its affiliates. All rights reserved. 56 / 63
  • 57. Create a Multi-Primary Cluster: It´s also possible to create a Multi-Primary Cluster using the Shell: mysql-js> cluster=dba.createCluster('oow17',{multiMaster: true}) A new InnoDB cluster will be created on instance 'root@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 @ 2017 Oracle and/or its affiliates. All rights reserved. 57 / 63
  • 58. Create a Multi-Primary Cluster: It´s also possible to create a Multi-Primary Cluster using the Shell: mysql-js> cluster=dba.createCluster('oow17',{multiMaster: true}) A new InnoDB cluster will be created on instance 'root@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('oow17',{multiMaster: true, force: true}) Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 58 / 63
  • 59. 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 @ 2017 Oracle and/or its affiliates. All rights reserved. 59 / 63
  • 60. 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 @ 2017 Oracle and/or its affiliates. All rights reserved. 60 / 63
  • 61. MySQL Router Configure MySQL Router: we bootstrap it using the Primary-Master: [root@mysql1 ~]# mysqlrouter --bootstrap localhost:4306 --user mysqlrouter Please enter MySQL password for root: WARNING: The MySQL server does not have SSL ... Bootstrapping system MySQL Router instance... MySQL Router has now been con gured for the InnoDB cluster 'oow17'. The following connection information can be used to connect to the cluster. Classic MySQL protocol connections to cluster 'oow17': - Read/Write Connections: localhost:6446 - Read/Only Connections: localhost:6447 X protocol connections to cluster 'oow17': - Read/Write Connections: localhost:64460 - Read/Only Connections: localhost:64470 [root@mysql1 ~]# chown -R mysqlrouter. /var/lib/mysqlrouter Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 61 / 63
  • 62. MySQL Router (2) Connect to MySQL using the MySQL Shell or MySQL client through the router (port 6446): [root@mysql1 ~]# mysqlh root@localhost:6446 --sql mysql-sql> select @@hostname, sleep(360); Check in which node this query is running. Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 62 / 63
  • 63. Thank you ! Any Questions ? Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 63 / 63