SlideShare a Scribd company logo
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.
MySQL 8
High Availability
with InnoDB Clusters
Miguel Araújo
Senior Software Developer
Alfredo Kojima
Senior Software Development Manager
MySQL Middleware and Clients
October 24, 2018
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Safe Harbor Statement
The following is intended to outline our general product direction. It is intended for
information purposes 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 upon
in making purchasing decisions. The development, release, timing, and pricing of any
features or functionality described for Oracle’s products may change and remains at the
sole discretion of Oracle Corporation.
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 3
Who are we?
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
whoami
Miguel Araújo
• MySQL Senior Software Developer
• Lead developer for the AdminAPI at the
MySQL Shell team
• MySQL InnoDB Cluster evangelist
• Living in Portugal
• http://about.me/miguel-araujo
4
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
whoami
Alfredo Kojima
• MySQL Senior Software Development Manager
• Technical lead for MySQL Clients team: X Plugin,
Router, Shell, C Connectors
• MySQL InnoDB Cluster evangelist
• Living in the USA
5
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Program Agenda
6
MySQL InnoDB Cluster
Get your workstation ready
Deploy a cluster
Test H/A
Advanced examples
1
2
3
4
5
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Program Agenda
7
MySQL InnoDB Cluster
Get your workstation ready
Deploy a cluster
Test H/A
Advanced examples
1
2
3
4
5
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 8
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 9
MySQL Group Replication
InnoDB cluster
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 10
MySQL Group Replication
InnoDB cluster
App Servers with
MySQL Router
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 11
MySQL Group Replication
InnoDB cluster
App Servers with
MySQL Router
MySQL Shell
Setup, Manage,
Orchestrate
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 12
MySQL Group Replication
InnoDB cluster
App Servers with
MySQL Router
MySQL Shell
Setup, Manage,
Orchestrate Clients
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 13
MySQL InnoDB Cluster
Architecture
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Program Agenda
14
MySQL InnoDB Cluster
Get your workstation ready
Deploy a cluster
Test H/A
Advanced examples
1
2
3
4
5
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 15
 Access the cookbook:
 Start Firefox
 http://insidemysql.com/idc
 Start the Shell and a Terminal
Get your workstation ready
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 16
 Deploy 3 MySQL Server instances:
Get your workstation ready
mysql1:3306
mysql2:3306
mysql3:3306
Username: root
Password: root
 Using MySQL official Docker images. Available at:
https://hub.docker.com/r/mysql/mysql-server
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 17
 Check the MySQL servers status
 Start a terminal
 Execute:
Get your workstation ready
$ docker ps -a
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Program Agenda
18
MySQL InnoDB Cluster
Get your workstation ready
Deploy a cluster
Test H/A
1
2
3
4
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 19
Deploy a cluster
Configure instances for InnoDB Cluster usage
mysql-js> dba.checkInstanceConfiguration(“root@mysql1:3306”)
mysql-js> dba.checkInstanceConfiguration(“root@mysql2:3306”)
mysql-js> dba.checkInstanceConfiguration(“root@mysql3:3306”)
1 - Verify instances configuration
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 20
Deploy a cluster
Configure instances for InnoDB Cluster usage
mysql-js> dba.configureInstance(“root@mysql1:3306”)
mysql-js> dba.configureInstance(“root@mysql2:3306”)
mysql-js> dba.configureInstance(“root@mysql3:3306”)
2 - Configure instances
Note: When prompted about instance restart answer No
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 21
Deploy a cluster
Configure instances for InnoDB Cluster usage
$ docker restart docker_mysql1_1
$ docker restart docker_mysql2_1
$ docker restart docker_mysql3_1
3 - Restart instances manually
Note: Switch to the terminal to execute the following commands:
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 22
Deploy a cluster
Create MySQL InnoDB Cluster
mysql-js> c root@mysql1:3306
4 - Create the cluster
4.1 - Connect to the seed instance
mysql-js> var cluster = dba.createCluster(“oow18”)
4.2 - Create the cluster
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 23
Deploy a cluster
Create MySQL InnoDB Cluster
5 - Check the cluster status
mysql-js> cluster.status()
5.1 - Status
mysql-js> cluster.description()
5.2 - Description
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 24
Deploy a cluster
Create MySQL InnoDB Cluster
mysql-js> cluster.addInstance(“root@mysql2:3306”)
6 - Add instances to the cluster
6.1 - Add mysql2
mysql-js> cluster.addInstance(“root@mysql3:3306”)
6.2 - ... and mysql3
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 25
Deploy a cluster
Create MySQL InnoDB Cluster
7 - Re-check the cluster status
mysql-js> cluster.status()
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 26
Deploy a cluster
Deploy MySQL Router
1 - Bootstrap the Router
$ mysqlrouter --bootstrap root@mysql1:3306 –d router_oow18
Note: Switch to the terminal to execute the following command:
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 27
Deploy a cluster
Deploy MySQL Router
2 - Start the Router
$ ./router_oow18/start.sh
Note: Execute the following on the same terminal window
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Program Agenda
28
MySQL InnoDB Cluster
Get your workstation ready
Deploy a cluster
Test H/A
Advanced examples
1
2
3
4
5
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 29
Test H/A
Check query routing
Router listening on:
R/W connections: localhost:6446
R/O connections: localhost:6447
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 30
Test H/A
Check query routing
1 - Connect to your cluster via the Router
mysql-js> c root@localhost:6446
1.1 - Connect to the R/W Router port
mysql-js> var cluster = dba.getCluster()
mysql-js> cluster.status()
1.2 - Get the cluster handle and check it status
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 31
Test H/A
Check query routing
2 - Test query routing
$ mysqlsh root@localhost:6446 –-sql -e “select @@hostname”
2.1 - Where are the R/W queries being redirected too?
Note: Check the hostnames mapping of docker
$ docker inspect <@@hostname> | grep compose.service
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 32
Test H/A
Check query routing
2 - Test query routing
2.2 - Where are the R/O being redirected too?
---> Repeat the previous commands, using now the R/O port: localhost:6447
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 33
Test H/A
Test failover
1 - Shutdown/kill the primary instance
mysql-js> c root@mysql1:3306
mysql-js> sql
mysql-sql> SHUTDOWN;
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 34
Test H/A
Test failover
1 - Shutdown/kill the primary instance
Automatic failover takes place:
New primary automatic elected
Router automatically redirects R/W queries to new primary
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 35
Test H/A
Test failover
2 - Re-check the cluster status
mysql-sql> js
mysql-js> c root@localhost:6446
mysql-js> var cluster = dba.getCluster()
mysql-js> cluster.status()
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 36
Test H/A
Test failover
3 - Restart killed instance
$ docker restart <@@hostname>
3.1 - Restart MySQL instance
mysql-js> cluster.status()
3.2 – Re-check the cluster status
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Program Agenda
37
MySQL InnoDB Cluster
Get your workstation ready
Deploy a cluster
Test H/A
Advanced examples
1
2
3
4
5
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 38
Advanced examples
Quorum loss
Loss of quorum happens when:
 A majority of cluster members is lost
 Remaining members cannot achieve
consensus to take a decision
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 39
Test H/A
Quorum loss
1 - Simulate quorum loss scenario
$ docker kill <@@hostname_mysql1>
$ docker kill <@@hostname_mysql2>
1.1 – Kill MySQL instances
mysql-js> cluster.status()
1.2 – Re-check the cluster status
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 40
Test H/A
Quorum loss
2 – Restore from quorum loss scenario
$ docker restart <@@hostname_mysql1>
$ docker restart <@@hostname_mysql2>
2.1 – Restart MySQL instances
mysql-js> cluster.forceQuorumUsingPartitionOf(“root@mysql2:3306”)
2.2 – Restore quorum
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 41
Test H/A
Quorum loss
2 – Restore from quorum loss scenario
mysql-js> cluster.rejoinInstance(“root@mysql1:3306”)
mysql-js> cluster.rejoinInstance(“root@mysql3:3306”)
2.3 – Rejoin MySQL instances back to the cluster
mysql-js> cluster.status()
2.4 – Re-check the cluster status
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 42
Advanced examples
Complete outage
A complete outage happens when:
 All cluster members are lost
 Even if the members are restarted the cluster
ceased to exist
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 43
Test H/A
Complete outage
1 - Simulate complete outage scenario
$ docker kill $(docker ps -a –q)
1.1 – Kill all MySQL instances
$ docker restart $(docker ps -a –q)
1.2 – Restart all MySQL instances
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 44
Test H/A
Complete outage
2 – Restore from complete outage scenario
mysql-js> c root@mysql1:3306
mysql-js> var cluster = dba.getCluster()
2.1 – Try to get the cluster handle
mysql-js> var cluster = dba.rebootClusterFromCompleteOutage()
2.2 – Restore cluster from complete outage
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 45
Test H/A
Complete outage
2 – Restore from complete outage scenario
2.3 – Re-check the cluster status
mysql-js> cluster.status()
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Resources
• MySQL InnoDB Cluster Userguide:
– http://dev.mysql.com/doc/refman/en/mysql-innodb-cluster-userguide.html
• MySQL Shell Userguide:
– https://dev.mysql.com/doc/refman/en/mysql-shell.html
• APIs Reference manuals
– JavaScript: https://dev.mysql.com/doc/dev/mysqlsh-api-javascript/
– Python: https://dev.mysql.com/doc/dev/mysqlsh-api-python/
• Blogging
– http://mysqlserverteam.com/category/high-availability
46
MySQL 8 High Availability with InnoDB Clusters

More Related Content

What's hot (20)

PDF
Disaster Recovery with MySQL InnoDB ClusterSet - What is it and how do I use it?
Miguel Araújo
 
PDF
MySQL Shell - the best DBA tool !
Frederic Descamps
 
PDF
MySQL Parallel Replication (LOGICAL_CLOCK): all the 5.7 (and some of the 8.0)...
Jean-François Gagné
 
PDF
MySQL Database Architectures - InnoDB ReplicaSet & Cluster
Kenny Gryp
 
PDF
MySQL InnoDB Cluster and Group Replication in a nutshell hands-on tutorial
Frederic Descamps
 
PDF
MySQL InnoDB Cluster: Management and Troubleshooting with MySQL Shell
Miguel Araújo
 
PDF
The Full MySQL and MariaDB Parallel Replication Tutorial
Jean-François Gagné
 
PDF
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
Kenny Gryp
 
PDF
MySQL InnoDB Cluster - Advanced Configuration & Operations
Frederic Descamps
 
PDF
Transparent Data Encryption in PostgreSQL
Masahiko Sawada
 
PDF
MySQL Connectors 8.0.19 & DNS SRV
Kenny Gryp
 
PDF
The Complete MariaDB Server tutorial
Colin Charles
 
PDF
Another MySQL HA Solution for ProxySQL Users, Easy and All Integrated: MySQL ...
Frederic Descamps
 
PDF
MySQL 8.0で憶えておいてほしいこと
yoku0825
 
PDF
MySQL Shell - The Best MySQL DBA Tool
Miguel Araújo
 
PDF
MySQL Database Architectures - 2022-08
Kenny Gryp
 
PDF
Oracle RAC Virtualized - In VMs, in Containers, On-premises, and in the Cloud
Markus Michalewicz
 
PDF
Wars of MySQL Cluster ( InnoDB Cluster VS Galera )
Mydbops
 
PDF
Mvcc (oracle, innodb, postgres)
frogd
 
PDF
InnoDB MVCC Architecture (by 권건우)
I Goo Lee.
 
Disaster Recovery with MySQL InnoDB ClusterSet - What is it and how do I use it?
Miguel Araújo
 
MySQL Shell - the best DBA tool !
Frederic Descamps
 
MySQL Parallel Replication (LOGICAL_CLOCK): all the 5.7 (and some of the 8.0)...
Jean-François Gagné
 
MySQL Database Architectures - InnoDB ReplicaSet & Cluster
Kenny Gryp
 
MySQL InnoDB Cluster and Group Replication in a nutshell hands-on tutorial
Frederic Descamps
 
MySQL InnoDB Cluster: Management and Troubleshooting with MySQL Shell
Miguel Araújo
 
The Full MySQL and MariaDB Parallel Replication Tutorial
Jean-François Gagné
 
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
Kenny Gryp
 
MySQL InnoDB Cluster - Advanced Configuration & Operations
Frederic Descamps
 
Transparent Data Encryption in PostgreSQL
Masahiko Sawada
 
MySQL Connectors 8.0.19 & DNS SRV
Kenny Gryp
 
The Complete MariaDB Server tutorial
Colin Charles
 
Another MySQL HA Solution for ProxySQL Users, Easy and All Integrated: MySQL ...
Frederic Descamps
 
MySQL 8.0で憶えておいてほしいこと
yoku0825
 
MySQL Shell - The Best MySQL DBA Tool
Miguel Araújo
 
MySQL Database Architectures - 2022-08
Kenny Gryp
 
Oracle RAC Virtualized - In VMs, in Containers, On-premises, and in the Cloud
Markus Michalewicz
 
Wars of MySQL Cluster ( InnoDB Cluster VS Galera )
Mydbops
 
Mvcc (oracle, innodb, postgres)
frogd
 
InnoDB MVCC Architecture (by 권건우)
I Goo Lee.
 

Similar to MySQL 8 High Availability with InnoDB Clusters (20)

PPTX
My sql8 innodb_cluster
Mysql User Camp
 
PDF
MySQL InnoDB Cluster and MySQL Group Replication @HKOSC 2017
Ivan Ma
 
PDF
20200613 my sql-ha-deployment
Ivan Ma
 
PDF
MySQL InnoDB Cluster - Meetup Oracle MySQL / AFUP Paris
Olivier DASINI
 
PDF
Docker Compose Setup for MySQL InnoDB Cluster
Balasubramanian Kandasamy
 
PDF
MySQL InnoDB Cluster and NDB Cluster
Mario Beck
 
PDF
MySQL 8.0 InnoDB Cluster - Easiest Tutorial
Frederic Descamps
 
PDF
20190817 coscup-oracle my sql innodb cluster sharing
Ivan Ma
 
PDF
FOSDEM'18: MySQL InnoDB Cluster - MySQL HA Made Easy!
Miguel Araújo
 
PDF
20191001 bkk-secret-of inno-db_clusterv1
Ivan Ma
 
PDF
MySQL InnoDB Cluster in a Nutshell - Hands-on Lab
Frederic Descamps
 
PDF
MySQL HA
Ted Wennmark
 
PDF
MySQL Day Paris 2016 - MySQL HA: InnoDB Cluster and NDB Cluster
Olivier DASINI
 
PDF
Moodle Moot Spain: Moodle Available and Scalable with MySQL HA - InnoDB Clust...
Keith Hollman
 
PDF
Sunshine php my sql 8.0 v2
Kathy Forte (Hassard)
 
PDF
MySQL Day Paris 2018 - MySQL InnoDB Cluster; A complete High Availability sol...
Olivier DASINI
 
PDF
How to operate MySQL InnoDB Cluster with MySQL Shell
Frederic Descamps
 
PDF
Deep Dive into MySQL InnoDB Cluster Read Scale-out Capabilities.pdf
Miguel Araújo
 
PDF
devops Days Belgium Ghent 2016
Frederic Descamps
 
PDF
MySQL InnoDB Cluster - A complete High Availability solution for MySQL
Olivier DASINI
 
My sql8 innodb_cluster
Mysql User Camp
 
MySQL InnoDB Cluster and MySQL Group Replication @HKOSC 2017
Ivan Ma
 
20200613 my sql-ha-deployment
Ivan Ma
 
MySQL InnoDB Cluster - Meetup Oracle MySQL / AFUP Paris
Olivier DASINI
 
Docker Compose Setup for MySQL InnoDB Cluster
Balasubramanian Kandasamy
 
MySQL InnoDB Cluster and NDB Cluster
Mario Beck
 
MySQL 8.0 InnoDB Cluster - Easiest Tutorial
Frederic Descamps
 
20190817 coscup-oracle my sql innodb cluster sharing
Ivan Ma
 
FOSDEM'18: MySQL InnoDB Cluster - MySQL HA Made Easy!
Miguel Araújo
 
20191001 bkk-secret-of inno-db_clusterv1
Ivan Ma
 
MySQL InnoDB Cluster in a Nutshell - Hands-on Lab
Frederic Descamps
 
MySQL HA
Ted Wennmark
 
MySQL Day Paris 2016 - MySQL HA: InnoDB Cluster and NDB Cluster
Olivier DASINI
 
Moodle Moot Spain: Moodle Available and Scalable with MySQL HA - InnoDB Clust...
Keith Hollman
 
Sunshine php my sql 8.0 v2
Kathy Forte (Hassard)
 
MySQL Day Paris 2018 - MySQL InnoDB Cluster; A complete High Availability sol...
Olivier DASINI
 
How to operate MySQL InnoDB Cluster with MySQL Shell
Frederic Descamps
 
Deep Dive into MySQL InnoDB Cluster Read Scale-out Capabilities.pdf
Miguel Araújo
 
devops Days Belgium Ghent 2016
Frederic Descamps
 
MySQL InnoDB Cluster - A complete High Availability solution for MySQL
Olivier DASINI
 
Ad

More from Miguel Araújo (13)

PDF
Routing Guidelines: Unlocking Smarter Query Routing in MySQL Architectures
Miguel Araújo
 
PDF
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Miguel Araújo
 
PDF
MySQL Router - Explore The Secrets (MySQL Belgian Days 2024)
Miguel Araújo
 
PDF
MySQL Shell/AdminAPI - MySQL Architectures Made Easy For All!
Miguel Araújo
 
PDF
MySQL InnoDB Cluster / ReplicaSet - Making Provisioning & Troubleshooting as ...
Miguel Araújo
 
PDF
MySQL InnoDB Cluster / ReplicaSet - Tutorial
Miguel Araújo
 
PDF
MySQL Shell - A DevOps-engineer day with MySQL’s development and administrati...
Miguel Araújo
 
PDF
MySQL Shell: The DevOps Tool for MySQL
Miguel Araújo
 
PDF
MySQL Shell - The DevOps Tool for MySQL
Miguel Araújo
 
PDF
MySQL Proxy. A powerful, flexible MySQL toolbox.
Miguel Araújo
 
PDF
SLQ vs NOSQL - friends or foes
Miguel Araújo
 
PDF
Asynchronous Replication of Databases
Miguel Araújo
 
PDF
Evaluating Data Freshness in Large Scale Replicated Databases
Miguel Araújo
 
Routing Guidelines: Unlocking Smarter Query Routing in MySQL Architectures
Miguel Araújo
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Miguel Araújo
 
MySQL Router - Explore The Secrets (MySQL Belgian Days 2024)
Miguel Araújo
 
MySQL Shell/AdminAPI - MySQL Architectures Made Easy For All!
Miguel Araújo
 
MySQL InnoDB Cluster / ReplicaSet - Making Provisioning & Troubleshooting as ...
Miguel Araújo
 
MySQL InnoDB Cluster / ReplicaSet - Tutorial
Miguel Araújo
 
MySQL Shell - A DevOps-engineer day with MySQL’s development and administrati...
Miguel Araújo
 
MySQL Shell: The DevOps Tool for MySQL
Miguel Araújo
 
MySQL Shell - The DevOps Tool for MySQL
Miguel Araújo
 
MySQL Proxy. A powerful, flexible MySQL toolbox.
Miguel Araújo
 
SLQ vs NOSQL - friends or foes
Miguel Araújo
 
Asynchronous Replication of Databases
Miguel Araújo
 
Evaluating Data Freshness in Large Scale Replicated Databases
Miguel Araújo
 
Ad

Recently uploaded (20)

PDF
AI + DevOps = Smart Automation with devseccops.ai.pdf
Devseccops.ai
 
PDF
SAP Firmaya İade ABAB Kodları - ABAB ile yazılmıl hazır kod örneği
Salih Küçük
 
PPTX
In From the Cold: Open Source as Part of Mainstream Software Asset Management
Shane Coughlan
 
PDF
Unlock Efficiency with Insurance Policy Administration Systems
Insurance Tech Services
 
PPTX
OpenChain @ OSS NA - In From the Cold: Open Source as Part of Mainstream Soft...
Shane Coughlan
 
PDF
4K Video Downloader Plus Pro Crack for MacOS New Download 2025
bashirkhan333g
 
PPTX
Home Care Tools: Benefits, features and more
Third Rock Techkno
 
PDF
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
PDF
Generic or Specific? Making sensible software design decisions
Bert Jan Schrijver
 
PDF
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pdf
Varsha Nayak
 
PPTX
Human Resources Information System (HRIS)
Amity University, Patna
 
PPTX
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
PDF
Digger Solo: Semantic search and maps for your local files
seanpedersen96
 
PDF
Top Agile Project Management Tools for Teams in 2025
Orangescrum
 
PDF
Wondershare PDFelement Pro Crack for MacOS New Version Latest 2025
bashirkhan333g
 
PPTX
Empowering Asian Contributions: The Rise of Regional User Groups in Open Sour...
Shane Coughlan
 
PPTX
Agentic Automation Journey Series Day 2 – Prompt Engineering for UiPath Agents
klpathrudu
 
PDF
Revenue streams of the Wazirx clone script.pdf
aaronjeffray
 
PPTX
Migrating Millions of Users with Debezium, Apache Kafka, and an Acyclic Synch...
MD Sayem Ahmed
 
PPTX
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 
AI + DevOps = Smart Automation with devseccops.ai.pdf
Devseccops.ai
 
SAP Firmaya İade ABAB Kodları - ABAB ile yazılmıl hazır kod örneği
Salih Küçük
 
In From the Cold: Open Source as Part of Mainstream Software Asset Management
Shane Coughlan
 
Unlock Efficiency with Insurance Policy Administration Systems
Insurance Tech Services
 
OpenChain @ OSS NA - In From the Cold: Open Source as Part of Mainstream Soft...
Shane Coughlan
 
4K Video Downloader Plus Pro Crack for MacOS New Download 2025
bashirkhan333g
 
Home Care Tools: Benefits, features and more
Third Rock Techkno
 
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
Generic or Specific? Making sensible software design decisions
Bert Jan Schrijver
 
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pdf
Varsha Nayak
 
Human Resources Information System (HRIS)
Amity University, Patna
 
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
Digger Solo: Semantic search and maps for your local files
seanpedersen96
 
Top Agile Project Management Tools for Teams in 2025
Orangescrum
 
Wondershare PDFelement Pro Crack for MacOS New Version Latest 2025
bashirkhan333g
 
Empowering Asian Contributions: The Rise of Regional User Groups in Open Sour...
Shane Coughlan
 
Agentic Automation Journey Series Day 2 – Prompt Engineering for UiPath Agents
klpathrudu
 
Revenue streams of the Wazirx clone script.pdf
aaronjeffray
 
Migrating Millions of Users with Debezium, Apache Kafka, and an Acyclic Synch...
MD Sayem Ahmed
 
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 

MySQL 8 High Availability with InnoDB Clusters

  • 1. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Copyright © 2018, Oracle and/or its affiliates. All rights reserved. MySQL 8 High Availability with InnoDB Clusters Miguel Araújo Senior Software Developer Alfredo Kojima Senior Software Development Manager MySQL Middleware and Clients October 24, 2018
  • 2. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Safe Harbor Statement The following is intended to outline our general product direction. It is intended for information purposes 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 upon in making purchasing decisions. The development, release, timing, and pricing of any features or functionality described for Oracle’s products may change and remains at the sole discretion of Oracle Corporation.
  • 3. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 3 Who are we?
  • 4. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | whoami Miguel Araújo • MySQL Senior Software Developer • Lead developer for the AdminAPI at the MySQL Shell team • MySQL InnoDB Cluster evangelist • Living in Portugal • http://about.me/miguel-araujo 4
  • 5. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | whoami Alfredo Kojima • MySQL Senior Software Development Manager • Technical lead for MySQL Clients team: X Plugin, Router, Shell, C Connectors • MySQL InnoDB Cluster evangelist • Living in the USA 5
  • 6. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Program Agenda 6 MySQL InnoDB Cluster Get your workstation ready Deploy a cluster Test H/A Advanced examples 1 2 3 4 5
  • 7. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Program Agenda 7 MySQL InnoDB Cluster Get your workstation ready Deploy a cluster Test H/A Advanced examples 1 2 3 4 5
  • 8. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 8
  • 9. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 9 MySQL Group Replication InnoDB cluster
  • 10. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 10 MySQL Group Replication InnoDB cluster App Servers with MySQL Router
  • 11. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 11 MySQL Group Replication InnoDB cluster App Servers with MySQL Router MySQL Shell Setup, Manage, Orchestrate
  • 12. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 12 MySQL Group Replication InnoDB cluster App Servers with MySQL Router MySQL Shell Setup, Manage, Orchestrate Clients
  • 13. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 13 MySQL InnoDB Cluster Architecture
  • 14. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Program Agenda 14 MySQL InnoDB Cluster Get your workstation ready Deploy a cluster Test H/A Advanced examples 1 2 3 4 5
  • 15. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 15  Access the cookbook:  Start Firefox  http://insidemysql.com/idc  Start the Shell and a Terminal Get your workstation ready
  • 16. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 16  Deploy 3 MySQL Server instances: Get your workstation ready mysql1:3306 mysql2:3306 mysql3:3306 Username: root Password: root  Using MySQL official Docker images. Available at: https://hub.docker.com/r/mysql/mysql-server
  • 17. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 17  Check the MySQL servers status  Start a terminal  Execute: Get your workstation ready $ docker ps -a
  • 18. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Program Agenda 18 MySQL InnoDB Cluster Get your workstation ready Deploy a cluster Test H/A 1 2 3 4
  • 19. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 19 Deploy a cluster Configure instances for InnoDB Cluster usage mysql-js> dba.checkInstanceConfiguration(“root@mysql1:3306”) mysql-js> dba.checkInstanceConfiguration(“root@mysql2:3306”) mysql-js> dba.checkInstanceConfiguration(“root@mysql3:3306”) 1 - Verify instances configuration
  • 20. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 20 Deploy a cluster Configure instances for InnoDB Cluster usage mysql-js> dba.configureInstance(“root@mysql1:3306”) mysql-js> dba.configureInstance(“root@mysql2:3306”) mysql-js> dba.configureInstance(“root@mysql3:3306”) 2 - Configure instances Note: When prompted about instance restart answer No
  • 21. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 21 Deploy a cluster Configure instances for InnoDB Cluster usage $ docker restart docker_mysql1_1 $ docker restart docker_mysql2_1 $ docker restart docker_mysql3_1 3 - Restart instances manually Note: Switch to the terminal to execute the following commands:
  • 22. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 22 Deploy a cluster Create MySQL InnoDB Cluster mysql-js> c root@mysql1:3306 4 - Create the cluster 4.1 - Connect to the seed instance mysql-js> var cluster = dba.createCluster(“oow18”) 4.2 - Create the cluster
  • 23. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 23 Deploy a cluster Create MySQL InnoDB Cluster 5 - Check the cluster status mysql-js> cluster.status() 5.1 - Status mysql-js> cluster.description() 5.2 - Description
  • 24. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 24 Deploy a cluster Create MySQL InnoDB Cluster mysql-js> cluster.addInstance(“root@mysql2:3306”) 6 - Add instances to the cluster 6.1 - Add mysql2 mysql-js> cluster.addInstance(“root@mysql3:3306”) 6.2 - ... and mysql3
  • 25. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 25 Deploy a cluster Create MySQL InnoDB Cluster 7 - Re-check the cluster status mysql-js> cluster.status()
  • 26. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 26 Deploy a cluster Deploy MySQL Router 1 - Bootstrap the Router $ mysqlrouter --bootstrap root@mysql1:3306 –d router_oow18 Note: Switch to the terminal to execute the following command:
  • 27. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 27 Deploy a cluster Deploy MySQL Router 2 - Start the Router $ ./router_oow18/start.sh Note: Execute the following on the same terminal window
  • 28. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Program Agenda 28 MySQL InnoDB Cluster Get your workstation ready Deploy a cluster Test H/A Advanced examples 1 2 3 4 5
  • 29. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 29 Test H/A Check query routing Router listening on: R/W connections: localhost:6446 R/O connections: localhost:6447
  • 30. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 30 Test H/A Check query routing 1 - Connect to your cluster via the Router mysql-js> c root@localhost:6446 1.1 - Connect to the R/W Router port mysql-js> var cluster = dba.getCluster() mysql-js> cluster.status() 1.2 - Get the cluster handle and check it status
  • 31. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 31 Test H/A Check query routing 2 - Test query routing $ mysqlsh root@localhost:6446 –-sql -e “select @@hostname” 2.1 - Where are the R/W queries being redirected too? Note: Check the hostnames mapping of docker $ docker inspect <@@hostname> | grep compose.service
  • 32. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 32 Test H/A Check query routing 2 - Test query routing 2.2 - Where are the R/O being redirected too? ---> Repeat the previous commands, using now the R/O port: localhost:6447
  • 33. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 33 Test H/A Test failover 1 - Shutdown/kill the primary instance mysql-js> c root@mysql1:3306 mysql-js> sql mysql-sql> SHUTDOWN;
  • 34. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 34 Test H/A Test failover 1 - Shutdown/kill the primary instance Automatic failover takes place: New primary automatic elected Router automatically redirects R/W queries to new primary
  • 35. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 35 Test H/A Test failover 2 - Re-check the cluster status mysql-sql> js mysql-js> c root@localhost:6446 mysql-js> var cluster = dba.getCluster() mysql-js> cluster.status()
  • 36. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 36 Test H/A Test failover 3 - Restart killed instance $ docker restart <@@hostname> 3.1 - Restart MySQL instance mysql-js> cluster.status() 3.2 – Re-check the cluster status
  • 37. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Program Agenda 37 MySQL InnoDB Cluster Get your workstation ready Deploy a cluster Test H/A Advanced examples 1 2 3 4 5
  • 38. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 38 Advanced examples Quorum loss Loss of quorum happens when:  A majority of cluster members is lost  Remaining members cannot achieve consensus to take a decision
  • 39. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 39 Test H/A Quorum loss 1 - Simulate quorum loss scenario $ docker kill <@@hostname_mysql1> $ docker kill <@@hostname_mysql2> 1.1 – Kill MySQL instances mysql-js> cluster.status() 1.2 – Re-check the cluster status
  • 40. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 40 Test H/A Quorum loss 2 – Restore from quorum loss scenario $ docker restart <@@hostname_mysql1> $ docker restart <@@hostname_mysql2> 2.1 – Restart MySQL instances mysql-js> cluster.forceQuorumUsingPartitionOf(“root@mysql2:3306”) 2.2 – Restore quorum
  • 41. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 41 Test H/A Quorum loss 2 – Restore from quorum loss scenario mysql-js> cluster.rejoinInstance(“root@mysql1:3306”) mysql-js> cluster.rejoinInstance(“root@mysql3:3306”) 2.3 – Rejoin MySQL instances back to the cluster mysql-js> cluster.status() 2.4 – Re-check the cluster status
  • 42. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 42 Advanced examples Complete outage A complete outage happens when:  All cluster members are lost  Even if the members are restarted the cluster ceased to exist
  • 43. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 43 Test H/A Complete outage 1 - Simulate complete outage scenario $ docker kill $(docker ps -a –q) 1.1 – Kill all MySQL instances $ docker restart $(docker ps -a –q) 1.2 – Restart all MySQL instances
  • 44. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 44 Test H/A Complete outage 2 – Restore from complete outage scenario mysql-js> c root@mysql1:3306 mysql-js> var cluster = dba.getCluster() 2.1 – Try to get the cluster handle mysql-js> var cluster = dba.rebootClusterFromCompleteOutage() 2.2 – Restore cluster from complete outage
  • 45. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 45 Test H/A Complete outage 2 – Restore from complete outage scenario 2.3 – Re-check the cluster status mysql-js> cluster.status()
  • 46. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Resources • MySQL InnoDB Cluster Userguide: – http://dev.mysql.com/doc/refman/en/mysql-innodb-cluster-userguide.html • MySQL Shell Userguide: – https://dev.mysql.com/doc/refman/en/mysql-shell.html • APIs Reference manuals – JavaScript: https://dev.mysql.com/doc/dev/mysqlsh-api-javascript/ – Python: https://dev.mysql.com/doc/dev/mysqlsh-api-python/ • Blogging – http://mysqlserverteam.com/category/high-availability 46