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

MySQL InnoDB Cluster in a Nutshell - Hands-on Lab

  • 1.
  • 2.
  • 3.
    MySQL InnoDB Clusterin 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 Thefollowing 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 ProductManager living in USA 󾓦   Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 6 / 63
  • 7.
    Frédéric Descamps @lefred MySQL Evangelist ManagingMySQL 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 Installyour 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 bootyour 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 startthe shell: [holuser@localhost]$ mysqlsh Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 13 / 63
  • 14.
    LAB1: MySQL Shell startthe 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 startthe 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 MySQLInnoDB 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-inHA High Performance Everything Integrated Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 17 / 63
  • 18.
    InnoDB Cluster's Architecture Application MySQLConnector 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: heartof MySQL InnoDB Cluster Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 19 / 63
  • 20.
    Group Replication: heartof MySQL InnoDB Cluster Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 20 / 63
  • 21.
    MySQL Group Replication butwhat is it ?!? Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 21 / 63
  • 22.
    MySQL Group Replication butwhat 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 butwhat 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 butwhat 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 butwhat 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 butwhat 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 butwhat 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 butwhat 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 3sandbox 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 3sandbox 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 theconfiguration 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 theconfiguration 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 theInnoDB Cluster Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 41 / 63
  • 42.
    MySQL InnoDB Cluster Connectto one instance and create a cluster fromit Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 42 / 63
  • 43.
    MySQL InnoDB Cluster Connectto 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 Connectto 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 easyand more... MySQL-Shell Summary Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 45 / 63
  • 46.
    MySQL Shell inSummary 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 = SinglePrimary Mode By default, MySQL InnoDB Cluster enables Single Primary Mode. Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 47 / 63
  • 48.
    Default = SinglePrimary 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 = SinglePrimary 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 PrimaryMaster ? 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 PrimaryMaster ? 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 PrimaryMaster ? 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 PrimaryMaster ? 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-PrimaryCluster: 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-PrimaryCluster: 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-PrimaryCluster: 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-PrimaryCluster: 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-PrimaryCluster: 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 Routeris 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 Routeris 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 MySQLRouter: 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) Connectto 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 ! AnyQuestions ? Copyright @ 2017 Oracle and/or its affiliates. All rights reserved. 63 / 63