Sven Sandberg MySQL Replication Core Team Lead sven.sandberg@oracle.com slideshare.net/svensandberg High Availability in MySQL 8 using InnoDB Cluster
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.2 Safe Harbour Statement The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.3 Overview Write everywhere is cool MySQL InnoDB Cluster = MySQL Group Replication + MySQL Shell + MySQL Router
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.4 Overview Write everywhere is cool MySQL InnoDB Cluster = MySQL Group Replication + MySQL Shell + MySQL Router
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.5 Overview Write everywhere is cool MySQL InnoDB Cluster = MySQL Group Replication + MySQL Shell + MySQL Router
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.6 Overview Write everywhere is cool MySQL InnoDB Cluster = MySQL Group Replication + MySQL Shell + MySQL Router
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.7 Overview Write everywhere is cool MySQL InnoDB Cluster = MySQL Group Replication + MySQL Shell + MySQL Router
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.8 Overview Open Source! Write everywhere is cool MySQL InnoDB Cluster = MySQL Group Replication + MySQL Shell + MySQL Router
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.9 Overview Open Source! Write everywhere is cool MySQL InnoDB Cluster = MySQL Group Replication + MySQL Shell + MySQL Router MySQL 8
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.10 Overview Write everywhere is cool MySQL InnoDB Cluster = MySQL Group Replication + MySQL Shell + MySQL Router Open Source! MySQL 8
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.11 ex-MySQL Serverex- Traditional MySQL Database mysqld App MySQL Connector MySQL Client
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.12 ex-MySQL Serverex- Traditional MySQL Database mysqld App MySQL Connector MySQL Client
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.13 ex-MySQL Serverex- Traditional MySQL Database mysqld App MySQL Connector MySQL Client
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.14 ex-MySQL Serverex- Traditional MySQL Database mysqld App MySQL Connector MySQL Client
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.15 ex-MySQL Serverex- Traditional MySQL Database mysqld Not Highly Available! App MySQL Connector MySQL Client
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.16 ex-MySQL Serverex- Traditional MySQL Database mysqld Not Highly Available! SPOF App MySQL Connector MySQL Client
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.17 ex-MySQL Serverex- Traditional MySQL Database mysqld Not Highly Available! SPOF App MySQL Connector MySQL Client
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.18 Traditional MySQL Database ex-MySQL Serverex- Not Highly Available! App MySQL Connector MySQL Client
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.19 MySQL Group Replication Highly Available MySQL with InnoDB Cluster mysqld mysqld mysqld MySQL Router App MySQL Connector MySQL Shell
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.20 MySQL Group Replication Highly Available MySQL with InnoDB Cluster mysqld mysqld mysqld MySQL Router App MySQL Connector MySQL Shell
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.21 MySQL Group Replication Highly Available MySQL with InnoDB Cluster mysqld mysqld mysqld MySQL Router App MySQL Connector MySQL Shell
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.22 MySQL Group Replication Highly Available MySQL with InnoDB Cluster mysqld mysqld mysqld MySQL Router App MySQL Connector MySQL Shell
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.23 MySQL Group Replication Highly Available MySQL with InnoDB Cluster mysqld mysqld mysqld InnoDB Cluster: ● Elastic ● Highly available ● Read scale-out ● Write everywhere* MySQL Router App MySQL Connector MySQL Shell
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.24 MySQL Group Replication Highly Available MySQL with InnoDB Cluster mysqld mysqld mysqld InnoDB Cluster: ● Elastic ● Highly available ● Read scale-out ● Write everywhere* MySQL Router App MySQL Connector MySQL Shell
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.25 MySQL Group Replication Highly Available MySQL with InnoDB Cluster mysqld mysqld mysqld InnoDB Cluster: ● Elastic ● Highly available ● Read scale-out ● Write everywhere* mysqld MySQL Router App MySQL Connector MySQL Shell
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.26 MySQL Group Replication Highly Available MySQL with InnoDB Cluster mysqld mysqld mysqld InnoDB Cluster: ● Elastic ● Highly available ● Read scale-out ● Write everywhere* mysqld cluster.addInstance(“user@host:3306”) MySQL Router App MySQL Connector MySQL Shell
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.27 MySQL Group Replication Highly Available MySQL with InnoDB Cluster mysqld mysqld mysqld InnoDB Cluster: ● Elastic ● Highly available ● Read scale-out ● Write everywhere* cluster.addInstance(“user@host:3306”) mysqld MySQL Router App MySQL Connector MySQL Shell
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.28 MySQL Group Replication Highly Available MySQL with InnoDB Cluster mysqld mysqld mysqld InnoDB Cluster: ● Elastic ● Highly available ● Read scale-out ● Write everywhere* cluster.removeInstance(“user@host:3306”) mysqld MySQL Router App MySQL Connector MySQL Shell
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.29 MySQL Group Replication Highly Available MySQL with InnoDB Cluster mysqld mysqld mysqld InnoDB Cluster: ● Elastic ● Highly available ● Read scale-out ● Write everywhere* cluster.removeInstance(“user@host:3306”) mysqld MySQL Router App MySQL Connector MySQL Shell
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.30 MySQL Group Replication Highly Available MySQL with InnoDB Cluster mysqld mysqld mysqld InnoDB Cluster: ● Elastic ● Highly available ● Read scale-out ● Write everywhere* MySQL Router App MySQL Connector MySQL Shell
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.31 MySQL Group Replication Highly Available MySQL with InnoDB Cluster mysqld mysqld mysqld InnoDB Cluster: ● Elastic ● Highly available ● Read scale-out ● Write everywhere* MySQL Router App MySQL Connector MySQL Shell
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.32 MySQL Group Replication Highly Available MySQL with InnoDB Cluster mysqld mysqld InnoDB Cluster: ● Elastic ● Highly available ● Read scale-out ● Write everywhere* MySQL Router App MySQL Connector MySQL Shell
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.33 MySQL Group Replication Highly Available MySQL with InnoDB Cluster mysqld mysqld InnoDB Cluster: ● Elastic ● Highly available ● Read scale-out ● Write everywhere* mysqld MySQL Router App MySQL Connector MySQL Shell
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.34 MySQL Group Replication Highly Available MySQL with InnoDB Cluster mysqld mysqld InnoDB Cluster: ● Elastic ● Highly available ● Read scale-out ● Write everywhere* mysqld cluster.addInstance(“user@host:3306”) MySQL Router App MySQL Connector MySQL Shell
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.35 MySQL Group Replication Highly Available MySQL with InnoDB Cluster mysqld mysqld mysqld InnoDB Cluster: ● Elastic ● Highly available ● Read scale-out ● Write everywhere* MySQL Router App MySQL Connector MySQL Shell cluster.addInstance(“user@host:3306”)
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.36 MySQL Group Replication Highly Available MySQL with InnoDB Cluster mysqld mysqld mysqld InnoDB Cluster: ● Elastic ● Highly available ● Read scale-out ● Write everywhere* MySQL Router App MySQL Connector MySQL Shell R/W R R
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.37 MySQL Group Replication Highly Available MySQL with InnoDB Cluster mysqld mysqld mysqld InnoDB Cluster: ● Elastic ● Highly available ● Read scale-out ● Write everywhere* MySQL Router App MySQL Connector MySQL Shell R/W R R INSERT
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.38 MySQL Group Replication Highly Available MySQL with InnoDB Cluster mysqld mysqld mysqld InnoDB Cluster: ● Elastic ● Highly available ● Read scale-out ● Write everywhere* MySQL Router App MySQL Connector MySQL Shell R/W R R UPDATE
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.39 MySQL Group Replication Highly Available MySQL with InnoDB Cluster mysqld mysqld mysqld InnoDB Cluster: ● Elastic ● Highly available ● Read scale-out ● Write everywhere* MySQL Router App MySQL Connector MySQL Shell R/W R R DELETE
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.40 MySQL Group Replication Highly Available MySQL with InnoDB Cluster mysqld mysqld mysqld InnoDB Cluster: ● Elastic ● Highly available ● Read scale-out ● Write everywhere* MySQL Router App MySQL Connector MySQL Shell R/W R R SELECT
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.41 MySQL Group Replication Highly Available MySQL with InnoDB Cluster mysqld mysqld mysqld InnoDB Cluster: ● Elastic ● Highly available ● Read scale-out ● Write everywhere* MySQL Router App MySQL Connector MySQL Shell R/W R R SELECT
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.42 MySQL Group Replication Highly Available MySQL with InnoDB Cluster mysqld mysqld mysqld InnoDB Cluster: ● Elastic ● Highly available ● Read scale-out ● Write everywhere* MySQL Router App MySQL Connector MySQL Shell R/W R R
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.43 MySQL Group Replication Highly Available MySQL with InnoDB Cluster InnoDB Cluster: ● Elastic ● Highly available ● Read scale-out ● Write everywhere* MySQL Router App MySQL Connector MySQL Shell R mysqld mysqld R/W
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.44 MySQL Group Replication Highly Available MySQL with InnoDB Cluster InnoDB Cluster: ● Elastic ● Highly available ● Read scale-out ● Write everywhere* MySQL Router App MySQL Connector MySQL Shell R mysqld mysqld R/W mysqld
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.45 MySQL Group Replication Highly Available MySQL with InnoDB Cluster InnoDB Cluster: ● Elastic ● Highly available ● Read scale-out ● Write everywhere* MySQL Router App MySQL Connector MySQL Shell R mysqld mysqld R/W mysqld cluster.addInstance(“user@host:3306”)
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.46 MySQL Group Replication Highly Available MySQL with InnoDB Cluster InnoDB Cluster: ● Elastic ● Highly available ● Read scale-out ● Write everywhere* MySQL Router App MySQL Connector MySQL Shell RR/W cluster.addInstance(“user@host:3306”) R mysqld mysqldmysqld
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.47 MySQL Group Replication Highly Available MySQL with InnoDB Cluster InnoDB Cluster: ● Elastic ● Highly available ● Read scale-out ● Write everywhere* MySQL Router App MySQL Connector MySQL Shell R/WR/W mysqld mysqldmysqld R/W
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.48 MySQL Group Replication Highly Available MySQL with InnoDB Cluster InnoDB Cluster: ● Elastic ● Highly available ● Read scale-out ● Write everywhere* MySQL Router App MySQL Connector MySQL Shell R/WR/W mysqld mysqldmysqld R/W But: know the restrictions* Write everywhere is cool Write everywhere is cool https://dev.mysql.com/doc/refman/8.0/en/group-replication-limitations.html* https://dev.mysql.com/doc/refman/8.0/en/group-replication-limitations.html
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.49 Overview MySQL InnoDB Cluster = MySQL Group Replication + MySQL Shell + MySQL Router Open Source! MySQL 8
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.50 Overview MySQL InnoDB Cluster = MySQL Group Replication + MySQL Shell + MySQL Router Open Source! MySQL 8
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.51 Group Replication: Agenda  Group Communication System  Transactions  Recovery  Multi-Primary
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.52 Group Replication: Communication System Group Communication System 1. Membership 2. Total order broadcast A B C
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.53 Group Replication: Communication System Group Communication System 1. Membership 2. Total order broadcast A B C
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.54 Group Replication: Communication System Group Communication System 1. Membership 2. Total order broadcast A B C Write everywhere is cool All members agree on who is a member
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.55 Group Replication: Communication System Group Communication System 1. Membership 2. Total order broadcast A B C We are three: A, B, C We are three: A, B, C We are three: A, B, C Write everywhere is cool All members agree on who is a member
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.56 Group Replication: Communication System Group Communication System 1. Membership 2. Total order broadcast A B C Write everywhere is cool All members agree on who is a member
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.57 Group Replication: Communication System Group Communication System 1. Membership 2. Total order broadcast A B Write everywhere is cool All members agree on who is a member
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.58 Group Replication: Communication System Group Communication System 1. Membership 2. Total order broadcast A B You and me: A and B You and me: A and B Write everywhere is cool All members agree on who is a member
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.59 Group Replication: Communication System Group Communication System 1. Membership 2. Total order broadcast A B CHANNEL_NAME ID HOST PORT STATE ROLE VERSION group_replication_applier e0853bd4-6479-48af-b0df-31c3c3f8d1aa emil 3310 ONLINE PRIMARY 8.0.14 group_replication_applier 64e2b6e5-9036-4e8f-9c2c-ff915c074495 pippi 3310 ONLINE SECONDARY 8.0.14 > SELECT * FROM performance_schema.replication_group_members; Write everywhere is cool All members agree on who is a member
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.60 Group Replication: Communication System Group Communication System 1. Membership 2. Total order broadcast A B Write everywhere is cool All members agree on who is a member CHANNEL_NAME ID HOST PORT STATE ROLE VERSION group_replication_applier e0853bd4-6479-48af-b0df-31c3c3f8d1aa emil 3310 ONLINE PRIMARY 8.0.14 group_replication_applier 64e2b6e5-9036-4e8f-9c2c-ff915c074495 pippi 3310 ONLINE SECONDARY 8.0.14 group_replication_applier 7ffeca3b-3e13-4f35-b7d2-9eb9c32a3dc1 lotta 3310 ONLINE SECONDARY 8.0.14 > SELECT * FROM performance_schema.replication_group_members; C
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.61 Z Group Replication: Communication System Group Communication System 1. Membership 2. Total order broadcast A B All members receive all messages C Y X Z Y X Z Y X
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.62 Z Group Replication: Communication System Group Communication System 1. Membership 2. Total order broadcast A B All members receive all messages C Y X Z Y X Z Y X … in the same order
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.63 Group Replication: Agenda  Group Communication System  Transactions  Recovery  Multi-Primary
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.64 Group Replication: Agenda  Group Communication System  Transactions  Recovery  Multi-Primary
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.65 Group Replication: Transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.66 Group Replication: Transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.67 Group Replication: Transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.68 Group Replication: Transactions Simplified picture Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.69 Group Replication: Transactions Transaction Simplified picture Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.70 Group Replication: Transactions Simplified picture Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.71 Group Replication: Transactions Simplified picture Transaction Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.72 Group Replication: Transactions Simplified picture Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.73 Group Replication: Transactions Simplified picture Transaction Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.74 Group Replication: Transactions Simplified picture Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.75 Group Replication: Transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.76 Group Replication: Transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.77 Group Replication: Transactions Hypothetical scenario ? Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.78 Group Replication: Transactions Hypothetical scenario ? Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.79 Group Replication: Transactions Hypothetical scenario ? Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.80 Group Replication: Transactions Transaction Hypothetical scenario ? Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.81 Group Replication: Transactions Hypothetical scenario ? Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.82 Group Replication: Transactions Transaction Hypothetical scenario ? Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.83 Group Replication: Transactions Hypothetical scenario ? Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.84 Group Replication: Transactions This is split-brain! Inconsistent states! Hypothetical scenario ? Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.85 Group Replication: Transactions This is split-brain! Inconsistent states! Write everywhere is cool Group Replication PROTECTS against split-brain. So this can’t happen. Hypothetical scenario ? Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.86 Group Replication: Transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.87 Group Replication: Transactions ! What actually happens Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.88 Group Replication: Transactions Transaction ! What actually happens Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.89 Group Replication: Transactions Transaction ! What actually happens Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.90 Group Replication: Transactions ! What actually happens Transaction Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.91 Group Replication: Transactions ! What actually happens Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.92 Group Replication: Transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.93 Group Replication: Transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent Transaction
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.94 Group Replication: Transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.95 Group Replication: Transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.96 Group Replication: Transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.97 Group Replication: Transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.98 Group Replication: Transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.99 Group Replication: Transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent Transaction remains after 2 failures
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.100 Group Replication: Transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent Transaction remains after 2 failures
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.101 Group Replication: Transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent Operational Non-operational
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.102 Group Replication: Transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.103 Group Replication: Transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.104 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.105 Group Replication: Transactions Wait in queue Apply Commit Transaction Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.106 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.107 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.108 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.109 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.110 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.111 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.112 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.113 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.114 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.115 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.116 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.117 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.118 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.119 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.120 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.121 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.122 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.123 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.124 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.125 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.126 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent Transaction
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.127 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.128 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.129 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.130 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.131 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.132 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.133 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.134 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.135 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.136 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.137 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.138 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.139 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.140 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.141 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.142 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.143 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.144 Group Replication: Transactions Wait in queue Apply Commit Transaction Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.145 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.146 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.147 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.148 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent Transaction
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.149 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.150 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.151 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.152 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.153 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.154 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.155 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.156 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.157 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.158 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.159 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.160 Group Replication: Agenda  Group Communication System  Transactions  Recovery  Multi-Primary
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.161 Group Replication: Agenda  Group Communication System  Transactions  Recovery  Multi-Primary
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.162 Group Replication: Recovery Special logic when member joins the group: 1. Join group 2. Catch up with old transactions - and cache transactions that group applies during catch-up 3. Catch up with cached transactions
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.163 Group Replication: Recovery
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.164 Group Replication: Recovery Server left the group
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.165 Group Replication: Recovery Server left the group
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.166 Group Replication: Recovery Server left the group Server re-joined the group recovery channel
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.167 Group Replication: Recovery Server left the group Server re-joined the group recovery channel
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.168 Group Replication: Recovery Server left the group Server re-joined the group recovery channel
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.169 Group Replication: Recovery Server left the group Server re-joined the group recovery channel
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.170 Group Replication: Recovery Server left the group Server re-joined the group recovery channel
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.171 Server left the group Server re-joined the group Group Replication: Recovery Server finished replicating through recovery channel
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.172 Server left the group Server re-joined the group Group Replication: Recovery Server finished replicating through recovery channel
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.173 Server left the group Server re-joined the group Group Replication: Recovery Server finished replicating through recovery channel
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.174 Server left the group Server re-joined the group Group Replication: Recovery Server finished replicating through recovery channel
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.175 Server left the group Server re-joined the group Group Replication: Recovery Server finished replicating through recovery channel
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.176 Server left the group Server re-joined the group Group Replication: Recovery Server finished replicating through recovery channel Caught up and ONLINE!
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.177 Group Replication: Agenda  Group Communication System  Transactions  Recovery  Multi-Primary
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.178 Group Replication: Agenda  Group Communication System  Transactions  Recovery  Multi-Primary
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.179 Group Replication: Multi-Primary  Configure the group so that every member accepts writes SET @@global.group_replication_single_primary_mode = OFF; Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.180 Group Replication: Multi-Primary  Configure the group so that every member accepts writes SET @@global.group_replication_single_primary_mode = OFF; Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.181 Group Replication: Multi-Primary  Configure the group so that every member accepts writes SET @@global.group_replication_single_primary_mode = OFF; Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.182 Group Replication: Multi-Primary  Configure the group so that every member accepts writes SET @@global.group_replication_single_primary_mode = OFF; Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.183 Group Replication: Multi-Primary mysqld mysqldmysqld Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution mysqld mysqldmysqld writes CPU connections Multi-Primary:  Is better if connections are a bottleneck  Is better if CPU is a bottleneck  Makes no difference if writes are the only bottleneck Single-Primary Multi-Primary
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.184 Group Replication: Multi-Primary mysqld mysqldmysqld Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution mysqld mysqldmysqld writes CPU connections Multi-Primary:  Is better if connections are a bottleneck  Is better if CPU is a bottleneck  Makes no difference if writes are the only bottleneck Single-Primary Multi-Primary
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.185 Group Replication: Multi-Primary mysqld mysqldmysqld Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution mysqld mysqldmysqld writes CPU connections Multi-Primary:  Is better if connections are a bottleneck  Is better if CPU is a bottleneck  Makes no difference if writes are the only bottleneck Single-Primary Multi-Primary
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.186 Group Replication: Multi-Primary mysqld mysqldmysqld Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution mysqld mysqldmysqld writes CPU connections Multi-Primary:  Is better if connections are a bottleneck  Is better if CPU is a bottleneck  Makes no difference if writes are the only bottleneck Single-Primary Multi-Primary
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.187 Group Replication: Multi-Primary mysqld mysqldmysqld Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution mysqld mysqldmysqld writes CPU connections Multi-Primary:  Is better if connections are a bottleneck  Is better if CPU is a bottleneck  Makes no difference if writes are the only bottleneck Single-Primary Multi-Primary
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.188 Group Replication: Multi-Primary mysqld mysqldmysqld Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution mysqld mysqldmysqld writes CPU connections Multi-Primary:  Is better if connections are a bottleneck  Is better if CPU is a bottleneck  Makes no difference if writes are the only bottleneck Single-Primary Multi-Primary
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.189 Group Replication: Multi-Primary mysqld mysqldmysqld Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution mysqld mysqldmysqld writes CPU connections Multi-Primary:  Is better if connections are a bottleneck  Is better if CPU is a bottleneck  Makes no difference if writes are the only bottleneck Single-Primary Multi-Primary
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.190 Group Replication: Multi-Primary mysqld mysqldmysqld Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution mysqld mysqldmysqld writes CPU connections Multi-Primary:  Is better if connections are a bottleneck  Is better if CPU is a bottleneck  Makes no difference if writes are the only bottleneck Single-Primary Multi-Primary
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.191 Group Replication: Multi-Primary mysqld mysqldmysqld Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution mysqld mysqldmysqld writes CPU connections Multi-Primary:  Is better if connections are a bottleneck  Is better if CPU is a bottleneck  Makes no difference if writes are the only bottleneck Single-Primary Multi-Primary
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.192 Group Replication: Multi-Primary mysqld mysqldmysqld Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution mysqld mysqldmysqld writes CPU connections Multi-Primary:  Is better if connections are a bottleneck  Is better if CPU is a bottleneck  Makes no difference if writes are the only bottleneck Single-Primary Multi-Primary
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.193 Group Replication: Multi-Primary MySQL Router Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution #2 #3mysqld #5 #6mysqld Single-Primary Multi-Primary MySQL Router
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.194 Group Replication: Multi-Primary MySQL Router Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution #2 #3mysqld #5 #6mysqld Single-Primary Multi-Primary MySQL Router
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.195 Group Replication: Multi-Primary MySQL Router Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution #2 #3 #5 #6 Single-Primary Multi-Primary MySQL Router I can’t hear #4. I can fail over to #5 now.
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.196 Group Replication: Multi-Primary MySQL Router Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution #2 #3 #5 #6 Single-Primary Multi-Primary MySQL Router I can’t hear #4. I can fail over to #5 now. I can’t hear #1. I’ll ask the group who is the new primary.
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.197 Group Replication: Multi-Primary MySQL Router Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution #2 #3 #5 #6 Single-Primary Multi-Primary MySQL Router I can’t hear #4. I can fail over to #5 now. I can’t hear #1. Let me wait 5 seconds, then agree with the group I can’t hear #1. Let me wait 5 seconds, then agree with the group I can’t hear #1. I’ll ask the group who is the new primary.
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.198 Group Replication: Multi-Primary Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.199 Group Replication: Multi-Primary Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution Two parallel transactions updating different rows = OK
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.200 Group Replication: Multi-Primary Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution Two parallel transactions updating different rows = OK
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.201 Group Replication: Multi-Primary Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution Two parallel transactions updating different rows = OK
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.202 Group Replication: Multi-Primary Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution Two parallel transactions updating different rows = OK Two sequential transactions updating the same rows = OK
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.203 Group Replication: Multi-Primary Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution Two parallel transactions updating different rows = OK Two sequential transactions updating the same rows = OK
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.204 Group Replication: Multi-Primary Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution Two parallel transactions updating different rows = OK Two sequential transactions updating the same rows = OK
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.205 Group Replication: Multi-Primary Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution Two parallel transactions updating different rows = OK Two sequential transactions updating the same rows = OK
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.206 Group Replication: Multi-Primary Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution Two parallel transactions updating different rows = OK Two sequential transactions updating the same rows = OK
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.207 Group Replication: Multi-Primary Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution Two parallel transactions updating different rows = OK Two sequential transactions updating the same rows = OK
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.208 Group Replication: Multi-Primary Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution Two parallel transactions updating different rows = OK Two sequential transactions updating the same rows = OK Two parallel transactions updating the same rows = CONFLICT The first to broadcast wins. The other one rolls back.
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.209 Group Replication: Multi-Primary Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution Two parallel transactions updating different rows = OK Two sequential transactions updating the same rows = OK Two parallel transactions updating the same rows = CONFLICT The first to broadcast wins. The other one rolls back.
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.210 Group Replication: Multi-Primary Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution Two parallel transactions updating different rows = OK Two sequential transactions updating the same rows = OK Two parallel transactions updating the same rows = CONFLICT The first to broadcast wins. The other one rolls back.
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.211 Group Replication: Multi-Primary Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution Two parallel transactions updating different rows = OK Two sequential transactions updating the same rows = OK Two parallel transactions updating the same rows = CONFLICT The first to broadcast wins. The other one rolls back.
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.212 Group Replication: Multi-Primary Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution Two parallel transactions updating different rows = OK Two sequential transactions updating the same rows = OK Two parallel transactions updating the same rows = CONFLICT The first to broadcast wins. The other one rolls back.
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.213 Group Replication: Multi-Primary Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution Two parallel transactions updating different rows = OK Two sequential transactions updating the same rows = OK Two parallel transactions updating the same rows = CONFLICT The first to broadcast wins. The other one rolls back.
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.214 Group Replication: Multi-Primary Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution Two parallel transactions updating different rows = OK Two sequential transactions updating the same rows = OK Two parallel transactions updating the same rows = CONFLICT The first to broadcast wins. The other one rolls back. Beware of hotspots
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.215 Group Replication: Multi-Primary Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution Two parallel transactions updating different rows = OK Two sequential transactions updating the same rows = OK Two parallel transactions updating the same rows = CONFLICT The first to broadcast wins. The other one rolls back. Beware of hotspots
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.216 Group Replication: Agenda  Group Communication System  Transactions  Recovery  Multi-Primary
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.217 Overview MySQL InnoDB Cluster = MySQL Group Replication + MySQL Shell + MySQL Router Open Source! MySQL 8
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.218 Overview MySQL InnoDB Cluster = MySQL Group Replication + MySQL Shell + MySQL Router Open Source! MySQL 8
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.219 MySQL Group Replication mysqld mysqld mysqld MySQL Router App MySQL Connector MySQL Shell MySQL Shell: easy setup of InnoDB Cluster
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.220 MySQL Shell: easy setup of InnoDB Cluster  Admin API – Groups: configure, create, status – Members: configure, add, remove – Sandbox servers: easy-to-use test servers  Javascript, Python, SQL  NoSQL / DocStore API  Beautiful prompt :-)
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.221 MySQL Shell: easy setup of InnoDB Cluster  Admin API – Groups: configure, create, status – Members: configure, add, remove – Sandbox servers: easy-to-use test servers  Javascript, Python, SQL  NoSQL / DocStore API  Beautiful prompt :-)
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.222 MySQL Shell: setup InnoDB Cluster easily  Start shell: $ mysqlsh  Create three servers: MySQL JS dba.deploySandboxInstance(3310) MySQL JS dba.deploySandboxInstance(3311) MySQL JS dba.deploySandboxInstance(3312)  Connect to one server. Create a cluster with this member: MySQL JS connect root@localhost:3310 MySQL localhost:3310 ssl JS cluster = dba.createCluster(‘my_cluster’)  Add the other two members: MySQL localhost:3310 ssl JS cluster.addInstance(‘root@localhost:3311’) MySQL localhost:3310 ssl JS cluster.addInstance(‘root@localhost:3312’)
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.223  Start shell: $ mysqlsh  Create three servers: MySQL JS dba.deploySandboxInstance(3310) MySQL JS dba.deploySandboxInstance(3311) MySQL JS dba.deploySandboxInstance(3312)  Connect to one server. Create a cluster with this member: MySQL JS connect root@localhost:3310 MySQL localhost:3310 ssl JS cluster = dba.createCluster(‘my_cluster’)  Add the other two members: MySQL localhost:3310 ssl JS cluster.addInstance(‘root@localhost:3311’) MySQL localhost:3310 ssl JS cluster.addInstance(‘root@localhost:3312’) MySQL Shell: setup InnoDB Cluster easily
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.224  Start shell: $ mysqlsh  Create three servers: MySQL JS dba.deploySandboxInstance(3310) MySQL JS dba.deploySandboxInstance(3311) MySQL JS dba.deploySandboxInstance(3312)  Connect to one server. Create a cluster with this member: MySQL JS connect root@localhost:3310 MySQL localhost:3310 ssl JS cluster = dba.createCluster(‘my_cluster’)  Add the other two members: MySQL localhost:3310 ssl JS cluster.addInstance(‘root@localhost:3311’) MySQL localhost:3310 ssl JS cluster.addInstance(‘root@localhost:3312’) MySQL Shell: setup InnoDB Cluster easily shell
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.225  Start shell: $ mysqlsh  Create three servers: MySQL JS dba.deploySandboxInstance(3310) MySQL JS dba.deploySandboxInstance(3311) MySQL JS dba.deploySandboxInstance(3312)  Connect to one server. Create a cluster with this member: MySQL JS connect root@localhost:3310 MySQL localhost:3310 ssl JS cluster = dba.createCluster(‘my_cluster’)  Add the other two members: MySQL localhost:3310 ssl JS cluster.addInstance(‘root@localhost:3311’) MySQL localhost:3310 ssl JS cluster.addInstance(‘root@localhost:3312’) MySQL Shell: setup InnoDB Cluster easily No sandboxes in production shell
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.226  Start shell: $ mysqlsh  Create three servers: MySQL JS dba.deploySandboxInstance(3310) MySQL JS dba.deploySandboxInstance(3311) MySQL JS dba.deploySandboxInstance(3312)  Connect to one server. Create a cluster with this member: MySQL JS connect root@localhost:3310 MySQL localhost:3310 ssl JS cluster = dba.createCluster(‘my_cluster’)  Add the other two members: MySQL localhost:3310 ssl JS cluster.addInstance(‘root@localhost:3311’) MySQL localhost:3310 ssl JS cluster.addInstance(‘root@localhost:3312’) MySQL Shell: setup InnoDB Cluster easily 3310 No sandboxes in production shell
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.227  Start shell: $ mysqlsh  Create three servers: MySQL JS dba.deploySandboxInstance(3310) MySQL JS dba.deploySandboxInstance(3311) MySQL JS dba.deploySandboxInstance(3312)  Connect to one server. Create a cluster with this member: MySQL JS connect root@localhost:3310 MySQL localhost:3310 ssl JS cluster = dba.createCluster(‘my_cluster’)  Add the other two members: MySQL localhost:3310 ssl JS cluster.addInstance(‘root@localhost:3311’) MySQL localhost:3310 ssl JS cluster.addInstance(‘root@localhost:3312’) MySQL Shell: setup InnoDB Cluster easily 3310 3311 No sandboxes in production shell
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.228  Start shell: $ mysqlsh  Create three servers: MySQL JS dba.deploySandboxInstance(3310) MySQL JS dba.deploySandboxInstance(3311) MySQL JS dba.deploySandboxInstance(3312)  Connect to one server. Create a cluster with this member: MySQL JS connect root@localhost:3310 MySQL localhost:3310 ssl JS cluster = dba.createCluster(‘my_cluster’)  Add the other two members: MySQL localhost:3310 ssl JS cluster.addInstance(‘root@localhost:3311’) MySQL localhost:3310 ssl JS cluster.addInstance(‘root@localhost:3312’) MySQL Shell: setup InnoDB Cluster easily 3310 3311 3312 shell
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.229  Start shell: $ mysqlsh  Create three servers: MySQL JS dba.deploySandboxInstance(3310) MySQL JS dba.deploySandboxInstance(3311) MySQL JS dba.deploySandboxInstance(3312)  Connect to one server. Create a cluster with this member: MySQL JS connect root@localhost:3310 MySQL localhost:3310 ssl JS cluster = dba.createCluster(‘my_cluster’)  Add the other two members: MySQL localhost:3310 ssl JS cluster.addInstance(‘root@localhost:3311’) MySQL localhost:3310 ssl JS cluster.addInstance(‘root@localhost:3312’) MySQL Shell: setup InnoDB Cluster easily 3310 3311 3312 shell
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.230  Start shell: $ mysqlsh  Create three servers: MySQL JS dba.deploySandboxInstance(3310) MySQL JS dba.deploySandboxInstance(3311) MySQL JS dba.deploySandboxInstance(3312)  Connect to one server. Create a cluster with this member: MySQL JS connect root@localhost:3310 MySQL localhost:3310 ssl JS cluster = dba.createCluster(‘my_cluster’)  Add the other two members: MySQL localhost:3310 ssl JS cluster.addInstance(‘root@localhost:3311’) MySQL localhost:3310 ssl JS cluster.addInstance(‘root@localhost:3312’) MySQL Shell: setup InnoDB Cluster easily 3310 3311 3312 shell
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.231  Start shell: $ mysqlsh  Create three servers: MySQL JS dba.deploySandboxInstance(3310) MySQL JS dba.deploySandboxInstance(3311) MySQL JS dba.deploySandboxInstance(3312)  Connect to one server. Create a cluster with this member: MySQL JS connect root@localhost:3310 MySQL localhost:3310 ssl JS cluster = dba.createCluster(‘my_cluster’)  Add the other two members: MySQL localhost:3310 ssl JS cluster.addInstance(‘root@localhost:3311’) MySQL localhost:3310 ssl JS cluster.addInstance(‘root@localhost:3312’) MySQL Shell: setup InnoDB Cluster easily 3310 3311 3312 shell
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.232  Start shell: $ mysqlsh  Create three servers: MySQL JS dba.deploySandboxInstance(3310) MySQL JS dba.deploySandboxInstance(3311) MySQL JS dba.deploySandboxInstance(3312)  Connect to one server. Create a cluster with this member: MySQL JS connect root@localhost:3310 MySQL localhost:3310 ssl JS cluster = dba.createCluster(‘my_cluster’)  Add the other two members: MySQL localhost:3310 ssl JS cluster.addInstance(‘root@localhost:3311’) MySQL localhost:3310 ssl JS cluster.addInstance(‘root@localhost:3312’) MySQL Shell: setup InnoDB Cluster easily 3310 3311 3312 shell
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.233 MySQL Shell: setup InnoDB Cluster easily  Check the status of the group: MySQL localhost:3310 ssl JS cluster.status() { ... "statusText": "Cluster is ONLINE and can tolerate up to ONE failure.", "topology": { "localhost:3310": { "address": "localhost:3310", "mode": "R/W", "readReplicas": {}, "role": "HA", "status": "ONLINE" }, "localhost:3311": { ... }, "localhost:3312": { ... } } ... }
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.234 MySQL Shell: setup InnoDB Cluster easily  Check the status of the group: MySQL localhost:3310 ssl JS cluster.status() { ... "statusText": "Cluster is ONLINE and can tolerate up to ONE failure.", "topology": { "localhost:3310": { "address": "localhost:3310", "mode": "R/W", "readReplicas": {}, "role": "HA", "status": "ONLINE" }, "localhost:3311": { ... }, "localhost:3312": { ... } } ... }
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.235 MySQL Shell: setup InnoDB Cluster easily  Simulate a failure: MySQL localhost:3310 ssl JS dba.killSandboxInstance(3311) 3310 3311 3312 shell
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.236 MySQL Shell: setup InnoDB Cluster easily  Simulate a failure: MySQL localhost:3310 ssl JS dba.killSandboxInstance(3311) 3310 3311 3312 shell
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.237 MySQL Shell: setup InnoDB Cluster easily  Simulate a failure: MySQL localhost:3310 ssl JS dba.killSandboxInstance(3311) 3310 3312 shell
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.238 MySQL Shell: setup InnoDB Cluster easily  Simulate a failure: MySQL localhost:3310 ssl JS dba.killSandboxInstance(3311)  Check the status of the group: MySQL localhost:3310 ssl JS cluster.status() { ... "statusText": "Cluster is NOT tolerant to any failures. 1 member is not active", "topology": { "localhost:3310": { ... }, "localhost:3311": { ... "status": "UNREACHABLE" }, "localhost:3312": { ... } } ... } 3310 3312 shell
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.239 MySQL Shell: setup InnoDB Cluster easily 3310 3312 shell  Check the status again after a few seconds: MySQL localhost:3310 ssl JS cluster.status() { ... "statusText": "Cluster is NOT tolerant to any failures. 1 member is not active", "topology": { "localhost:3310": { ... }, "localhost:3311": { ... "status": "(MISSING)" }, "localhost:3312": { ... } } ... }
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.240 MySQL Shell: setup InnoDB Cluster easily  Start up the server again: MySQL localhost:3310 ssl JS dba.startSandboxInstance(3311) 3310 3312 shell
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.241 MySQL Shell: setup InnoDB Cluster easily 3310 3312 shell 3311  Start up the server again: MySQL localhost:3310 ssl JS dba.startSandboxInstance(3311)
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.242 MySQL Shell: setup InnoDB Cluster easily  Start up the server again: MySQL localhost:3310 ssl JS dba.startSandboxInstance(3311)  Check the status of the group: MySQL localhost:3310 ssl JS cluster.status() { ... "statusText": "Cluster is NOT tolerant to any failures. 1 member is not active", "topology": { "localhost:3310": { ... }, "localhost:3311": { ... "status": "RECOVERING" }, "localhost:3312": { ... } } ... } 3310 3312 shell 3311
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.243 MySQL Shell: setup InnoDB Cluster easily  Start up the server again: MySQL localhost:3310 ssl JS dba.startSandboxInstance(3311)  Check the status of the group: MySQL localhost:3310 ssl JS cluster.status() { ... "statusText": "Cluster is NOT tolerant to any failures. 1 member is not active", "topology": { "localhost:3310": { ... }, "localhost:3311": { ... "status": "RECOVERING" }, "localhost:3312": { ... } } ... } 3310 3312 shell 3311
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.244 MySQL Shell: setup InnoDB Cluster easily 3310 3312 shell 3311  Check the status after a few seconds: MySQL localhost:3310 ssl JS cluster.status() { ... "statusText": "Cluster is ONLINE and can tolerate up to ONE failure.", "topology": { "localhost:3310": { ... }, "localhost:3311": { ... "status": "ONLINE" }, "localhost:3312": { ... } } ... }
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.245 Overview MySQL InnoDB Cluster = MySQL Group Replication + MySQL Shell + MySQL Router Open Source! MySQL 8
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.246 Overview MySQL InnoDB Cluster = MySQL Group Replication + MySQL Shell + MySQL Router Open Source! MySQL 8
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.247 MySQL Group Replication mysqld mysqld mysqld MySQL Router App MySQL Connector MySQL Shell MySQL Router: Seamless Fail-overs
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.248 MySQL Router: direct queries to the right server 3310 3311 3312shell Router Example 1. Start from a 3 member group 2. Connect Router to the group 3. Connect Shell to Router 4. Crash Server
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.249 MySQL Router: direct queries to the right server $ mysqlrouter --bootstrap root@localhost:3310 --directory /tmp/myrouter $ cd /tmp/myrouter $ ./start.sh ... Classic MySQL protocol connections to cluster 'cluster': - Read/Write Connections: localhost:6446 - Read/Only Connections: localhost:6447 ... shell 3310 3311 3312 Router Example 1. Start from a 3 member group 2. Connect Router to the group 3. Connect Shell to Router 4. Crash Server
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.250 MySQL Router: direct queries to the right server $ mysqlrouter --bootstrap root@localhost:3310 --directory /tmp/myrouter $ cd /tmp/myrouter $ ./start.sh ... Classic MySQL protocol connections to cluster 'cluster': - Read/Write Connections: localhost:6446 - Read/Only Connections: localhost:6447 ... shell MySQL Router 3310 3311 3312 Router Example 1. Start from a 3 member group 2. Connect Router to the group 3. Connect Shell to Router 4. Crash Server
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.251 MySQL Router: direct queries to the right server $ mysqlrouter --bootstrap root@localhost:3310 --directory /tmp/myrouter $ cd /tmp/myrouter $ ./start.sh ... Classic MySQL protocol connections to cluster 'cluster': - Read/Write Connections: localhost:6446 - Read/Only Connections: localhost:6447 ... shell MySQL Router 3310 3311 3312 Router Example 1. Start from a 3 member group 2. Connect Router to the group 3. Connect Shell to Router 4. Crash Server
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.252 MySQL Router: direct queries to the right server $ mysqlrouter --bootstrap root@localhost:3310 --directory /tmp/myrouter $ cd /tmp/myrouter $ ./start.sh ... Classic MySQL protocol connections to cluster 'cluster': - Read/Write Connections: localhost:6446 - Read/Only Connections: localhost:6447 ... shell MySQL Router 3310 3311 3312 6446 6447 Router Example 1. Start from a 3 member group 2. Connect Router to the group 3. Connect Shell to Router 4. Crash Server
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.253 MySQL Router: direct queries to the right server MySQL localhost:3310 ssl JS connect root@localhost:6446 MySQL localhost:6446 ssl JS sql MySQL localhost:6446 ssl SQL SELECT @@port; 3310 MySQL localhost:6446 ssl SQL CREATE DATABASE foo; MySQL localhost:6446 ssl SQL CREATE TABLE foo.bar(a INT PRIMARY KEY); shell MySQL Router 6446 6447 Router Example 1. Start from a 3 member group 2. Connect Router to the group 3. Connect Shell to Router 4. Crash Server 3310 3311 3312
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.254 MySQL localhost:3310 ssl JS connect root@localhost:6446 MySQL localhost:6446 ssl JS sql MySQL localhost:6446 ssl SQL SELECT @@port; 3310 MySQL localhost:6446 ssl SQL CREATE DATABASE foo; MySQL localhost:6446 ssl SQL CREATE TABLE foo.bar(a INT PRIMARY KEY); MySQL Router: direct queries to the right server shell MySQL Router 6446 6447 Router Example 1. Start from a 3 member group 2. Connect Router to the group 3. Connect Shell to Router 4. Crash Server 3310 3311 3312
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.255 MySQL localhost:3310 ssl JS connect root@localhost:6446 MySQL localhost:6446 ssl JS sql MySQL localhost:6446 ssl SQL SELECT @@port; 3310 MySQL localhost:6446 ssl SQL CREATE DATABASE foo; MySQL localhost:6446 ssl SQL CREATE TABLE foo.bar(a INT PRIMARY KEY); MySQL Router: direct queries to the right server shell MySQL Router 6446 6447 Router Example 1. Start from a 3 member group 2. Connect Router to the group 3. Connect Shell to Router 4. Crash Server 3310 3311 3312
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.256 MySQL localhost:3310 ssl JS connect root@localhost:6446 MySQL localhost:6446 ssl JS sql MySQL localhost:6446 ssl SQL SELECT @@port; 3310 MySQL localhost:6446 ssl SQL CREATE DATABASE foo; MySQL localhost:6446 ssl SQL CREATE TABLE foo.bar(a INT PRIMARY KEY); MySQL Router: direct queries to the right server shell MySQL Router 6446 6447 Router Example 1. Start from a 3 member group 2. Connect Router to the group 3. Connect Shell to Router 4. Crash Server 3310 3311 3312
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.257 MySQL localhost:3310 ssl JS connect root@localhost:6446 MySQL localhost:6446 ssl JS sql MySQL localhost:6446 ssl SQL SELECT @@port; 3310 MySQL localhost:6446 ssl SQL CREATE DATABASE foo; MySQL localhost:6446 ssl SQL CREATE TABLE foo.bar(a INT PRIMARY KEY); MySQL Router: direct queries to the right server shell MySQL Router 6446 6447 Router Example 1. Start from a 3 member group 2. Connect Router to the group 3. Connect Shell to Router 4. Crash Server 3310 3311 3312
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.258 MySQL localhost:3310 ssl JS connect root@localhost:6446 MySQL localhost:6446 ssl JS sql MySQL localhost:6446 ssl SQL SELECT @@port; 3310 MySQL localhost:6446 ssl SQL CREATE DATABASE foo; MySQL localhost:6446 ssl SQL CREATE TABLE foo.bar(a INT PRIMARY KEY); MySQL Router: direct queries to the right server shell MySQL Router 6446 6447 Router Example 1. Start from a 3 member group 2. Connect Router to the group 3. Connect Shell to Router 4. Crash Server 3310 3311 3312
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.259 MySQL Router: direct queries to the right server MySQL localhost:6446 ssl SQL connect root@localhost:6447 MySQL localhost:6447 ssl SQL SELECT @@port; 3311 MySQL localhost:6447 ssl SQL reconnect MySQL localhost:6447 ssl SQL SELECT @@port; 3312 MySQL localhost:6447 ssl SQL INSERT INTO foo.bar VALUES (1); ERROR: 1290 (HY000): The MySQL server is running with the --super-read-only option so it cannot execute this statement shell MySQL Router 6446 6447 Router Example 1. Start from a 3 member group 2. Connect Router to the group 3. Connect Shell to Router 4. Crash Server 3310 3311 3312
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.260 MySQL Router: direct queries to the right server shell MySQL Router 6446 6447 Router Example 1. Start from a 3 member group 2. Connect Router to the group 3. Connect Shell to Router 4. Crash Server 3310 3311 3312 MySQL localhost:6446 ssl SQL connect root@localhost:6447 MySQL localhost:6447 ssl SQL SELECT @@port; 3311 MySQL localhost:6447 ssl SQL reconnect MySQL localhost:6447 ssl SQL SELECT @@port; 3312 MySQL localhost:6447 ssl SQL INSERT INTO foo.bar VALUES (1); ERROR: 1290 (HY000): The MySQL server is running with the --super-read-only option so it cannot execute this statement
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.261 MySQL Router: direct queries to the right server shell MySQL Router 6446 6447 Router Example 1. Start from a 3 member group 2. Connect Router to the group 3. Connect Shell to Router 4. Crash Server 3310 3311 3312 MySQL localhost:6446 ssl SQL connect root@localhost:6447 MySQL localhost:6447 ssl SQL SELECT @@port; 3311 MySQL localhost:6447 ssl SQL reconnect MySQL localhost:6447 ssl SQL SELECT @@port; 3312 MySQL localhost:6447 ssl SQL INSERT INTO foo.bar VALUES (1); ERROR: 1290 (HY000): The MySQL server is running with the --super-read-only option so it cannot execute this statement
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.262 MySQL localhost:6446 ssl SQL connect root@localhost:6447 MySQL localhost:6447 ssl SQL SELECT @@port; 3311 MySQL localhost:6447 ssl SQL reconnect MySQL localhost:6447 ssl SQL SELECT @@port; 3312 MySQL localhost:6447 ssl SQL INSERT INTO foo.bar VALUES (1); ERROR: 1290 (HY000): The MySQL server is running with the --super-read-only option so it cannot execute this statement MySQL Router: direct queries to the right server shell MySQL Router 6446 6447 Router Example 1. Start from a 3 member group 2. Connect Router to the group 3. Connect Shell to Router 4. Crash Server 3310 3311 3312
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.263 MySQL localhost:6446 ssl SQL connect root@localhost:6447 MySQL localhost:6447 ssl SQL SELECT @@port; 3311 MySQL localhost:6447 ssl SQL reconnect MySQL localhost:6447 ssl SQL SELECT @@port; 3312 MySQL localhost:6447 ssl SQL INSERT INTO foo.bar VALUES (1); ERROR: 1290 (HY000): The MySQL server is running with the --super-read-only option so it cannot execute this statement MySQL Router: direct queries to the right server shell MySQL Router 6446 6447 Router Example 1. Start from a 3 member group 2. Connect Router to the group 3. Connect Shell to Router 4. Crash Server 3310 3311 3312
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.264 MySQL localhost:6446 ssl SQL connect root@localhost:6447 MySQL localhost:6447 ssl SQL SELECT @@port; 3311 MySQL localhost:6447 ssl SQL reconnect MySQL localhost:6447 ssl SQL SELECT @@port; 3312 MySQL localhost:6447 ssl SQL INSERT INTO foo.bar VALUES (1); ERROR: 1290 (HY000): The MySQL server is running with the --super-read-only option so it cannot execute this statement MySQL Router: direct queries to the right server shell MySQL Router 6446 6447 Router Example 1. Start from a 3 member group 2. Connect Router to the group 3. Connect Shell to Router 4. Crash Server 3310 3311 3312
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.265 MySQL Router: direct queries to the right server MySQL localhost:6447 ssl SQL js MySQL localhost:3310 ssl JS dba.killSandboxInstance(3312) MySQL localhost:6446 ssl JS sql MySQL localhost:6447 ssl SQL SELECT 1 + 1; ERROR: 2013 (HY000): Lost connection to MySQL server during query The global session got disconnected.. Attempting to reconnect to 'mysql://root@localhost:6447'.. The global session was successfully reconnected. MySQL localhost:6447 ssl SQL SELECT @@port; 3311 shell MySQL Router 6446 6447 Router Example 1. Start from a 3 member group 2. Connect Router to the group 3. Connect Shell to Router 4. Crash Server 3310 3311 3312
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.266 MySQL localhost:6447 ssl SQL js MySQL localhost:3310 ssl JS dba.killSandboxInstance(3312) MySQL localhost:6446 ssl JS sql MySQL localhost:6447 ssl SQL SELECT 1 + 1; ERROR: 2013 (HY000): Lost connection to MySQL server during query The global session got disconnected.. Attempting to reconnect to 'mysql://root@localhost:6447'.. The global session was successfully reconnected. MySQL localhost:6447 ssl SQL SELECT @@port; 3311 MySQL Router: direct queries to the right server shell MySQL Router 6446 6447 Router Example 1. Start from a 3 member group 2. Connect Router to the group 3. Connect Shell to Router 4. Crash Server 3310 3311 3312
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.267 MySQL localhost:6447 ssl SQL js MySQL localhost:3310 ssl JS dba.killSandboxInstance(3312) MySQL localhost:6446 ssl JS sql MySQL localhost:6447 ssl SQL SELECT 1 + 1; ERROR: 2013 (HY000): Lost connection to MySQL server during query The global session got disconnected.. Attempting to reconnect to 'mysql://root@localhost:6447'.. The global session was successfully reconnected. MySQL localhost:6447 ssl SQL SELECT @@port; 3311 MySQL Router: direct queries to the right server shell MySQL Router 3310 3311 6446 6447 3312 Router Example 1. Start from a 3 member group 2. Connect Router to the group 3. Connect Shell to Router 4. Crash Server
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.268 MySQL localhost:6447 ssl SQL js MySQL localhost:3310 ssl JS dba.killSandboxInstance(3312) MySQL localhost:6446 ssl JS sql MySQL localhost:6447 ssl SQL SELECT 1 + 1; ERROR: 2013 (HY000): Lost connection to MySQL server during query The global session got disconnected.. Attempting to reconnect to 'mysql://root@localhost:6447'.. The global session was successfully reconnected. MySQL localhost:6447 ssl SQL SELECT @@port; 3311 MySQL Router: direct queries to the right server shell MySQL Router 6446 6447 Router Example 1. Start from a 3 member group 2. Connect Router to the group 3. Connect Shell to Router 4. Crash Server 3310 3311
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.269 MySQL localhost:6447 ssl SQL js MySQL localhost:3310 ssl JS dba.killSandboxInstance(3312) MySQL localhost:6446 ssl JS sql MySQL localhost:6447 ssl SQL SELECT 1 + 1; ERROR: 2013 (HY000): Lost connection to MySQL server during query The global session got disconnected.. Attempting to reconnect to 'mysql://root@localhost:6447'.. The global session was successfully reconnected. MySQL localhost:6447 ssl SQL SELECT @@port; 3311 MySQL Router: direct queries to the right server shell MySQL Router 6446 6447 Router Example 1. Start from a 3 member group 2. Connect Router to the group 3. Connect Shell to Router 4. Crash Server 3310 3311
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.270 MySQL localhost:6447 ssl SQL js MySQL localhost:3310 ssl JS dba.killSandboxInstance(3312) MySQL localhost:6446 ssl JS sql MySQL localhost:6447 ssl SQL SELECT 1 + 1; ERROR: 2013 (HY000): Lost connection to MySQL server during query The global session got disconnected.. Attempting to reconnect to 'mysql://root@localhost:6447'.. The global session was successfully reconnected. MySQL localhost:6447 ssl SQL SELECT @@port; 3311 MySQL Router: direct queries to the right server shell MySQL Router 6446 6447 Router Example 1. Start from a 3 member group 2. Connect Router to the group 3. Connect Shell to Router 4. Crash Server 3310 3311
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.271 MySQL localhost:6447 ssl SQL js MySQL localhost:3310 ssl JS dba.killSandboxInstance(3312) MySQL localhost:6446 ssl JS sql MySQL localhost:6447 ssl SQL SELECT 1 + 1; ERROR: 2013 (HY000): Lost connection to MySQL server during query The global session got disconnected.. Attempting to reconnect to 'mysql://root@localhost:6447'.. The global session was successfully reconnected. MySQL localhost:6447 ssl SQL SELECT @@port; 3311 MySQL Router: direct queries to the right server shell MySQL Router 6446 6447 Router Example 1. Start from a 3 member group 2. Connect Router to the group 3. Connect Shell to Router 4. Crash Server 3310 3311
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.272 Overview MySQL InnoDB Cluster = MySQL Group Replication + MySQL Shell + MySQL Router Open Source! MySQL 8
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.273 Overview MySQL InnoDB Cluster = MySQL Group Replication + MySQL Shell + MySQL Router Open Source! MySQL 8
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.274 MySQL Group Replication mysqld mysqld mysqld MySQL Router App MySQL Connector MySQL Shell MySQL InnoDB Cluster
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.275 Example code: Shell + Group Replication  Start Shell: $ mysqlsh  Get help: MySQL JS help MySQL JS help dba.deploySandboxInstance etc.  Create a group of three sandbox servers: MySQL JS dba.deploySandboxInstance(3310) MySQL JS dba.deploySandboxInstance(3311) MySQL JS dba.deploySandboxInstance(3312) MySQL JS connect root@localhost:3310 MySQL localhost:3310 ssl JS cluster = dba.createCluster('my_cluster') MySQL localhost:3310 ssl JS cluster.addInstance('root@localhost:3311') MySQL localhost:3310 ssl JS cluster.addInstance('root@localhost:3312') MySQL localhost:3310 ssl JS cluster.status()  Kill and restart a member: MySQL localhost:3310 ssl JS dba.killSandboxInstance(3311) MySQL localhost:3310 ssl JS cluster.status() MySQL localhost:3310 ssl JS dba.startSandboxInstance(3311) MySQL localhost:3310 ssl JS cluster.status()
Copyright © 2018, Oracle and/or its affiliates. All rights reserved.276 Example code: Shell + Group Replication + Router  Start Router: $ mysqlrouter --bootstrap root@localhost:3310 --directory /tmp/myrouter $ cd /tmp/myrouter && ./start.sh  Connect to Router’s read/write port; check that it is writable: MySQL localhost:3310 ssl JS connect root@localhost:6446 MySQL localhost:6446 ssl JS sql MySQL localhost:6446 ssl SQL SELECT @@port; MySQL localhost:6446 ssl SQL CREATE DATABASE foo; MySQL localhost:6446 ssl SQL CREATE TABLE foo.bar(a INT PRIMARY KEY);  Reconnect to Router’s read-only port; reconnect and see that it switches to another member; check that it is read-only: MySQL localhost:6446 ssl SQL connect root@localhost:6447 MySQL localhost:6447 ssl SQL SELECT @@port; MySQL localhost:6447 ssl SQL reconnect MySQL localhost:6447 ssl SQL SELECT @@port; MySQL localhost:6447 ssl SQL INSERT INTO foo.bar VALUES (1);  Kill server and watch Router fail over: MySQL localhost:6447 ssl SQL js MySQL localhost:6447 ssl JS dba.killSandboxInstance(port); MySQL localhost:6447 ssl JS sql MySQL localhost:6447 ssl SQL SELECT 1 + 1; MySQL localhost:6447 ssl SQL SELECT @@port; Note down the result from here... … and use it here

High Availability in MySQL 8 using InnoDB Cluster

  • 1.
    Sven Sandberg MySQL ReplicationCore Team Lead sven.sandberg@oracle.com slideshare.net/svensandberg High Availability in MySQL 8 using InnoDB Cluster
  • 2.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.2 Safe Harbour Statement The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.
  • 3.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.3 Overview Write everywhere is cool MySQL InnoDB Cluster = MySQL Group Replication + MySQL Shell + MySQL Router
  • 4.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.4 Overview Write everywhere is cool MySQL InnoDB Cluster = MySQL Group Replication + MySQL Shell + MySQL Router
  • 5.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.5 Overview Write everywhere is cool MySQL InnoDB Cluster = MySQL Group Replication + MySQL Shell + MySQL Router
  • 6.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.6 Overview Write everywhere is cool MySQL InnoDB Cluster = MySQL Group Replication + MySQL Shell + MySQL Router
  • 7.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.7 Overview Write everywhere is cool MySQL InnoDB Cluster = MySQL Group Replication + MySQL Shell + MySQL Router
  • 8.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.8 Overview Open Source! Write everywhere is cool MySQL InnoDB Cluster = MySQL Group Replication + MySQL Shell + MySQL Router
  • 9.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.9 Overview Open Source! Write everywhere is cool MySQL InnoDB Cluster = MySQL Group Replication + MySQL Shell + MySQL Router MySQL 8
  • 10.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.10 Overview Write everywhere is cool MySQL InnoDB Cluster = MySQL Group Replication + MySQL Shell + MySQL Router Open Source! MySQL 8
  • 11.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.11 ex-MySQL Serverex- Traditional MySQL Database mysqld App MySQL Connector MySQL Client
  • 12.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.12 ex-MySQL Serverex- Traditional MySQL Database mysqld App MySQL Connector MySQL Client
  • 13.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.13 ex-MySQL Serverex- Traditional MySQL Database mysqld App MySQL Connector MySQL Client
  • 14.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.14 ex-MySQL Serverex- Traditional MySQL Database mysqld App MySQL Connector MySQL Client
  • 15.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.15 ex-MySQL Serverex- Traditional MySQL Database mysqld Not Highly Available! App MySQL Connector MySQL Client
  • 16.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.16 ex-MySQL Serverex- Traditional MySQL Database mysqld Not Highly Available! SPOF App MySQL Connector MySQL Client
  • 17.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.17 ex-MySQL Serverex- Traditional MySQL Database mysqld Not Highly Available! SPOF App MySQL Connector MySQL Client
  • 18.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.18 Traditional MySQL Database ex-MySQL Serverex- Not Highly Available! App MySQL Connector MySQL Client
  • 19.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.19 MySQL Group Replication Highly Available MySQL with InnoDB Cluster mysqld mysqld mysqld MySQL Router App MySQL Connector MySQL Shell
  • 20.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.20 MySQL Group Replication Highly Available MySQL with InnoDB Cluster mysqld mysqld mysqld MySQL Router App MySQL Connector MySQL Shell
  • 21.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.21 MySQL Group Replication Highly Available MySQL with InnoDB Cluster mysqld mysqld mysqld MySQL Router App MySQL Connector MySQL Shell
  • 22.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.22 MySQL Group Replication Highly Available MySQL with InnoDB Cluster mysqld mysqld mysqld MySQL Router App MySQL Connector MySQL Shell
  • 23.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.23 MySQL Group Replication Highly Available MySQL with InnoDB Cluster mysqld mysqld mysqld InnoDB Cluster: ● Elastic ● Highly available ● Read scale-out ● Write everywhere* MySQL Router App MySQL Connector MySQL Shell
  • 24.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.24 MySQL Group Replication Highly Available MySQL with InnoDB Cluster mysqld mysqld mysqld InnoDB Cluster: ● Elastic ● Highly available ● Read scale-out ● Write everywhere* MySQL Router App MySQL Connector MySQL Shell
  • 25.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.25 MySQL Group Replication Highly Available MySQL with InnoDB Cluster mysqld mysqld mysqld InnoDB Cluster: ● Elastic ● Highly available ● Read scale-out ● Write everywhere* mysqld MySQL Router App MySQL Connector MySQL Shell
  • 26.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.26 MySQL Group Replication Highly Available MySQL with InnoDB Cluster mysqld mysqld mysqld InnoDB Cluster: ● Elastic ● Highly available ● Read scale-out ● Write everywhere* mysqld cluster.addInstance(“user@host:3306”) MySQL Router App MySQL Connector MySQL Shell
  • 27.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.27 MySQL Group Replication Highly Available MySQL with InnoDB Cluster mysqld mysqld mysqld InnoDB Cluster: ● Elastic ● Highly available ● Read scale-out ● Write everywhere* cluster.addInstance(“user@host:3306”) mysqld MySQL Router App MySQL Connector MySQL Shell
  • 28.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.28 MySQL Group Replication Highly Available MySQL with InnoDB Cluster mysqld mysqld mysqld InnoDB Cluster: ● Elastic ● Highly available ● Read scale-out ● Write everywhere* cluster.removeInstance(“user@host:3306”) mysqld MySQL Router App MySQL Connector MySQL Shell
  • 29.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.29 MySQL Group Replication Highly Available MySQL with InnoDB Cluster mysqld mysqld mysqld InnoDB Cluster: ● Elastic ● Highly available ● Read scale-out ● Write everywhere* cluster.removeInstance(“user@host:3306”) mysqld MySQL Router App MySQL Connector MySQL Shell
  • 30.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.30 MySQL Group Replication Highly Available MySQL with InnoDB Cluster mysqld mysqld mysqld InnoDB Cluster: ● Elastic ● Highly available ● Read scale-out ● Write everywhere* MySQL Router App MySQL Connector MySQL Shell
  • 31.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.31 MySQL Group Replication Highly Available MySQL with InnoDB Cluster mysqld mysqld mysqld InnoDB Cluster: ● Elastic ● Highly available ● Read scale-out ● Write everywhere* MySQL Router App MySQL Connector MySQL Shell
  • 32.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.32 MySQL Group Replication Highly Available MySQL with InnoDB Cluster mysqld mysqld InnoDB Cluster: ● Elastic ● Highly available ● Read scale-out ● Write everywhere* MySQL Router App MySQL Connector MySQL Shell
  • 33.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.33 MySQL Group Replication Highly Available MySQL with InnoDB Cluster mysqld mysqld InnoDB Cluster: ● Elastic ● Highly available ● Read scale-out ● Write everywhere* mysqld MySQL Router App MySQL Connector MySQL Shell
  • 34.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.34 MySQL Group Replication Highly Available MySQL with InnoDB Cluster mysqld mysqld InnoDB Cluster: ● Elastic ● Highly available ● Read scale-out ● Write everywhere* mysqld cluster.addInstance(“user@host:3306”) MySQL Router App MySQL Connector MySQL Shell
  • 35.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.35 MySQL Group Replication Highly Available MySQL with InnoDB Cluster mysqld mysqld mysqld InnoDB Cluster: ● Elastic ● Highly available ● Read scale-out ● Write everywhere* MySQL Router App MySQL Connector MySQL Shell cluster.addInstance(“user@host:3306”)
  • 36.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.36 MySQL Group Replication Highly Available MySQL with InnoDB Cluster mysqld mysqld mysqld InnoDB Cluster: ● Elastic ● Highly available ● Read scale-out ● Write everywhere* MySQL Router App MySQL Connector MySQL Shell R/W R R
  • 37.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.37 MySQL Group Replication Highly Available MySQL with InnoDB Cluster mysqld mysqld mysqld InnoDB Cluster: ● Elastic ● Highly available ● Read scale-out ● Write everywhere* MySQL Router App MySQL Connector MySQL Shell R/W R R INSERT
  • 38.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.38 MySQL Group Replication Highly Available MySQL with InnoDB Cluster mysqld mysqld mysqld InnoDB Cluster: ● Elastic ● Highly available ● Read scale-out ● Write everywhere* MySQL Router App MySQL Connector MySQL Shell R/W R R UPDATE
  • 39.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.39 MySQL Group Replication Highly Available MySQL with InnoDB Cluster mysqld mysqld mysqld InnoDB Cluster: ● Elastic ● Highly available ● Read scale-out ● Write everywhere* MySQL Router App MySQL Connector MySQL Shell R/W R R DELETE
  • 40.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.40 MySQL Group Replication Highly Available MySQL with InnoDB Cluster mysqld mysqld mysqld InnoDB Cluster: ● Elastic ● Highly available ● Read scale-out ● Write everywhere* MySQL Router App MySQL Connector MySQL Shell R/W R R SELECT
  • 41.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.41 MySQL Group Replication Highly Available MySQL with InnoDB Cluster mysqld mysqld mysqld InnoDB Cluster: ● Elastic ● Highly available ● Read scale-out ● Write everywhere* MySQL Router App MySQL Connector MySQL Shell R/W R R SELECT
  • 42.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.42 MySQL Group Replication Highly Available MySQL with InnoDB Cluster mysqld mysqld mysqld InnoDB Cluster: ● Elastic ● Highly available ● Read scale-out ● Write everywhere* MySQL Router App MySQL Connector MySQL Shell R/W R R
  • 43.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.43 MySQL Group Replication Highly Available MySQL with InnoDB Cluster InnoDB Cluster: ● Elastic ● Highly available ● Read scale-out ● Write everywhere* MySQL Router App MySQL Connector MySQL Shell R mysqld mysqld R/W
  • 44.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.44 MySQL Group Replication Highly Available MySQL with InnoDB Cluster InnoDB Cluster: ● Elastic ● Highly available ● Read scale-out ● Write everywhere* MySQL Router App MySQL Connector MySQL Shell R mysqld mysqld R/W mysqld
  • 45.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.45 MySQL Group Replication Highly Available MySQL with InnoDB Cluster InnoDB Cluster: ● Elastic ● Highly available ● Read scale-out ● Write everywhere* MySQL Router App MySQL Connector MySQL Shell R mysqld mysqld R/W mysqld cluster.addInstance(“user@host:3306”)
  • 46.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.46 MySQL Group Replication Highly Available MySQL with InnoDB Cluster InnoDB Cluster: ● Elastic ● Highly available ● Read scale-out ● Write everywhere* MySQL Router App MySQL Connector MySQL Shell RR/W cluster.addInstance(“user@host:3306”) R mysqld mysqldmysqld
  • 47.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.47 MySQL Group Replication Highly Available MySQL with InnoDB Cluster InnoDB Cluster: ● Elastic ● Highly available ● Read scale-out ● Write everywhere* MySQL Router App MySQL Connector MySQL Shell R/WR/W mysqld mysqldmysqld R/W
  • 48.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.48 MySQL Group Replication Highly Available MySQL with InnoDB Cluster InnoDB Cluster: ● Elastic ● Highly available ● Read scale-out ● Write everywhere* MySQL Router App MySQL Connector MySQL Shell R/WR/W mysqld mysqldmysqld R/W But: know the restrictions* Write everywhere is cool Write everywhere is cool https://dev.mysql.com/doc/refman/8.0/en/group-replication-limitations.html* https://dev.mysql.com/doc/refman/8.0/en/group-replication-limitations.html
  • 49.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.49 Overview MySQL InnoDB Cluster = MySQL Group Replication + MySQL Shell + MySQL Router Open Source! MySQL 8
  • 50.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.50 Overview MySQL InnoDB Cluster = MySQL Group Replication + MySQL Shell + MySQL Router Open Source! MySQL 8
  • 51.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.51 Group Replication: Agenda  Group Communication System  Transactions  Recovery  Multi-Primary
  • 52.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.52 Group Replication: Communication System Group Communication System 1. Membership 2. Total order broadcast A B C
  • 53.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.53 Group Replication: Communication System Group Communication System 1. Membership 2. Total order broadcast A B C
  • 54.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.54 Group Replication: Communication System Group Communication System 1. Membership 2. Total order broadcast A B C Write everywhere is cool All members agree on who is a member
  • 55.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.55 Group Replication: Communication System Group Communication System 1. Membership 2. Total order broadcast A B C We are three: A, B, C We are three: A, B, C We are three: A, B, C Write everywhere is cool All members agree on who is a member
  • 56.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.56 Group Replication: Communication System Group Communication System 1. Membership 2. Total order broadcast A B C Write everywhere is cool All members agree on who is a member
  • 57.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.57 Group Replication: Communication System Group Communication System 1. Membership 2. Total order broadcast A B Write everywhere is cool All members agree on who is a member
  • 58.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.58 Group Replication: Communication System Group Communication System 1. Membership 2. Total order broadcast A B You and me: A and B You and me: A and B Write everywhere is cool All members agree on who is a member
  • 59.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.59 Group Replication: Communication System Group Communication System 1. Membership 2. Total order broadcast A B CHANNEL_NAME ID HOST PORT STATE ROLE VERSION group_replication_applier e0853bd4-6479-48af-b0df-31c3c3f8d1aa emil 3310 ONLINE PRIMARY 8.0.14 group_replication_applier 64e2b6e5-9036-4e8f-9c2c-ff915c074495 pippi 3310 ONLINE SECONDARY 8.0.14 > SELECT * FROM performance_schema.replication_group_members; Write everywhere is cool All members agree on who is a member
  • 60.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.60 Group Replication: Communication System Group Communication System 1. Membership 2. Total order broadcast A B Write everywhere is cool All members agree on who is a member CHANNEL_NAME ID HOST PORT STATE ROLE VERSION group_replication_applier e0853bd4-6479-48af-b0df-31c3c3f8d1aa emil 3310 ONLINE PRIMARY 8.0.14 group_replication_applier 64e2b6e5-9036-4e8f-9c2c-ff915c074495 pippi 3310 ONLINE SECONDARY 8.0.14 group_replication_applier 7ffeca3b-3e13-4f35-b7d2-9eb9c32a3dc1 lotta 3310 ONLINE SECONDARY 8.0.14 > SELECT * FROM performance_schema.replication_group_members; C
  • 61.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.61 Z Group Replication: Communication System Group Communication System 1. Membership 2. Total order broadcast A B All members receive all messages C Y X Z Y X Z Y X
  • 62.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.62 Z Group Replication: Communication System Group Communication System 1. Membership 2. Total order broadcast A B All members receive all messages C Y X Z Y X Z Y X … in the same order
  • 63.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.63 Group Replication: Agenda  Group Communication System  Transactions  Recovery  Multi-Primary
  • 64.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.64 Group Replication: Agenda  Group Communication System  Transactions  Recovery  Multi-Primary
  • 65.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.65 Group Replication: Transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 66.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.66 Group Replication: Transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 67.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.67 Group Replication: Transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 68.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.68 Group Replication: Transactions Simplified picture Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 69.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.69 Group Replication: Transactions Transaction Simplified picture Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 70.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.70 Group Replication: Transactions Simplified picture Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 71.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.71 Group Replication: Transactions Simplified picture Transaction Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 72.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.72 Group Replication: Transactions Simplified picture Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 73.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.73 Group Replication: Transactions Simplified picture Transaction Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 74.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.74 Group Replication: Transactions Simplified picture Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 75.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.75 Group Replication: Transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 76.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.76 Group Replication: Transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 77.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.77 Group Replication: Transactions Hypothetical scenario ? Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 78.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.78 Group Replication: Transactions Hypothetical scenario ? Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 79.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.79 Group Replication: Transactions Hypothetical scenario ? Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 80.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.80 Group Replication: Transactions Transaction Hypothetical scenario ? Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 81.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.81 Group Replication: Transactions Hypothetical scenario ? Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 82.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.82 Group Replication: Transactions Transaction Hypothetical scenario ? Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 83.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.83 Group Replication: Transactions Hypothetical scenario ? Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 84.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.84 Group Replication: Transactions This is split-brain! Inconsistent states! Hypothetical scenario ? Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 85.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.85 Group Replication: Transactions This is split-brain! Inconsistent states! Write everywhere is cool Group Replication PROTECTS against split-brain. So this can’t happen. Hypothetical scenario ? Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 86.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.86 Group Replication: Transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 87.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.87 Group Replication: Transactions ! What actually happens Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 88.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.88 Group Replication: Transactions Transaction ! What actually happens Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 89.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.89 Group Replication: Transactions Transaction ! What actually happens Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 90.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.90 Group Replication: Transactions ! What actually happens Transaction Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 91.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.91 Group Replication: Transactions ! What actually happens Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 92.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.92 Group Replication: Transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 93.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.93 Group Replication: Transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent Transaction
  • 94.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.94 Group Replication: Transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 95.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.95 Group Replication: Transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 96.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.96 Group Replication: Transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 97.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.97 Group Replication: Transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 98.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.98 Group Replication: Transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 99.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.99 Group Replication: Transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent Transaction remains after 2 failures
  • 100.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.100 Group Replication: Transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent Transaction remains after 2 failures
  • 101.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.101 Group Replication: Transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent Operational Non-operational
  • 102.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.102 Group Replication: Transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 103.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.103 Group Replication: Transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 104.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.104 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 105.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.105 Group Replication: Transactions Wait in queue Apply Commit Transaction Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 106.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.106 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 107.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.107 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 108.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.108 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 109.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.109 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 110.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.110 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 111.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.111 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 112.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.112 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 113.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.113 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 114.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.114 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 115.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.115 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 116.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.116 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 117.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.117 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 118.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.118 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 119.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.119 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 120.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.120 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 121.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.121 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 122.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.122 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 123.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.123 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 124.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.124 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 125.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.125 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 126.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.126 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent Transaction
  • 127.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.127 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 128.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.128 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 129.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.129 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 130.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.130 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 131.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.131 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 132.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.132 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 133.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.133 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 134.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.134 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 135.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.135 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 136.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.136 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 137.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.137 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 138.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.138 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 139.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.139 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 140.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.140 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 141.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.141 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 142.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.142 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 143.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.143 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 144.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.144 Group Replication: Transactions Wait in queue Apply Commit Transaction Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 145.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.145 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 146.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.146 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 147.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.147 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 148.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.148 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent Transaction
  • 149.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.149 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 150.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.150 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 151.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.151 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 152.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.152 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 153.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.153 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 154.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.154 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 155.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.155 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 156.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.156 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 157.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.157 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 158.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.158 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 159.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.159 Group Replication: Transactions Wait in queue Apply Commit Execute Broadcast Commit Stages of client transactions Stages of replicated transactions Transactions in Group Replication 1. No split-brain → Commit on > N/2 members → Tolerates < N/2 failures 2. Eventually consistent
  • 160.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.160 Group Replication: Agenda  Group Communication System  Transactions  Recovery  Multi-Primary
  • 161.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.161 Group Replication: Agenda  Group Communication System  Transactions  Recovery  Multi-Primary
  • 162.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.162 Group Replication: Recovery Special logic when member joins the group: 1. Join group 2. Catch up with old transactions - and cache transactions that group applies during catch-up 3. Catch up with cached transactions
  • 163.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.163 Group Replication: Recovery
  • 164.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.164 Group Replication: Recovery Server left the group
  • 165.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.165 Group Replication: Recovery Server left the group
  • 166.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.166 Group Replication: Recovery Server left the group Server re-joined the group recovery channel
  • 167.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.167 Group Replication: Recovery Server left the group Server re-joined the group recovery channel
  • 168.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.168 Group Replication: Recovery Server left the group Server re-joined the group recovery channel
  • 169.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.169 Group Replication: Recovery Server left the group Server re-joined the group recovery channel
  • 170.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.170 Group Replication: Recovery Server left the group Server re-joined the group recovery channel
  • 171.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.171 Server left the group Server re-joined the group Group Replication: Recovery Server finished replicating through recovery channel
  • 172.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.172 Server left the group Server re-joined the group Group Replication: Recovery Server finished replicating through recovery channel
  • 173.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.173 Server left the group Server re-joined the group Group Replication: Recovery Server finished replicating through recovery channel
  • 174.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.174 Server left the group Server re-joined the group Group Replication: Recovery Server finished replicating through recovery channel
  • 175.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.175 Server left the group Server re-joined the group Group Replication: Recovery Server finished replicating through recovery channel
  • 176.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.176 Server left the group Server re-joined the group Group Replication: Recovery Server finished replicating through recovery channel Caught up and ONLINE!
  • 177.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.177 Group Replication: Agenda  Group Communication System  Transactions  Recovery  Multi-Primary
  • 178.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.178 Group Replication: Agenda  Group Communication System  Transactions  Recovery  Multi-Primary
  • 179.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.179 Group Replication: Multi-Primary  Configure the group so that every member accepts writes SET @@global.group_replication_single_primary_mode = OFF; Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution
  • 180.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.180 Group Replication: Multi-Primary  Configure the group so that every member accepts writes SET @@global.group_replication_single_primary_mode = OFF; Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution
  • 181.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.181 Group Replication: Multi-Primary  Configure the group so that every member accepts writes SET @@global.group_replication_single_primary_mode = OFF; Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution
  • 182.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.182 Group Replication: Multi-Primary  Configure the group so that every member accepts writes SET @@global.group_replication_single_primary_mode = OFF; Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution
  • 183.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.183 Group Replication: Multi-Primary mysqld mysqldmysqld Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution mysqld mysqldmysqld writes CPU connections Multi-Primary:  Is better if connections are a bottleneck  Is better if CPU is a bottleneck  Makes no difference if writes are the only bottleneck Single-Primary Multi-Primary
  • 184.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.184 Group Replication: Multi-Primary mysqld mysqldmysqld Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution mysqld mysqldmysqld writes CPU connections Multi-Primary:  Is better if connections are a bottleneck  Is better if CPU is a bottleneck  Makes no difference if writes are the only bottleneck Single-Primary Multi-Primary
  • 185.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.185 Group Replication: Multi-Primary mysqld mysqldmysqld Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution mysqld mysqldmysqld writes CPU connections Multi-Primary:  Is better if connections are a bottleneck  Is better if CPU is a bottleneck  Makes no difference if writes are the only bottleneck Single-Primary Multi-Primary
  • 186.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.186 Group Replication: Multi-Primary mysqld mysqldmysqld Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution mysqld mysqldmysqld writes CPU connections Multi-Primary:  Is better if connections are a bottleneck  Is better if CPU is a bottleneck  Makes no difference if writes are the only bottleneck Single-Primary Multi-Primary
  • 187.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.187 Group Replication: Multi-Primary mysqld mysqldmysqld Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution mysqld mysqldmysqld writes CPU connections Multi-Primary:  Is better if connections are a bottleneck  Is better if CPU is a bottleneck  Makes no difference if writes are the only bottleneck Single-Primary Multi-Primary
  • 188.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.188 Group Replication: Multi-Primary mysqld mysqldmysqld Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution mysqld mysqldmysqld writes CPU connections Multi-Primary:  Is better if connections are a bottleneck  Is better if CPU is a bottleneck  Makes no difference if writes are the only bottleneck Single-Primary Multi-Primary
  • 189.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.189 Group Replication: Multi-Primary mysqld mysqldmysqld Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution mysqld mysqldmysqld writes CPU connections Multi-Primary:  Is better if connections are a bottleneck  Is better if CPU is a bottleneck  Makes no difference if writes are the only bottleneck Single-Primary Multi-Primary
  • 190.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.190 Group Replication: Multi-Primary mysqld mysqldmysqld Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution mysqld mysqldmysqld writes CPU connections Multi-Primary:  Is better if connections are a bottleneck  Is better if CPU is a bottleneck  Makes no difference if writes are the only bottleneck Single-Primary Multi-Primary
  • 191.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.191 Group Replication: Multi-Primary mysqld mysqldmysqld Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution mysqld mysqldmysqld writes CPU connections Multi-Primary:  Is better if connections are a bottleneck  Is better if CPU is a bottleneck  Makes no difference if writes are the only bottleneck Single-Primary Multi-Primary
  • 192.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.192 Group Replication: Multi-Primary mysqld mysqldmysqld Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution mysqld mysqldmysqld writes CPU connections Multi-Primary:  Is better if connections are a bottleneck  Is better if CPU is a bottleneck  Makes no difference if writes are the only bottleneck Single-Primary Multi-Primary
  • 193.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.193 Group Replication: Multi-Primary MySQL Router Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution #2 #3mysqld #5 #6mysqld Single-Primary Multi-Primary MySQL Router
  • 194.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.194 Group Replication: Multi-Primary MySQL Router Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution #2 #3mysqld #5 #6mysqld Single-Primary Multi-Primary MySQL Router
  • 195.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.195 Group Replication: Multi-Primary MySQL Router Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution #2 #3 #5 #6 Single-Primary Multi-Primary MySQL Router I can’t hear #4. I can fail over to #5 now.
  • 196.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.196 Group Replication: Multi-Primary MySQL Router Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution #2 #3 #5 #6 Single-Primary Multi-Primary MySQL Router I can’t hear #4. I can fail over to #5 now. I can’t hear #1. I’ll ask the group who is the new primary.
  • 197.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.197 Group Replication: Multi-Primary MySQL Router Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution #2 #3 #5 #6 Single-Primary Multi-Primary MySQL Router I can’t hear #4. I can fail over to #5 now. I can’t hear #1. Let me wait 5 seconds, then agree with the group I can’t hear #1. Let me wait 5 seconds, then agree with the group I can’t hear #1. I’ll ask the group who is the new primary.
  • 198.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.198 Group Replication: Multi-Primary Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution
  • 199.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.199 Group Replication: Multi-Primary Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution Two parallel transactions updating different rows = OK
  • 200.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.200 Group Replication: Multi-Primary Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution Two parallel transactions updating different rows = OK
  • 201.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.201 Group Replication: Multi-Primary Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution Two parallel transactions updating different rows = OK
  • 202.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.202 Group Replication: Multi-Primary Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution Two parallel transactions updating different rows = OK Two sequential transactions updating the same rows = OK
  • 203.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.203 Group Replication: Multi-Primary Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution Two parallel transactions updating different rows = OK Two sequential transactions updating the same rows = OK
  • 204.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.204 Group Replication: Multi-Primary Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution Two parallel transactions updating different rows = OK Two sequential transactions updating the same rows = OK
  • 205.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.205 Group Replication: Multi-Primary Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution Two parallel transactions updating different rows = OK Two sequential transactions updating the same rows = OK
  • 206.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.206 Group Replication: Multi-Primary Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution Two parallel transactions updating different rows = OK Two sequential transactions updating the same rows = OK
  • 207.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.207 Group Replication: Multi-Primary Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution Two parallel transactions updating different rows = OK Two sequential transactions updating the same rows = OK
  • 208.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.208 Group Replication: Multi-Primary Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution Two parallel transactions updating different rows = OK Two sequential transactions updating the same rows = OK Two parallel transactions updating the same rows = CONFLICT The first to broadcast wins. The other one rolls back.
  • 209.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.209 Group Replication: Multi-Primary Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution Two parallel transactions updating different rows = OK Two sequential transactions updating the same rows = OK Two parallel transactions updating the same rows = CONFLICT The first to broadcast wins. The other one rolls back.
  • 210.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.210 Group Replication: Multi-Primary Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution Two parallel transactions updating different rows = OK Two sequential transactions updating the same rows = OK Two parallel transactions updating the same rows = CONFLICT The first to broadcast wins. The other one rolls back.
  • 211.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.211 Group Replication: Multi-Primary Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution Two parallel transactions updating different rows = OK Two sequential transactions updating the same rows = OK Two parallel transactions updating the same rows = CONFLICT The first to broadcast wins. The other one rolls back.
  • 212.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.212 Group Replication: Multi-Primary Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution Two parallel transactions updating different rows = OK Two sequential transactions updating the same rows = OK Two parallel transactions updating the same rows = CONFLICT The first to broadcast wins. The other one rolls back.
  • 213.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.213 Group Replication: Multi-Primary Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution Two parallel transactions updating different rows = OK Two sequential transactions updating the same rows = OK Two parallel transactions updating the same rows = CONFLICT The first to broadcast wins. The other one rolls back.
  • 214.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.214 Group Replication: Multi-Primary Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution Two parallel transactions updating different rows = OK Two sequential transactions updating the same rows = OK Two parallel transactions updating the same rows = CONFLICT The first to broadcast wins. The other one rolls back. Beware of hotspots
  • 215.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.215 Group Replication: Multi-Primary Multi-Primary ● Higher throughput ● Faster fail-over ● Limitations: conflict resolution Two parallel transactions updating different rows = OK Two sequential transactions updating the same rows = OK Two parallel transactions updating the same rows = CONFLICT The first to broadcast wins. The other one rolls back. Beware of hotspots
  • 216.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.216 Group Replication: Agenda  Group Communication System  Transactions  Recovery  Multi-Primary
  • 217.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.217 Overview MySQL InnoDB Cluster = MySQL Group Replication + MySQL Shell + MySQL Router Open Source! MySQL 8
  • 218.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.218 Overview MySQL InnoDB Cluster = MySQL Group Replication + MySQL Shell + MySQL Router Open Source! MySQL 8
  • 219.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.219 MySQL Group Replication mysqld mysqld mysqld MySQL Router App MySQL Connector MySQL Shell MySQL Shell: easy setup of InnoDB Cluster
  • 220.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.220 MySQL Shell: easy setup of InnoDB Cluster  Admin API – Groups: configure, create, status – Members: configure, add, remove – Sandbox servers: easy-to-use test servers  Javascript, Python, SQL  NoSQL / DocStore API  Beautiful prompt :-)
  • 221.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.221 MySQL Shell: easy setup of InnoDB Cluster  Admin API – Groups: configure, create, status – Members: configure, add, remove – Sandbox servers: easy-to-use test servers  Javascript, Python, SQL  NoSQL / DocStore API  Beautiful prompt :-)
  • 222.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.222 MySQL Shell: setup InnoDB Cluster easily  Start shell: $ mysqlsh  Create three servers: MySQL JS dba.deploySandboxInstance(3310) MySQL JS dba.deploySandboxInstance(3311) MySQL JS dba.deploySandboxInstance(3312)  Connect to one server. Create a cluster with this member: MySQL JS connect root@localhost:3310 MySQL localhost:3310 ssl JS cluster = dba.createCluster(‘my_cluster’)  Add the other two members: MySQL localhost:3310 ssl JS cluster.addInstance(‘root@localhost:3311’) MySQL localhost:3310 ssl JS cluster.addInstance(‘root@localhost:3312’)
  • 223.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.223  Start shell: $ mysqlsh  Create three servers: MySQL JS dba.deploySandboxInstance(3310) MySQL JS dba.deploySandboxInstance(3311) MySQL JS dba.deploySandboxInstance(3312)  Connect to one server. Create a cluster with this member: MySQL JS connect root@localhost:3310 MySQL localhost:3310 ssl JS cluster = dba.createCluster(‘my_cluster’)  Add the other two members: MySQL localhost:3310 ssl JS cluster.addInstance(‘root@localhost:3311’) MySQL localhost:3310 ssl JS cluster.addInstance(‘root@localhost:3312’) MySQL Shell: setup InnoDB Cluster easily
  • 224.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.224  Start shell: $ mysqlsh  Create three servers: MySQL JS dba.deploySandboxInstance(3310) MySQL JS dba.deploySandboxInstance(3311) MySQL JS dba.deploySandboxInstance(3312)  Connect to one server. Create a cluster with this member: MySQL JS connect root@localhost:3310 MySQL localhost:3310 ssl JS cluster = dba.createCluster(‘my_cluster’)  Add the other two members: MySQL localhost:3310 ssl JS cluster.addInstance(‘root@localhost:3311’) MySQL localhost:3310 ssl JS cluster.addInstance(‘root@localhost:3312’) MySQL Shell: setup InnoDB Cluster easily shell
  • 225.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.225  Start shell: $ mysqlsh  Create three servers: MySQL JS dba.deploySandboxInstance(3310) MySQL JS dba.deploySandboxInstance(3311) MySQL JS dba.deploySandboxInstance(3312)  Connect to one server. Create a cluster with this member: MySQL JS connect root@localhost:3310 MySQL localhost:3310 ssl JS cluster = dba.createCluster(‘my_cluster’)  Add the other two members: MySQL localhost:3310 ssl JS cluster.addInstance(‘root@localhost:3311’) MySQL localhost:3310 ssl JS cluster.addInstance(‘root@localhost:3312’) MySQL Shell: setup InnoDB Cluster easily No sandboxes in production shell
  • 226.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.226  Start shell: $ mysqlsh  Create three servers: MySQL JS dba.deploySandboxInstance(3310) MySQL JS dba.deploySandboxInstance(3311) MySQL JS dba.deploySandboxInstance(3312)  Connect to one server. Create a cluster with this member: MySQL JS connect root@localhost:3310 MySQL localhost:3310 ssl JS cluster = dba.createCluster(‘my_cluster’)  Add the other two members: MySQL localhost:3310 ssl JS cluster.addInstance(‘root@localhost:3311’) MySQL localhost:3310 ssl JS cluster.addInstance(‘root@localhost:3312’) MySQL Shell: setup InnoDB Cluster easily 3310 No sandboxes in production shell
  • 227.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.227  Start shell: $ mysqlsh  Create three servers: MySQL JS dba.deploySandboxInstance(3310) MySQL JS dba.deploySandboxInstance(3311) MySQL JS dba.deploySandboxInstance(3312)  Connect to one server. Create a cluster with this member: MySQL JS connect root@localhost:3310 MySQL localhost:3310 ssl JS cluster = dba.createCluster(‘my_cluster’)  Add the other two members: MySQL localhost:3310 ssl JS cluster.addInstance(‘root@localhost:3311’) MySQL localhost:3310 ssl JS cluster.addInstance(‘root@localhost:3312’) MySQL Shell: setup InnoDB Cluster easily 3310 3311 No sandboxes in production shell
  • 228.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.228  Start shell: $ mysqlsh  Create three servers: MySQL JS dba.deploySandboxInstance(3310) MySQL JS dba.deploySandboxInstance(3311) MySQL JS dba.deploySandboxInstance(3312)  Connect to one server. Create a cluster with this member: MySQL JS connect root@localhost:3310 MySQL localhost:3310 ssl JS cluster = dba.createCluster(‘my_cluster’)  Add the other two members: MySQL localhost:3310 ssl JS cluster.addInstance(‘root@localhost:3311’) MySQL localhost:3310 ssl JS cluster.addInstance(‘root@localhost:3312’) MySQL Shell: setup InnoDB Cluster easily 3310 3311 3312 shell
  • 229.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.229  Start shell: $ mysqlsh  Create three servers: MySQL JS dba.deploySandboxInstance(3310) MySQL JS dba.deploySandboxInstance(3311) MySQL JS dba.deploySandboxInstance(3312)  Connect to one server. Create a cluster with this member: MySQL JS connect root@localhost:3310 MySQL localhost:3310 ssl JS cluster = dba.createCluster(‘my_cluster’)  Add the other two members: MySQL localhost:3310 ssl JS cluster.addInstance(‘root@localhost:3311’) MySQL localhost:3310 ssl JS cluster.addInstance(‘root@localhost:3312’) MySQL Shell: setup InnoDB Cluster easily 3310 3311 3312 shell
  • 230.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.230  Start shell: $ mysqlsh  Create three servers: MySQL JS dba.deploySandboxInstance(3310) MySQL JS dba.deploySandboxInstance(3311) MySQL JS dba.deploySandboxInstance(3312)  Connect to one server. Create a cluster with this member: MySQL JS connect root@localhost:3310 MySQL localhost:3310 ssl JS cluster = dba.createCluster(‘my_cluster’)  Add the other two members: MySQL localhost:3310 ssl JS cluster.addInstance(‘root@localhost:3311’) MySQL localhost:3310 ssl JS cluster.addInstance(‘root@localhost:3312’) MySQL Shell: setup InnoDB Cluster easily 3310 3311 3312 shell
  • 231.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.231  Start shell: $ mysqlsh  Create three servers: MySQL JS dba.deploySandboxInstance(3310) MySQL JS dba.deploySandboxInstance(3311) MySQL JS dba.deploySandboxInstance(3312)  Connect to one server. Create a cluster with this member: MySQL JS connect root@localhost:3310 MySQL localhost:3310 ssl JS cluster = dba.createCluster(‘my_cluster’)  Add the other two members: MySQL localhost:3310 ssl JS cluster.addInstance(‘root@localhost:3311’) MySQL localhost:3310 ssl JS cluster.addInstance(‘root@localhost:3312’) MySQL Shell: setup InnoDB Cluster easily 3310 3311 3312 shell
  • 232.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.232  Start shell: $ mysqlsh  Create three servers: MySQL JS dba.deploySandboxInstance(3310) MySQL JS dba.deploySandboxInstance(3311) MySQL JS dba.deploySandboxInstance(3312)  Connect to one server. Create a cluster with this member: MySQL JS connect root@localhost:3310 MySQL localhost:3310 ssl JS cluster = dba.createCluster(‘my_cluster’)  Add the other two members: MySQL localhost:3310 ssl JS cluster.addInstance(‘root@localhost:3311’) MySQL localhost:3310 ssl JS cluster.addInstance(‘root@localhost:3312’) MySQL Shell: setup InnoDB Cluster easily 3310 3311 3312 shell
  • 233.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.233 MySQL Shell: setup InnoDB Cluster easily  Check the status of the group: MySQL localhost:3310 ssl JS cluster.status() { ... "statusText": "Cluster is ONLINE and can tolerate up to ONE failure.", "topology": { "localhost:3310": { "address": "localhost:3310", "mode": "R/W", "readReplicas": {}, "role": "HA", "status": "ONLINE" }, "localhost:3311": { ... }, "localhost:3312": { ... } } ... }
  • 234.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.234 MySQL Shell: setup InnoDB Cluster easily  Check the status of the group: MySQL localhost:3310 ssl JS cluster.status() { ... "statusText": "Cluster is ONLINE and can tolerate up to ONE failure.", "topology": { "localhost:3310": { "address": "localhost:3310", "mode": "R/W", "readReplicas": {}, "role": "HA", "status": "ONLINE" }, "localhost:3311": { ... }, "localhost:3312": { ... } } ... }
  • 235.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.235 MySQL Shell: setup InnoDB Cluster easily  Simulate a failure: MySQL localhost:3310 ssl JS dba.killSandboxInstance(3311) 3310 3311 3312 shell
  • 236.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.236 MySQL Shell: setup InnoDB Cluster easily  Simulate a failure: MySQL localhost:3310 ssl JS dba.killSandboxInstance(3311) 3310 3311 3312 shell
  • 237.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.237 MySQL Shell: setup InnoDB Cluster easily  Simulate a failure: MySQL localhost:3310 ssl JS dba.killSandboxInstance(3311) 3310 3312 shell
  • 238.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.238 MySQL Shell: setup InnoDB Cluster easily  Simulate a failure: MySQL localhost:3310 ssl JS dba.killSandboxInstance(3311)  Check the status of the group: MySQL localhost:3310 ssl JS cluster.status() { ... "statusText": "Cluster is NOT tolerant to any failures. 1 member is not active", "topology": { "localhost:3310": { ... }, "localhost:3311": { ... "status": "UNREACHABLE" }, "localhost:3312": { ... } } ... } 3310 3312 shell
  • 239.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.239 MySQL Shell: setup InnoDB Cluster easily 3310 3312 shell  Check the status again after a few seconds: MySQL localhost:3310 ssl JS cluster.status() { ... "statusText": "Cluster is NOT tolerant to any failures. 1 member is not active", "topology": { "localhost:3310": { ... }, "localhost:3311": { ... "status": "(MISSING)" }, "localhost:3312": { ... } } ... }
  • 240.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.240 MySQL Shell: setup InnoDB Cluster easily  Start up the server again: MySQL localhost:3310 ssl JS dba.startSandboxInstance(3311) 3310 3312 shell
  • 241.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.241 MySQL Shell: setup InnoDB Cluster easily 3310 3312 shell 3311  Start up the server again: MySQL localhost:3310 ssl JS dba.startSandboxInstance(3311)
  • 242.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.242 MySQL Shell: setup InnoDB Cluster easily  Start up the server again: MySQL localhost:3310 ssl JS dba.startSandboxInstance(3311)  Check the status of the group: MySQL localhost:3310 ssl JS cluster.status() { ... "statusText": "Cluster is NOT tolerant to any failures. 1 member is not active", "topology": { "localhost:3310": { ... }, "localhost:3311": { ... "status": "RECOVERING" }, "localhost:3312": { ... } } ... } 3310 3312 shell 3311
  • 243.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.243 MySQL Shell: setup InnoDB Cluster easily  Start up the server again: MySQL localhost:3310 ssl JS dba.startSandboxInstance(3311)  Check the status of the group: MySQL localhost:3310 ssl JS cluster.status() { ... "statusText": "Cluster is NOT tolerant to any failures. 1 member is not active", "topology": { "localhost:3310": { ... }, "localhost:3311": { ... "status": "RECOVERING" }, "localhost:3312": { ... } } ... } 3310 3312 shell 3311
  • 244.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.244 MySQL Shell: setup InnoDB Cluster easily 3310 3312 shell 3311  Check the status after a few seconds: MySQL localhost:3310 ssl JS cluster.status() { ... "statusText": "Cluster is ONLINE and can tolerate up to ONE failure.", "topology": { "localhost:3310": { ... }, "localhost:3311": { ... "status": "ONLINE" }, "localhost:3312": { ... } } ... }
  • 245.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.245 Overview MySQL InnoDB Cluster = MySQL Group Replication + MySQL Shell + MySQL Router Open Source! MySQL 8
  • 246.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.246 Overview MySQL InnoDB Cluster = MySQL Group Replication + MySQL Shell + MySQL Router Open Source! MySQL 8
  • 247.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.247 MySQL Group Replication mysqld mysqld mysqld MySQL Router App MySQL Connector MySQL Shell MySQL Router: Seamless Fail-overs
  • 248.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.248 MySQL Router: direct queries to the right server 3310 3311 3312shell Router Example 1. Start from a 3 member group 2. Connect Router to the group 3. Connect Shell to Router 4. Crash Server
  • 249.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.249 MySQL Router: direct queries to the right server $ mysqlrouter --bootstrap root@localhost:3310 --directory /tmp/myrouter $ cd /tmp/myrouter $ ./start.sh ... Classic MySQL protocol connections to cluster 'cluster': - Read/Write Connections: localhost:6446 - Read/Only Connections: localhost:6447 ... shell 3310 3311 3312 Router Example 1. Start from a 3 member group 2. Connect Router to the group 3. Connect Shell to Router 4. Crash Server
  • 250.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.250 MySQL Router: direct queries to the right server $ mysqlrouter --bootstrap root@localhost:3310 --directory /tmp/myrouter $ cd /tmp/myrouter $ ./start.sh ... Classic MySQL protocol connections to cluster 'cluster': - Read/Write Connections: localhost:6446 - Read/Only Connections: localhost:6447 ... shell MySQL Router 3310 3311 3312 Router Example 1. Start from a 3 member group 2. Connect Router to the group 3. Connect Shell to Router 4. Crash Server
  • 251.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.251 MySQL Router: direct queries to the right server $ mysqlrouter --bootstrap root@localhost:3310 --directory /tmp/myrouter $ cd /tmp/myrouter $ ./start.sh ... Classic MySQL protocol connections to cluster 'cluster': - Read/Write Connections: localhost:6446 - Read/Only Connections: localhost:6447 ... shell MySQL Router 3310 3311 3312 Router Example 1. Start from a 3 member group 2. Connect Router to the group 3. Connect Shell to Router 4. Crash Server
  • 252.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.252 MySQL Router: direct queries to the right server $ mysqlrouter --bootstrap root@localhost:3310 --directory /tmp/myrouter $ cd /tmp/myrouter $ ./start.sh ... Classic MySQL protocol connections to cluster 'cluster': - Read/Write Connections: localhost:6446 - Read/Only Connections: localhost:6447 ... shell MySQL Router 3310 3311 3312 6446 6447 Router Example 1. Start from a 3 member group 2. Connect Router to the group 3. Connect Shell to Router 4. Crash Server
  • 253.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.253 MySQL Router: direct queries to the right server MySQL localhost:3310 ssl JS connect root@localhost:6446 MySQL localhost:6446 ssl JS sql MySQL localhost:6446 ssl SQL SELECT @@port; 3310 MySQL localhost:6446 ssl SQL CREATE DATABASE foo; MySQL localhost:6446 ssl SQL CREATE TABLE foo.bar(a INT PRIMARY KEY); shell MySQL Router 6446 6447 Router Example 1. Start from a 3 member group 2. Connect Router to the group 3. Connect Shell to Router 4. Crash Server 3310 3311 3312
  • 254.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.254 MySQL localhost:3310 ssl JS connect root@localhost:6446 MySQL localhost:6446 ssl JS sql MySQL localhost:6446 ssl SQL SELECT @@port; 3310 MySQL localhost:6446 ssl SQL CREATE DATABASE foo; MySQL localhost:6446 ssl SQL CREATE TABLE foo.bar(a INT PRIMARY KEY); MySQL Router: direct queries to the right server shell MySQL Router 6446 6447 Router Example 1. Start from a 3 member group 2. Connect Router to the group 3. Connect Shell to Router 4. Crash Server 3310 3311 3312
  • 255.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.255 MySQL localhost:3310 ssl JS connect root@localhost:6446 MySQL localhost:6446 ssl JS sql MySQL localhost:6446 ssl SQL SELECT @@port; 3310 MySQL localhost:6446 ssl SQL CREATE DATABASE foo; MySQL localhost:6446 ssl SQL CREATE TABLE foo.bar(a INT PRIMARY KEY); MySQL Router: direct queries to the right server shell MySQL Router 6446 6447 Router Example 1. Start from a 3 member group 2. Connect Router to the group 3. Connect Shell to Router 4. Crash Server 3310 3311 3312
  • 256.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.256 MySQL localhost:3310 ssl JS connect root@localhost:6446 MySQL localhost:6446 ssl JS sql MySQL localhost:6446 ssl SQL SELECT @@port; 3310 MySQL localhost:6446 ssl SQL CREATE DATABASE foo; MySQL localhost:6446 ssl SQL CREATE TABLE foo.bar(a INT PRIMARY KEY); MySQL Router: direct queries to the right server shell MySQL Router 6446 6447 Router Example 1. Start from a 3 member group 2. Connect Router to the group 3. Connect Shell to Router 4. Crash Server 3310 3311 3312
  • 257.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.257 MySQL localhost:3310 ssl JS connect root@localhost:6446 MySQL localhost:6446 ssl JS sql MySQL localhost:6446 ssl SQL SELECT @@port; 3310 MySQL localhost:6446 ssl SQL CREATE DATABASE foo; MySQL localhost:6446 ssl SQL CREATE TABLE foo.bar(a INT PRIMARY KEY); MySQL Router: direct queries to the right server shell MySQL Router 6446 6447 Router Example 1. Start from a 3 member group 2. Connect Router to the group 3. Connect Shell to Router 4. Crash Server 3310 3311 3312
  • 258.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.258 MySQL localhost:3310 ssl JS connect root@localhost:6446 MySQL localhost:6446 ssl JS sql MySQL localhost:6446 ssl SQL SELECT @@port; 3310 MySQL localhost:6446 ssl SQL CREATE DATABASE foo; MySQL localhost:6446 ssl SQL CREATE TABLE foo.bar(a INT PRIMARY KEY); MySQL Router: direct queries to the right server shell MySQL Router 6446 6447 Router Example 1. Start from a 3 member group 2. Connect Router to the group 3. Connect Shell to Router 4. Crash Server 3310 3311 3312
  • 259.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.259 MySQL Router: direct queries to the right server MySQL localhost:6446 ssl SQL connect root@localhost:6447 MySQL localhost:6447 ssl SQL SELECT @@port; 3311 MySQL localhost:6447 ssl SQL reconnect MySQL localhost:6447 ssl SQL SELECT @@port; 3312 MySQL localhost:6447 ssl SQL INSERT INTO foo.bar VALUES (1); ERROR: 1290 (HY000): The MySQL server is running with the --super-read-only option so it cannot execute this statement shell MySQL Router 6446 6447 Router Example 1. Start from a 3 member group 2. Connect Router to the group 3. Connect Shell to Router 4. Crash Server 3310 3311 3312
  • 260.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.260 MySQL Router: direct queries to the right server shell MySQL Router 6446 6447 Router Example 1. Start from a 3 member group 2. Connect Router to the group 3. Connect Shell to Router 4. Crash Server 3310 3311 3312 MySQL localhost:6446 ssl SQL connect root@localhost:6447 MySQL localhost:6447 ssl SQL SELECT @@port; 3311 MySQL localhost:6447 ssl SQL reconnect MySQL localhost:6447 ssl SQL SELECT @@port; 3312 MySQL localhost:6447 ssl SQL INSERT INTO foo.bar VALUES (1); ERROR: 1290 (HY000): The MySQL server is running with the --super-read-only option so it cannot execute this statement
  • 261.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.261 MySQL Router: direct queries to the right server shell MySQL Router 6446 6447 Router Example 1. Start from a 3 member group 2. Connect Router to the group 3. Connect Shell to Router 4. Crash Server 3310 3311 3312 MySQL localhost:6446 ssl SQL connect root@localhost:6447 MySQL localhost:6447 ssl SQL SELECT @@port; 3311 MySQL localhost:6447 ssl SQL reconnect MySQL localhost:6447 ssl SQL SELECT @@port; 3312 MySQL localhost:6447 ssl SQL INSERT INTO foo.bar VALUES (1); ERROR: 1290 (HY000): The MySQL server is running with the --super-read-only option so it cannot execute this statement
  • 262.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.262 MySQL localhost:6446 ssl SQL connect root@localhost:6447 MySQL localhost:6447 ssl SQL SELECT @@port; 3311 MySQL localhost:6447 ssl SQL reconnect MySQL localhost:6447 ssl SQL SELECT @@port; 3312 MySQL localhost:6447 ssl SQL INSERT INTO foo.bar VALUES (1); ERROR: 1290 (HY000): The MySQL server is running with the --super-read-only option so it cannot execute this statement MySQL Router: direct queries to the right server shell MySQL Router 6446 6447 Router Example 1. Start from a 3 member group 2. Connect Router to the group 3. Connect Shell to Router 4. Crash Server 3310 3311 3312
  • 263.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.263 MySQL localhost:6446 ssl SQL connect root@localhost:6447 MySQL localhost:6447 ssl SQL SELECT @@port; 3311 MySQL localhost:6447 ssl SQL reconnect MySQL localhost:6447 ssl SQL SELECT @@port; 3312 MySQL localhost:6447 ssl SQL INSERT INTO foo.bar VALUES (1); ERROR: 1290 (HY000): The MySQL server is running with the --super-read-only option so it cannot execute this statement MySQL Router: direct queries to the right server shell MySQL Router 6446 6447 Router Example 1. Start from a 3 member group 2. Connect Router to the group 3. Connect Shell to Router 4. Crash Server 3310 3311 3312
  • 264.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.264 MySQL localhost:6446 ssl SQL connect root@localhost:6447 MySQL localhost:6447 ssl SQL SELECT @@port; 3311 MySQL localhost:6447 ssl SQL reconnect MySQL localhost:6447 ssl SQL SELECT @@port; 3312 MySQL localhost:6447 ssl SQL INSERT INTO foo.bar VALUES (1); ERROR: 1290 (HY000): The MySQL server is running with the --super-read-only option so it cannot execute this statement MySQL Router: direct queries to the right server shell MySQL Router 6446 6447 Router Example 1. Start from a 3 member group 2. Connect Router to the group 3. Connect Shell to Router 4. Crash Server 3310 3311 3312
  • 265.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.265 MySQL Router: direct queries to the right server MySQL localhost:6447 ssl SQL js MySQL localhost:3310 ssl JS dba.killSandboxInstance(3312) MySQL localhost:6446 ssl JS sql MySQL localhost:6447 ssl SQL SELECT 1 + 1; ERROR: 2013 (HY000): Lost connection to MySQL server during query The global session got disconnected.. Attempting to reconnect to 'mysql://root@localhost:6447'.. The global session was successfully reconnected. MySQL localhost:6447 ssl SQL SELECT @@port; 3311 shell MySQL Router 6446 6447 Router Example 1. Start from a 3 member group 2. Connect Router to the group 3. Connect Shell to Router 4. Crash Server 3310 3311 3312
  • 266.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.266 MySQL localhost:6447 ssl SQL js MySQL localhost:3310 ssl JS dba.killSandboxInstance(3312) MySQL localhost:6446 ssl JS sql MySQL localhost:6447 ssl SQL SELECT 1 + 1; ERROR: 2013 (HY000): Lost connection to MySQL server during query The global session got disconnected.. Attempting to reconnect to 'mysql://root@localhost:6447'.. The global session was successfully reconnected. MySQL localhost:6447 ssl SQL SELECT @@port; 3311 MySQL Router: direct queries to the right server shell MySQL Router 6446 6447 Router Example 1. Start from a 3 member group 2. Connect Router to the group 3. Connect Shell to Router 4. Crash Server 3310 3311 3312
  • 267.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.267 MySQL localhost:6447 ssl SQL js MySQL localhost:3310 ssl JS dba.killSandboxInstance(3312) MySQL localhost:6446 ssl JS sql MySQL localhost:6447 ssl SQL SELECT 1 + 1; ERROR: 2013 (HY000): Lost connection to MySQL server during query The global session got disconnected.. Attempting to reconnect to 'mysql://root@localhost:6447'.. The global session was successfully reconnected. MySQL localhost:6447 ssl SQL SELECT @@port; 3311 MySQL Router: direct queries to the right server shell MySQL Router 3310 3311 6446 6447 3312 Router Example 1. Start from a 3 member group 2. Connect Router to the group 3. Connect Shell to Router 4. Crash Server
  • 268.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.268 MySQL localhost:6447 ssl SQL js MySQL localhost:3310 ssl JS dba.killSandboxInstance(3312) MySQL localhost:6446 ssl JS sql MySQL localhost:6447 ssl SQL SELECT 1 + 1; ERROR: 2013 (HY000): Lost connection to MySQL server during query The global session got disconnected.. Attempting to reconnect to 'mysql://root@localhost:6447'.. The global session was successfully reconnected. MySQL localhost:6447 ssl SQL SELECT @@port; 3311 MySQL Router: direct queries to the right server shell MySQL Router 6446 6447 Router Example 1. Start from a 3 member group 2. Connect Router to the group 3. Connect Shell to Router 4. Crash Server 3310 3311
  • 269.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.269 MySQL localhost:6447 ssl SQL js MySQL localhost:3310 ssl JS dba.killSandboxInstance(3312) MySQL localhost:6446 ssl JS sql MySQL localhost:6447 ssl SQL SELECT 1 + 1; ERROR: 2013 (HY000): Lost connection to MySQL server during query The global session got disconnected.. Attempting to reconnect to 'mysql://root@localhost:6447'.. The global session was successfully reconnected. MySQL localhost:6447 ssl SQL SELECT @@port; 3311 MySQL Router: direct queries to the right server shell MySQL Router 6446 6447 Router Example 1. Start from a 3 member group 2. Connect Router to the group 3. Connect Shell to Router 4. Crash Server 3310 3311
  • 270.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.270 MySQL localhost:6447 ssl SQL js MySQL localhost:3310 ssl JS dba.killSandboxInstance(3312) MySQL localhost:6446 ssl JS sql MySQL localhost:6447 ssl SQL SELECT 1 + 1; ERROR: 2013 (HY000): Lost connection to MySQL server during query The global session got disconnected.. Attempting to reconnect to 'mysql://root@localhost:6447'.. The global session was successfully reconnected. MySQL localhost:6447 ssl SQL SELECT @@port; 3311 MySQL Router: direct queries to the right server shell MySQL Router 6446 6447 Router Example 1. Start from a 3 member group 2. Connect Router to the group 3. Connect Shell to Router 4. Crash Server 3310 3311
  • 271.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.271 MySQL localhost:6447 ssl SQL js MySQL localhost:3310 ssl JS dba.killSandboxInstance(3312) MySQL localhost:6446 ssl JS sql MySQL localhost:6447 ssl SQL SELECT 1 + 1; ERROR: 2013 (HY000): Lost connection to MySQL server during query The global session got disconnected.. Attempting to reconnect to 'mysql://root@localhost:6447'.. The global session was successfully reconnected. MySQL localhost:6447 ssl SQL SELECT @@port; 3311 MySQL Router: direct queries to the right server shell MySQL Router 6446 6447 Router Example 1. Start from a 3 member group 2. Connect Router to the group 3. Connect Shell to Router 4. Crash Server 3310 3311
  • 272.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.272 Overview MySQL InnoDB Cluster = MySQL Group Replication + MySQL Shell + MySQL Router Open Source! MySQL 8
  • 273.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.273 Overview MySQL InnoDB Cluster = MySQL Group Replication + MySQL Shell + MySQL Router Open Source! MySQL 8
  • 274.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.274 MySQL Group Replication mysqld mysqld mysqld MySQL Router App MySQL Connector MySQL Shell MySQL InnoDB Cluster
  • 275.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.275 Example code: Shell + Group Replication  Start Shell: $ mysqlsh  Get help: MySQL JS help MySQL JS help dba.deploySandboxInstance etc.  Create a group of three sandbox servers: MySQL JS dba.deploySandboxInstance(3310) MySQL JS dba.deploySandboxInstance(3311) MySQL JS dba.deploySandboxInstance(3312) MySQL JS connect root@localhost:3310 MySQL localhost:3310 ssl JS cluster = dba.createCluster('my_cluster') MySQL localhost:3310 ssl JS cluster.addInstance('root@localhost:3311') MySQL localhost:3310 ssl JS cluster.addInstance('root@localhost:3312') MySQL localhost:3310 ssl JS cluster.status()  Kill and restart a member: MySQL localhost:3310 ssl JS dba.killSandboxInstance(3311) MySQL localhost:3310 ssl JS cluster.status() MySQL localhost:3310 ssl JS dba.startSandboxInstance(3311) MySQL localhost:3310 ssl JS cluster.status()
  • 276.
    Copyright © 2018,Oracle and/or its affiliates. All rights reserved.276 Example code: Shell + Group Replication + Router  Start Router: $ mysqlrouter --bootstrap root@localhost:3310 --directory /tmp/myrouter $ cd /tmp/myrouter && ./start.sh  Connect to Router’s read/write port; check that it is writable: MySQL localhost:3310 ssl JS connect root@localhost:6446 MySQL localhost:6446 ssl JS sql MySQL localhost:6446 ssl SQL SELECT @@port; MySQL localhost:6446 ssl SQL CREATE DATABASE foo; MySQL localhost:6446 ssl SQL CREATE TABLE foo.bar(a INT PRIMARY KEY);  Reconnect to Router’s read-only port; reconnect and see that it switches to another member; check that it is read-only: MySQL localhost:6446 ssl SQL connect root@localhost:6447 MySQL localhost:6447 ssl SQL SELECT @@port; MySQL localhost:6447 ssl SQL reconnect MySQL localhost:6447 ssl SQL SELECT @@port; MySQL localhost:6447 ssl SQL INSERT INTO foo.bar VALUES (1);  Kill server and watch Router fail over: MySQL localhost:6447 ssl SQL js MySQL localhost:6447 ssl JS dba.killSandboxInstance(port); MySQL localhost:6447 ssl JS sql MySQL localhost:6447 ssl SQL SELECT 1 + 1; MySQL localhost:6447 ssl SQL SELECT @@port; Note down the result from here... … and use it here