1 / 126
MySQL Group Replication in a nutshell the core of MySQL InnoDB Cluster   Oracle Open World September 19th 2016   Frédéric Descamps MySQL Community Manager Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 2 / 126
  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 @ 2016 Oracle and/or its affiliates. All rights reserved. 3 / 126
Join us! MySQL Community Reception @ Oracle OpenWorld Celebrate, Have Fun and Mingle with Oracle’s MySQL Engineers & Your Peers Tuesday, September 20, 7.00 pm Jillian’s at Metreon: 175 Fourth Street, San Francisco At the corner of Howard and 4th st.; only 2-min walk fromMoscone Center (same place as last year) Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 4 / 126
about.me/lefred Who am I ? Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 5 / 126
Frédéric Descamps @lefred MySQL Evangelist Managing MySQL since 3.23 devops believer Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 6 / 126
get more at the conference MySQL Group Replication Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 7 / 126
Other sessions CON2907 - MySQL High Availability MattLord CON4669 - MySQL High Availability with Group Replication NunoGomes CON3373 - The State of the Art of MySQL Replication LuisSoares HOL2912 - Building a Highly Available MySQL Database Service with Group Replication MattLord Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 8 / 126
Agenda Group Replication concepts Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 9 / 126
Agenda Group Replication concepts Using new&cool tools Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 10 / 126
Agenda Group Replication concepts Using new&cool tools Application interaction Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 11 / 126
the magic explained Group Replication Concept Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 12 / 126
Group Replication : what is it ? Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 13 / 126
Group Replication : what is it ? MySQL is one of the major components of MySQL InnoDB Cluster Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 14 / 126
Group Replication : what is it ? MySQL is one of the major components of MySQL InnoDB Cluster   Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 15 / 126
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 16 / 126
Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 17 / 126
Group replication is a plugin ! Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 18 / 126
Group replication is a plugin ! GR is a plugin for MySQL, made by MySQL and packaged with MySQL Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 19 / 126
Group replication is a plugin ! GR is a plugin for MySQL, made by MySQL and packaged with MySQL GR is an implementation of Replicated Database State Machine theory MySQL Group Communication System(GCS) is based on Paxos Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 20 / 126
Group replication is a plugin ! GR is a plugin for MySQL, made by MySQL and packaged with MySQL GR is an implementation of Replicated Database State Machine theory MySQL Group Communication System(GCS) is based on Paxos Provides virtually synchronous replication for MySQL 5.7+ Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 21 / 126
Group replication is a plugin ! GR is a plugin for MySQL, made by MySQL and packaged with MySQL GR is an implementation of Replicated Database State Machine theory MySQL Group Communication System(GCS) is based on Paxos Provides virtually synchronous replication for MySQL 5.7+ Supported on all MySQL platforms !! Linux, Windows, Solaris, OSX, FreeBSD Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 22 / 126
      “Multi-masterupdateanywherereplicationpluginforMySQLwithbuilt-inconflict detectionandresolution,automaticdistributedrecovery,andgroupmembership.” Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 23 / 126
Group Replication : how does it work ? Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 24 / 126
Group Replication : how does it work ? A node (member of the group) send the changes (binlog events) made by a transaction to the group through the GCS. Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 25 / 126
Group Replication : how does it work ? A node (member of the group) send the changes (binlog events) made by a transaction to the group through the GCS. All members consume the writeset and certify it Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 26 / 126
Group Replication : how does it work ? A node (member of the group) send the changes (binlog events) made by a transaction to the group through the GCS. All members consume the writeset and certify it If passed it is applied, if failed, transaction is rolled back on originating server and discarded at other servers. Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 27 / 126
OK... but how does it work ?! Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 28 / 126
OK... but how does it work ?! It's just magic ! Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 29 / 126
OK... but how does it work ?! It's just magic ! ... no, in fact the writesets replication is synchronous and then certification and apply of the changes are local to each nodes and asynchronous. Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 30 / 126
OK... but how does it work ?! It's just magic ! ... no, in fact the writesets replication is synchronous and then certification and apply of the changes are local to each nodes and asynchronous. not that easy to understand... right ? Let's illustrate this... Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 31 / 126
MySQL Group Replication (autocommit) Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 32 / 126
MySQL Group Replication (autocommit) Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 33 / 126
MySQL Group Replication (autocommit) Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 34 / 126
MySQL Group Replication (autocommit) Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 35 / 126
MySQL Group Replication (autocommit) Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 36 / 126
MySQL Group Replication (autocommit) Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 37 / 126
MySQL Group Replication (autocommit) Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 38 / 126
MySQL Group Replication (full transaction) Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 39 / 126
MySQL Group Replication (full transaction) Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 40 / 126
MySQL Group Replication (full transaction) Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 41 / 126
MySQL Group Replication (full transaction) Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 42 / 126
MySQL Group Replication (full transaction) Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 43 / 126
MySQL Group Replication (full transaction) Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 44 / 126
MySQL Group Replication (full transaction) Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 45 / 126
MySQL Group Replication (full transaction) Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 46 / 126
MySQL Group Replication (full transaction) Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 47 / 126
Group Replication : Optimistic Locking With GR we use what we call optimistic locking, it means we consider a resource free and this will be confirmed or not during certification. Let's first have a look at the traditional locking to compare. Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 48 / 126
Traditional locking Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 49 / 126
Traditional locking Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 50 / 126
Traditional locking Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 51 / 126
Traditional locking Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 52 / 126
Traditional locking Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 53 / 126
Traditional locking Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 54 / 126
Optimistic Locking Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 55 / 126
Optimistic Locking Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 56 / 126
Optimistic Locking Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 57 / 126
Optimistic Locking Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 58 / 126
Optimistic Locking Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 59 / 126
Optimistic Locking Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 60 / 126
Optimistic Locking The systemreturns error 149 as certification failed: ERROR 1180 (HY000): Got error 149 during COMMIT Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 61 / 126
Group Replication : requirements exclusively use of InnoDB tables only Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 62 / 126
Group Replication : requirements exclusively use of InnoDB tables only every tables must have a PK defined Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 63 / 126
Group Replication : requirements exclusively use of InnoDB tables only every tables must have a PK defined only IPV4 is supported Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 64 / 126
Group Replication : requirements exclusively use of InnoDB tables only every tables must have a PK defined only IPV4 is supported a good network with lowlatency is important Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 65 / 126
Group Replication : requirements exclusively use of InnoDB tables only every tables must have a PK defined only IPV4 is supported a good network with lowlatency is important maximumof 9 members per group Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 66 / 126
Group Replication : requirements exclusively use of InnoDB tables only every tables must have a PK defined only IPV4 is supported a good network with lowlatency is important maximumof 9 members per group log-binmust be enabled and only ROWformat is supported Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 67 / 126
Group Replication : requirements (2) enable GTIDs Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 68 / 126
Group Replication : requirements (2) enable GTIDs replication meta-data must be stored on systemtables --master-info-repository=TABLE --relay-log-info-repository=TABLE Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 69 / 126
Group Replication : requirements (2) enable GTIDs replication meta-data must be stored on systemtables --master-info-repository=TABLE --relay-log-info-repository=TABLE writesets extraction must be enabled --transaction-write-set-extraction=XXHASH64 Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 70 / 126
Group Replication : requirements (2) enable GTIDs replication meta-data must be stored on systemtables --master-info-repository=TABLE --relay-log-info-repository=TABLE writesets extraction must be enabled --transaction-write-set-extraction=XXHASH64 log-slave-updatesmust be enabled Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 71 / 126
Group Replication : limitations There are also some technical limitations: Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 72 / 126
Group Replication : limitations There are also some technical limitations: binlog checksumis not supported --binlog-checksum=NONE Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 73 / 126
Group Replication : limitations There are also some technical limitations: binlog checksumis not supported --binlog-checksum=NONE Savepoints are not supported Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 74 / 126
Group Replication : limitations There are also some technical limitations: binlog checksumis not supported --binlog-checksum=NONE Savepoints are not supported SERIALIZABLEis not supported as transaction isolation level Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 75 / 126
Group Replication : limitations There are also some technical limitations: binlog checksumis not supported --binlog-checksum=NONE Savepoints are not supported SERIALIZABLEis not supported as transaction isolation level an object cannot be changed concurrently at different servers by two operations, where one of themis a DDL and the other is either a DML or DDL. Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 76 / 126
are we compatible ? Pre-study Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 77 / 126
Is my workload ready for Group Replication ? Large transactions are more vulnerable because: Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 78 / 126
Is my workload ready for Group Replication ? Large transactions are more vulnerable because: Large write set may increase the likelihood of certification conflicts Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 79 / 126
Is my workload ready for Group Replication ? Large transactions are more vulnerable because: Large write set may increase the likelihood of certification conflicts Transaction taking longer to execute may be more vulnerable to be aborted by a certified transaction. Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 80 / 126
Is my workload ready for Group Replication ? Large transactions are more vulnerable because: Large write set may increase the likelihood of certification conflicts Transaction taking longer to execute may be more vulnerable to be aborted by a certified transaction. Small transactions changing a very small set of data (hotspots): Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 81 / 126
Is my workload ready for Group Replication ? Large transactions are more vulnerable because: Large write set may increase the likelihood of certification conflicts Transaction taking longer to execute may be more vulnerable to be aborted by a certified transaction. Small transactions changing a very small set of data (hotspots): Concurrently executing themat different sites will trade-off contention with roll backs due to the optimistic execution Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 82 / 126
Therefore, when using Group Replication, we should pay attention to these points: PK is mandatory (and a good one is better) avoid large transactions avoid hotspot Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 83 / 126
Scheme verification We will see nowa list a queries that allows us to analyze our scheme. We will look for: non InnoDB tables tables without PK tables with a bad PK Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 84 / 126
Non InnoDB tables   SELECT table_schema, table_name, engine, table_rows, (index_length+data_length)/1024/1024 AS sizeMB FROM information_schema.tables WHERE engine != 'innodb' AND table_schema NOT IN ('information_schema', 'mysql', 'performance_schema'); Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.   85 / 126
Tables Without Primary Key select tables.table_schema, tables.table_name, tables.engine, tables.table_rows from information_schema.tables left join ( select table_schema, table_name from information_schema.statistics group by table_schema, table_name, index_name having sum( case when non_unique = 0 and nullable != 'YES' then 1 else 0 end ) = count(*) ) puks on tables.table_schema = puks.table_schema and tables.table_name = puks.table_name where puks.table_name is null and tables.table_type = 'BASE TABLE' and engine='InnoDB'; Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.   86 / 126
Tables with bad primarky keys   set SQL_MODE=""; select a.TABLE_SCHEMA,a.TABLE_NAME, b.ENGINE, a.COLUMN_NAME, a.DATA_TYPE, a.COLUMN_TYPE, a.COLUMN_KEY, b.TABLE_ROWS from information_schema.COLUMNS as a join information_schema.TABLES as b on b.TABLE_NAME=a.TABLE_NAME and b.TABLE_SCHEMA=a.TABLE_SCHEMA where COLUMN_KEY='PRI' and ENGINE="InnoDB" and DATA_TYPE not like '%int' and DATA_TYPE not like 'enum%' and DATA_TYPE not like 'date%' and DATA_TYPE not like 'time%' and a.TABLE_SCHEMA not in ('mysql','sys') group by table_schema, table_name; Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.   87 / 126
Workload analysis Nowit's time to play with Performance_Schemato analyze our workload. The goal is to identify: transactions with most statements (and most writes in particular) transactions with most rows affected largest statements by rowaffected queries updating most the same PK and therefore having to wait more) Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 88 / 126
Setup Performance_Schema We need to enable some consumers and instruments: update performance_schema.setup_consumers set enabled = 'yes' where name like 'events_statement%' or name like 'events_transaction%'; update performance_schema.setup_instruments set enabled = 'yes', timed = 'yes' where name = 'transaction'; Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.   89 / 126
Find the transactions with most statements   select t.thread_id, t.event_id, count(*) statement_count, sum(s.rows_affected) rows_affected, length(replace(group_concat( case when s.event_name = "statement/sql/update" then 1 when s.event_name = "statement/sql/insert" then 1 when s.event_name = "statement/sql/delete" then 1 else null end),',','')) as "# write statements" from performance_schema.events_transactions_history_long t join performance_schema.events_statements_history_long s on t.thread_id = s.thread_id and t.event_id = s.nesting_event_id group by t.thread_id, t.event_id order by rows_affected desc limit 10; Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.   90 / 126
Find the transactions with most statements It's possible to see what are all these statements in one transaction: set group_concat_max_len = 1000000; select t.thread_id, t.event_id, count(*) statement_count, sum(s.rows_affected) rows_affected, group_concat(sql_text order by s.event_id separator 'n') statements from performance_schema.events_transactions_history_long t join performance_schema.events_statements_history_long s on t.thread_id = s.thread_id and t.event_id = s.nesting_event_id group by t.thread_id, t.event_id order by statement_count desc limit 1G Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.   91 / 126
Find the transactions with most rows affected   select t.thread_id, t.event_id, count(*) statement_count, sum(s.rows_affected) rows_affected, length(replace(group_concat( case when s.event_name = "statement/sql/update" then 1 when s.event_name = "statement/sql/insert" then 1 when s.event_name = "statement/sql/delete" then 1 else null end),',','')) as "# write statements" from performance_schema.events_transactions_history_long t join performance_schema.events_statements_history_long s on t.thread_id = s.thread_id and t.event_id = s.nesting_event_id group by t.thread_id, t.event_id order by rows_affected desc limit 10; Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.   92 / 126
Find the transactions with most rows affected It's again possible the see what are the statements: select t.thread_id, t.event_id, count(*) statement_count, sum(s.rows_affected) rows_affected, group_concat(sql_text order by s.event_id separator 'n') statements from performance_schema.events_transactions_history_long t join performance_schema.events_statements_history_long s on t.thread_id = s.thread_id and t.event_id = s.nesting_event_id group by t.thread_id, t.event_id order by rows_affected desc limit 1G Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.   93 / 126
Find the transactions with most rows affected It's again possible the see what are the statements: select t.thread_id, t.event_id, count(*) statement_count, sum(s.rows_affected) rows_affected, group_concat(sql_text order by s.event_id separator 'n') statements from performance_schema.events_transactions_history_long t join performance_schema.events_statements_history_long s on t.thread_id = s.thread_id and t.event_id = s.nesting_event_id group by t.thread_id, t.event_id order by rows_affected desc limit 1G Don't forget to verify the auto_commit ones are they are not returned with the query above. Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.   94 / 126
Find largest statements by row affected   select query, db, rows_affected, rows_affected_avg from sys.statement_analysis order by rows_affected_avg desc limit 10; Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.   95 / 126
Find queries that write the most. Looking for lots of updates/timer_wait to the same PKs.   select * from performance_schema.events_statements_history_long where rows_affected > 1 order by timer_wait desc limit 20G Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.   96 / 126
help me to configure my InnoDB Cluster Using new cool tools Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 97 / 126
MySQL Shell The MySQL Teamextended MySQL Shell to use the newAdmin API. NowMySQL Shell is a single unified client for all adminstrative and operatons tasks. Multi-Language: Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 98 / 126
MySQL Shell The MySQL Teamextended MySQL Shell to use the newAdmin API. NowMySQL Shell is a single unified client for all adminstrative and operatons tasks. Multi-Language: JavaScript Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 99 / 126
MySQL Shell The MySQL Teamextended MySQL Shell to use the newAdmin API. NowMySQL Shell is a single unified client for all adminstrative and operatons tasks. Multi-Language: JavaScript Python Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 100 / 126
MySQL Shell The MySQL Teamextended MySQL Shell to use the newAdmin API. NowMySQL Shell is a single unified client for all adminstrative and operatons tasks. Multi-Language: JavaScript Python SQL Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 101 / 126
MySQL Shell The MySQL Teamextended MySQL Shell to use the newAdmin API. NowMySQL Shell is a single unified client for all adminstrative and operatons tasks. Multi-Language: JavaScript Python SQL Supports both Document and Relational models Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 102 / 126
MySQL Shell The MySQL Teamextended MySQL Shell to use the newAdmin API. NowMySQL Shell is a single unified client for all adminstrative and operatons tasks. Multi-Language: JavaScript Python SQL Supports both Document and Relational models Exposes full Development and Admin API Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 103 / 126
MySQL Shell: Admin API mysql-js>dba.help() Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 104 / 126
MySQL Shell: Admin API mysql-js>dba.help() the global variable dbais used to access the MySQL API Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 105 / 126
MySQL Shell: Admin API mysql-js>dba.help() the global variable dbais used to access the MySQL API performDBA operations to manage MySQL InnoDB Cluster: Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 106 / 126
MySQL Shell: Admin API mysql-js>dba.help() the global variable dbais used to access the MySQL API performDBA operations to manage MySQL InnoDB Cluster: create cluster Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 107 / 126
MySQL Shell: Admin API mysql-js>dba.help() the global variable dbais used to access the MySQL API performDBA operations to manage MySQL InnoDB Cluster: create cluster deploy MySQL instances (in sandbox only for the moment) Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 108 / 126
MySQL Shell: Admin API mysql-js>dba.help() the global variable dbais used to access the MySQL API performDBA operations to manage MySQL InnoDB Cluster: create cluster deploy MySQL instances (in sandbox only for the moment) get cluster info Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 109 / 126
MySQL Shell: Admin API mysql-js>dba.help() the global variable dbais used to access the MySQL API performDBA operations to manage MySQL InnoDB Cluster: create cluster deploy MySQL instances (in sandbox only for the moment) get cluster info start/stop MySQL instances Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 110 / 126
MySQL Shell: Admin API mysql-js>dba.help() the global variable dbais used to access the MySQL API performDBA operations to manage MySQL InnoDB Cluster: create cluster deploy MySQL instances (in sandbox only for the moment) get cluster info start/stop MySQL instances validate MySQL instances Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 111 / 126
mysqlprovision The mysqlprovision utility is designed to facilitate the management of MySQL Group Replication, allowing users to start a replica set (a newreplication group), to add/remove members to/froman existing group. It can also check if an instance meets all the requirements to successfully create a newgroup or to be added to an existing group. This utility is also capable of modifying MySQL option files of existing instances in order for themto meet the requirements of Group Replication. Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 112 / 126
let's create our first MySQL InnoDB Cluster Demo time ! Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 113 / 126
MySQL InnoDB Cluster demo Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 114 / 126
full HA ? Application interaction Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 115 / 126
MySQL Router MySQL Shell MySQL Group Replication MySQL Server MySQL InnoDB Cluster So MySQL InnoDB Cluster is composed by: Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 116 / 126
MySQL Router MySQL Shell MySQL Group Replication MySQL Server MySQL InnoDB Cluster So MySQL InnoDB Cluster is composed by:   CON2907 - MySQL High Availability - MattLord- Wed 12:15 Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 117 / 126
MySQL Router Transparent client connection routing (TCP level 4) load balancing connection failover Native support for InnoDB Clusters understands Group Replication topology utilizes metadata schema stored on each members bootstrap and auto-config supports multi-master and single primary modes Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 118 / 126
MySQL Router & Group Replication Quick demo ! Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 119 / 126
MySQL Router & Group Replication demo Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 120 / 126
Any other alternatives ? Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 121 / 126
Any other alternatives ? It's possible to use MySQL Group Replication with other proxies/load-balancers Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 122 / 126
Any other alternatives ? It's possible to use MySQL Group Replication with other proxies/load-balancers HAProxy : http://lefred.be/content/mysql-group-replication-as-ha-solution/ Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 123 / 126
ProxySQL : http://lefred.be/content/ha-with-mysql-group-replication-and-proxysql/ Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 124 / 126
Questions ? Thank you !       Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 125 / 126
Join us! Register: http://tinyurl.com/mysqloow16 MySQL Community Reception @ Oracle OpenWorld Tuesday, September 20, 7.00 pm Jillian’s at Metreon: 175 Fourth Street, San Francisco At the corner of Howard and 4th st.; only 2-min walk fromMoscone Center (same place as last year) Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 126 / 126

MySQL InnoDB Cluster - Group Replication

  • 1.
  • 2.
    MySQL Group Replicationin a nutshell the core of MySQL InnoDB Cluster   Oracle Open World September 19th 2016   Frédéric Descamps MySQL Community Manager Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 2 / 126
  • 3.
      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 @ 2016 Oracle and/or its affiliates. All rights reserved. 3 / 126
  • 4.
    Join us! MySQL CommunityReception @ Oracle OpenWorld Celebrate, Have Fun and Mingle with Oracle’s MySQL Engineers & Your Peers Tuesday, September 20, 7.00 pm Jillian’s at Metreon: 175 Fourth Street, San Francisco At the corner of Howard and 4th st.; only 2-min walk fromMoscone Center (same place as last year) Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 4 / 126
  • 5.
    about.me/lefred Who am I? Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 5 / 126
  • 6.
    Frédéric Descamps @lefred MySQL Evangelist ManagingMySQL since 3.23 devops believer Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 6 / 126
  • 7.
    get more atthe conference MySQL Group Replication Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 7 / 126
  • 8.
    Other sessions CON2907 -MySQL High Availability MattLord CON4669 - MySQL High Availability with Group Replication NunoGomes CON3373 - The State of the Art of MySQL Replication LuisSoares HOL2912 - Building a Highly Available MySQL Database Service with Group Replication MattLord Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 8 / 126
  • 9.
  • 10.
    Agenda Group Replication concepts Usingnew&cool tools Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 10 / 126
  • 11.
    Agenda Group Replication concepts Usingnew&cool tools Application interaction Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 11 / 126
  • 12.
    the magic explained GroupReplication Concept Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 12 / 126
  • 13.
    Group Replication :what is it ? Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 13 / 126
  • 14.
    Group Replication :what is it ? MySQL is one of the major components of MySQL InnoDB Cluster Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 14 / 126
  • 15.
    Group Replication :what is it ? MySQL is one of the major components of MySQL InnoDB Cluster   Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 15 / 126
  • 16.
  • 17.
  • 18.
    Group replication isa plugin ! Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 18 / 126
  • 19.
    Group replication isa plugin ! GR is a plugin for MySQL, made by MySQL and packaged with MySQL Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 19 / 126
  • 20.
    Group replication isa plugin ! GR is a plugin for MySQL, made by MySQL and packaged with MySQL GR is an implementation of Replicated Database State Machine theory MySQL Group Communication System(GCS) is based on Paxos Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 20 / 126
  • 21.
    Group replication isa plugin ! GR is a plugin for MySQL, made by MySQL and packaged with MySQL GR is an implementation of Replicated Database State Machine theory MySQL Group Communication System(GCS) is based on Paxos Provides virtually synchronous replication for MySQL 5.7+ Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 21 / 126
  • 22.
    Group replication isa plugin ! GR is a plugin for MySQL, made by MySQL and packaged with MySQL GR is an implementation of Replicated Database State Machine theory MySQL Group Communication System(GCS) is based on Paxos Provides virtually synchronous replication for MySQL 5.7+ Supported on all MySQL platforms !! Linux, Windows, Solaris, OSX, FreeBSD Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 22 / 126
  • 23.
  • 24.
    Group Replication :how does it work ? Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 24 / 126
  • 25.
    Group Replication :how does it work ? A node (member of the group) send the changes (binlog events) made by a transaction to the group through the GCS. Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 25 / 126
  • 26.
    Group Replication :how does it work ? A node (member of the group) send the changes (binlog events) made by a transaction to the group through the GCS. All members consume the writeset and certify it Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 26 / 126
  • 27.
    Group Replication :how does it work ? A node (member of the group) send the changes (binlog events) made by a transaction to the group through the GCS. All members consume the writeset and certify it If passed it is applied, if failed, transaction is rolled back on originating server and discarded at other servers. Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 27 / 126
  • 28.
    OK... but howdoes it work ?! Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 28 / 126
  • 29.
    OK... but howdoes it work ?! It's just magic ! Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 29 / 126
  • 30.
    OK... but howdoes it work ?! It's just magic ! ... no, in fact the writesets replication is synchronous and then certification and apply of the changes are local to each nodes and asynchronous. Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 30 / 126
  • 31.
    OK... but howdoes it work ?! It's just magic ! ... no, in fact the writesets replication is synchronous and then certification and apply of the changes are local to each nodes and asynchronous. not that easy to understand... right ? Let's illustrate this... Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 31 / 126
  • 32.
    MySQL Group Replication(autocommit) Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 32 / 126
  • 33.
    MySQL Group Replication(autocommit) Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 33 / 126
  • 34.
    MySQL Group Replication(autocommit) Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 34 / 126
  • 35.
    MySQL Group Replication(autocommit) Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 35 / 126
  • 36.
    MySQL Group Replication(autocommit) Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 36 / 126
  • 37.
    MySQL Group Replication(autocommit) Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 37 / 126
  • 38.
    MySQL Group Replication(autocommit) Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 38 / 126
  • 39.
    MySQL Group Replication(full transaction) Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 39 / 126
  • 40.
    MySQL Group Replication(full transaction) Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 40 / 126
  • 41.
    MySQL Group Replication(full transaction) Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 41 / 126
  • 42.
    MySQL Group Replication(full transaction) Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 42 / 126
  • 43.
    MySQL Group Replication(full transaction) Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 43 / 126
  • 44.
    MySQL Group Replication(full transaction) Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 44 / 126
  • 45.
    MySQL Group Replication(full transaction) Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 45 / 126
  • 46.
    MySQL Group Replication(full transaction) Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 46 / 126
  • 47.
    MySQL Group Replication(full transaction) Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 47 / 126
  • 48.
    Group Replication :Optimistic Locking With GR we use what we call optimistic locking, it means we consider a resource free and this will be confirmed or not during certification. Let's first have a look at the traditional locking to compare. Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 48 / 126
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.
  • 55.
  • 56.
  • 57.
  • 58.
  • 59.
  • 60.
  • 61.
    Optimistic Locking The systemreturnserror 149 as certification failed: ERROR 1180 (HY000): Got error 149 during COMMIT Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 61 / 126
  • 62.
    Group Replication :requirements exclusively use of InnoDB tables only Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 62 / 126
  • 63.
    Group Replication :requirements exclusively use of InnoDB tables only every tables must have a PK defined Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 63 / 126
  • 64.
    Group Replication :requirements exclusively use of InnoDB tables only every tables must have a PK defined only IPV4 is supported Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 64 / 126
  • 65.
    Group Replication :requirements exclusively use of InnoDB tables only every tables must have a PK defined only IPV4 is supported a good network with lowlatency is important Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 65 / 126
  • 66.
    Group Replication :requirements exclusively use of InnoDB tables only every tables must have a PK defined only IPV4 is supported a good network with lowlatency is important maximumof 9 members per group Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 66 / 126
  • 67.
    Group Replication :requirements exclusively use of InnoDB tables only every tables must have a PK defined only IPV4 is supported a good network with lowlatency is important maximumof 9 members per group log-binmust be enabled and only ROWformat is supported Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 67 / 126
  • 68.
    Group Replication :requirements (2) enable GTIDs Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 68 / 126
  • 69.
    Group Replication :requirements (2) enable GTIDs replication meta-data must be stored on systemtables --master-info-repository=TABLE --relay-log-info-repository=TABLE Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 69 / 126
  • 70.
    Group Replication :requirements (2) enable GTIDs replication meta-data must be stored on systemtables --master-info-repository=TABLE --relay-log-info-repository=TABLE writesets extraction must be enabled --transaction-write-set-extraction=XXHASH64 Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 70 / 126
  • 71.
    Group Replication :requirements (2) enable GTIDs replication meta-data must be stored on systemtables --master-info-repository=TABLE --relay-log-info-repository=TABLE writesets extraction must be enabled --transaction-write-set-extraction=XXHASH64 log-slave-updatesmust be enabled Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 71 / 126
  • 72.
    Group Replication :limitations There are also some technical limitations: Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 72 / 126
  • 73.
    Group Replication :limitations There are also some technical limitations: binlog checksumis not supported --binlog-checksum=NONE Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 73 / 126
  • 74.
    Group Replication :limitations There are also some technical limitations: binlog checksumis not supported --binlog-checksum=NONE Savepoints are not supported Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 74 / 126
  • 75.
    Group Replication :limitations There are also some technical limitations: binlog checksumis not supported --binlog-checksum=NONE Savepoints are not supported SERIALIZABLEis not supported as transaction isolation level Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 75 / 126
  • 76.
    Group Replication :limitations There are also some technical limitations: binlog checksumis not supported --binlog-checksum=NONE Savepoints are not supported SERIALIZABLEis not supported as transaction isolation level an object cannot be changed concurrently at different servers by two operations, where one of themis a DDL and the other is either a DML or DDL. Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 76 / 126
  • 77.
    are we compatible? Pre-study Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 77 / 126
  • 78.
    Is my workloadready for Group Replication ? Large transactions are more vulnerable because: Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 78 / 126
  • 79.
    Is my workloadready for Group Replication ? Large transactions are more vulnerable because: Large write set may increase the likelihood of certification conflicts Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 79 / 126
  • 80.
    Is my workloadready for Group Replication ? Large transactions are more vulnerable because: Large write set may increase the likelihood of certification conflicts Transaction taking longer to execute may be more vulnerable to be aborted by a certified transaction. Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 80 / 126
  • 81.
    Is my workloadready for Group Replication ? Large transactions are more vulnerable because: Large write set may increase the likelihood of certification conflicts Transaction taking longer to execute may be more vulnerable to be aborted by a certified transaction. Small transactions changing a very small set of data (hotspots): Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 81 / 126
  • 82.
    Is my workloadready for Group Replication ? Large transactions are more vulnerable because: Large write set may increase the likelihood of certification conflicts Transaction taking longer to execute may be more vulnerable to be aborted by a certified transaction. Small transactions changing a very small set of data (hotspots): Concurrently executing themat different sites will trade-off contention with roll backs due to the optimistic execution Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 82 / 126
  • 83.
    Therefore, when usingGroup Replication, we should pay attention to these points: PK is mandatory (and a good one is better) avoid large transactions avoid hotspot Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 83 / 126
  • 84.
    Scheme verification We willsee nowa list a queries that allows us to analyze our scheme. We will look for: non InnoDB tables tables without PK tables with a bad PK Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 84 / 126
  • 85.
    Non InnoDB tables   SELECTtable_schema, table_name, engine, table_rows, (index_length+data_length)/1024/1024 AS sizeMB FROM information_schema.tables WHERE engine != 'innodb' AND table_schema NOT IN ('information_schema', 'mysql', 'performance_schema'); Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.   85 / 126
  • 86.
    Tables Without PrimaryKey select tables.table_schema, tables.table_name, tables.engine, tables.table_rows from information_schema.tables left join ( select table_schema, table_name from information_schema.statistics group by table_schema, table_name, index_name having sum( case when non_unique = 0 and nullable != 'YES' then 1 else 0 end ) = count(*) ) puks on tables.table_schema = puks.table_schema and tables.table_name = puks.table_name where puks.table_name is null and tables.table_type = 'BASE TABLE' and engine='InnoDB'; Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.   86 / 126
  • 87.
    Tables with badprimarky keys   set SQL_MODE=""; select a.TABLE_SCHEMA,a.TABLE_NAME, b.ENGINE, a.COLUMN_NAME, a.DATA_TYPE, a.COLUMN_TYPE, a.COLUMN_KEY, b.TABLE_ROWS from information_schema.COLUMNS as a join information_schema.TABLES as b on b.TABLE_NAME=a.TABLE_NAME and b.TABLE_SCHEMA=a.TABLE_SCHEMA where COLUMN_KEY='PRI' and ENGINE="InnoDB" and DATA_TYPE not like '%int' and DATA_TYPE not like 'enum%' and DATA_TYPE not like 'date%' and DATA_TYPE not like 'time%' and a.TABLE_SCHEMA not in ('mysql','sys') group by table_schema, table_name; Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.   87 / 126
  • 88.
    Workload analysis Nowit's timeto play with Performance_Schemato analyze our workload. The goal is to identify: transactions with most statements (and most writes in particular) transactions with most rows affected largest statements by rowaffected queries updating most the same PK and therefore having to wait more) Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 88 / 126
  • 89.
    Setup Performance_Schema We needto enable some consumers and instruments: update performance_schema.setup_consumers set enabled = 'yes' where name like 'events_statement%' or name like 'events_transaction%'; update performance_schema.setup_instruments set enabled = 'yes', timed = 'yes' where name = 'transaction'; Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.   89 / 126
  • 90.
    Find the transactionswith most statements   select t.thread_id, t.event_id, count(*) statement_count, sum(s.rows_affected) rows_affected, length(replace(group_concat( case when s.event_name = "statement/sql/update" then 1 when s.event_name = "statement/sql/insert" then 1 when s.event_name = "statement/sql/delete" then 1 else null end),',','')) as "# write statements" from performance_schema.events_transactions_history_long t join performance_schema.events_statements_history_long s on t.thread_id = s.thread_id and t.event_id = s.nesting_event_id group by t.thread_id, t.event_id order by rows_affected desc limit 10; Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.   90 / 126
  • 91.
    Find the transactionswith most statements It's possible to see what are all these statements in one transaction: set group_concat_max_len = 1000000; select t.thread_id, t.event_id, count(*) statement_count, sum(s.rows_affected) rows_affected, group_concat(sql_text order by s.event_id separator 'n') statements from performance_schema.events_transactions_history_long t join performance_schema.events_statements_history_long s on t.thread_id = s.thread_id and t.event_id = s.nesting_event_id group by t.thread_id, t.event_id order by statement_count desc limit 1G Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.   91 / 126
  • 92.
    Find the transactionswith most rows affected   select t.thread_id, t.event_id, count(*) statement_count, sum(s.rows_affected) rows_affected, length(replace(group_concat( case when s.event_name = "statement/sql/update" then 1 when s.event_name = "statement/sql/insert" then 1 when s.event_name = "statement/sql/delete" then 1 else null end),',','')) as "# write statements" from performance_schema.events_transactions_history_long t join performance_schema.events_statements_history_long s on t.thread_id = s.thread_id and t.event_id = s.nesting_event_id group by t.thread_id, t.event_id order by rows_affected desc limit 10; Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.   92 / 126
  • 93.
    Find the transactionswith most rows affected It's again possible the see what are the statements: select t.thread_id, t.event_id, count(*) statement_count, sum(s.rows_affected) rows_affected, group_concat(sql_text order by s.event_id separator 'n') statements from performance_schema.events_transactions_history_long t join performance_schema.events_statements_history_long s on t.thread_id = s.thread_id and t.event_id = s.nesting_event_id group by t.thread_id, t.event_id order by rows_affected desc limit 1G Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.   93 / 126
  • 94.
    Find the transactionswith most rows affected It's again possible the see what are the statements: select t.thread_id, t.event_id, count(*) statement_count, sum(s.rows_affected) rows_affected, group_concat(sql_text order by s.event_id separator 'n') statements from performance_schema.events_transactions_history_long t join performance_schema.events_statements_history_long s on t.thread_id = s.thread_id and t.event_id = s.nesting_event_id group by t.thread_id, t.event_id order by rows_affected desc limit 1G Don't forget to verify the auto_commit ones are they are not returned with the query above. Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.   94 / 126
  • 95.
    Find largest statementsby row affected   select query, db, rows_affected, rows_affected_avg from sys.statement_analysis order by rows_affected_avg desc limit 10; Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.   95 / 126
  • 96.
    Find queries thatwrite the most. Looking for lots of updates/timer_wait to the same PKs.   select * from performance_schema.events_statements_history_long where rows_affected > 1 order by timer_wait desc limit 20G Copyright @ 2016 Oracle and/or its affiliates. All rights reserved.   96 / 126
  • 97.
    help me toconfigure my InnoDB Cluster Using new cool tools Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 97 / 126
  • 98.
    MySQL Shell The MySQLTeamextended MySQL Shell to use the newAdmin API. NowMySQL Shell is a single unified client for all adminstrative and operatons tasks. Multi-Language: Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 98 / 126
  • 99.
    MySQL Shell The MySQLTeamextended MySQL Shell to use the newAdmin API. NowMySQL Shell is a single unified client for all adminstrative and operatons tasks. Multi-Language: JavaScript Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 99 / 126
  • 100.
    MySQL Shell The MySQLTeamextended MySQL Shell to use the newAdmin API. NowMySQL Shell is a single unified client for all adminstrative and operatons tasks. Multi-Language: JavaScript Python Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 100 / 126
  • 101.
    MySQL Shell The MySQLTeamextended MySQL Shell to use the newAdmin API. NowMySQL Shell is a single unified client for all adminstrative and operatons tasks. Multi-Language: JavaScript Python SQL Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 101 / 126
  • 102.
    MySQL Shell The MySQLTeamextended MySQL Shell to use the newAdmin API. NowMySQL Shell is a single unified client for all adminstrative and operatons tasks. Multi-Language: JavaScript Python SQL Supports both Document and Relational models Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 102 / 126
  • 103.
    MySQL Shell The MySQLTeamextended MySQL Shell to use the newAdmin API. NowMySQL Shell is a single unified client for all adminstrative and operatons tasks. Multi-Language: JavaScript Python SQL Supports both Document and Relational models Exposes full Development and Admin API Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 103 / 126
  • 104.
    MySQL Shell: AdminAPI mysql-js>dba.help() Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 104 / 126
  • 105.
    MySQL Shell: AdminAPI mysql-js>dba.help() the global variable dbais used to access the MySQL API Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 105 / 126
  • 106.
    MySQL Shell: AdminAPI mysql-js>dba.help() the global variable dbais used to access the MySQL API performDBA operations to manage MySQL InnoDB Cluster: Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 106 / 126
  • 107.
    MySQL Shell: AdminAPI mysql-js>dba.help() the global variable dbais used to access the MySQL API performDBA operations to manage MySQL InnoDB Cluster: create cluster Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 107 / 126
  • 108.
    MySQL Shell: AdminAPI mysql-js>dba.help() the global variable dbais used to access the MySQL API performDBA operations to manage MySQL InnoDB Cluster: create cluster deploy MySQL instances (in sandbox only for the moment) Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 108 / 126
  • 109.
    MySQL Shell: AdminAPI mysql-js>dba.help() the global variable dbais used to access the MySQL API performDBA operations to manage MySQL InnoDB Cluster: create cluster deploy MySQL instances (in sandbox only for the moment) get cluster info Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 109 / 126
  • 110.
    MySQL Shell: AdminAPI mysql-js>dba.help() the global variable dbais used to access the MySQL API performDBA operations to manage MySQL InnoDB Cluster: create cluster deploy MySQL instances (in sandbox only for the moment) get cluster info start/stop MySQL instances Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 110 / 126
  • 111.
    MySQL Shell: AdminAPI mysql-js>dba.help() the global variable dbais used to access the MySQL API performDBA operations to manage MySQL InnoDB Cluster: create cluster deploy MySQL instances (in sandbox only for the moment) get cluster info start/stop MySQL instances validate MySQL instances Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 111 / 126
  • 112.
    mysqlprovision The mysqlprovision utilityis designed to facilitate the management of MySQL Group Replication, allowing users to start a replica set (a newreplication group), to add/remove members to/froman existing group. It can also check if an instance meets all the requirements to successfully create a newgroup or to be added to an existing group. This utility is also capable of modifying MySQL option files of existing instances in order for themto meet the requirements of Group Replication. Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 112 / 126
  • 113.
    let's create ourfirst MySQL InnoDB Cluster Demo time ! Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 113 / 126
  • 114.
  • 115.
    full HA ? Applicationinteraction Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 115 / 126
  • 116.
    MySQL Router MySQL Shell MySQLGroup Replication MySQL Server MySQL InnoDB Cluster So MySQL InnoDB Cluster is composed by: Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 116 / 126
  • 117.
    MySQL Router MySQL Shell MySQLGroup Replication MySQL Server MySQL InnoDB Cluster So MySQL InnoDB Cluster is composed by:   CON2907 - MySQL High Availability - MattLord- Wed 12:15 Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 117 / 126
  • 118.
    MySQL Router Transparent clientconnection routing (TCP level 4) load balancing connection failover Native support for InnoDB Clusters understands Group Replication topology utilizes metadata schema stored on each members bootstrap and auto-config supports multi-master and single primary modes Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 118 / 126
  • 119.
    MySQL Router &Group Replication Quick demo ! Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 119 / 126
  • 120.
    MySQL Router &Group Replication demo Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 120 / 126
  • 121.
    Any other alternatives? Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 121 / 126
  • 122.
    Any other alternatives? It's possible to use MySQL Group Replication with other proxies/load-balancers Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 122 / 126
  • 123.
    Any other alternatives? It's possible to use MySQL Group Replication with other proxies/load-balancers HAProxy : http://lefred.be/content/mysql-group-replication-as-ha-solution/ Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 123 / 126
  • 124.
  • 125.
    Questions ? Thank you!       Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 125 / 126
  • 126.
    Join us! Register: http://tinyurl.com/mysqloow16 MySQLCommunity Reception @ Oracle OpenWorld Tuesday, September 20, 7.00 pm Jillian’s at Metreon: 175 Fourth Street, San Francisco At the corner of Howard and 4th st.; only 2-min walk fromMoscone Center (same place as last year) Copyright @ 2016 Oracle and/or its affiliates. All rights reserved. 126 / 126