SlideShare une entreprise Scribd logo
1  sur  27
Télécharger pour lire hors ligne
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |Sunday,March 20, 2016 FOSSASIA'2016 -Singapore
Enhanced High Availability using
MySQL Group Replication
Manish Kumar (manish.4.kumar@oracle.com)
Senior Member Technical Staf
1
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Safe Harbor Statement
The following is intended to outline our general product direction. It is
intended for information purposes only, and may not be incorporated
into any contract. It is not a commitment to deliver any material, code,
or functionality, and should not be relied upon in making purchasing
decisions. The development, release, and timing of any features or
functionality described for Oracle’s products remains at the sole
discretion of Oracle.
2Sunday,March 20, 2016 FOSSASIA'2016 -Singapore
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Program Agenda
Sunday,March 20, 2016 FOSSASIA'2016 -Singapore
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Program Agenda
The Theory
How things work!
How to Use
Conclusion
1
2
3
4
4Sunday,March 20, 2016 FOSSASIA'2016 -Singapore
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
The theory1
Sunday,March 20, 2016 FOSSASIA'2016 -Singapore
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
M S
S
S
S
M
write clients read clients
read clients
write clients
More
reads?
More
slaves!
Read scale-out
Background: What is Replication Used For?
6Sunday,March 20, 2016 FOSSASIA'2016 -Singapore
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
C
B
A
C
B
ACrashCrash
C
B
A
B is the
new master
Uh Oh! Whew!
Redundancy: If master crashes, promote slave to master
Background: What is Replication Used For?
7Sunday,March 20, 2016 FOSSASIA'2016 -Singapore
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
MySQL Group Replication
8
M M M M M
Replication Group
Clients
Sunday,March 20, 2016 FOSSASIA'2016 -Singapore
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
MySQL Group Replication
• What is MySQL Group Replication?
“Multi-master update everywhere replication plugin for MySQL with built-in
automatic distributed recovery, conflict detection and group
membership.”
• What does the MySQL Group Replication plugin do for the user?
– Removes the need for handling server fail-over.
– Provides fault tolerance.
– Enables update everywhere setups.
– Automates group reconfiguration (handling of crashes, failures, re-connects)
Provides a highly available replicated database.
9Sunday,March 20, 2016 FOSSASIA'2016 -Singapore
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Use Cases
• Elastic Replication
– Environments that require a very fluid replication infrastructure, where the
number of servers has to grow or shrink dynamically and with as little pain as
possible.
• Highly Available Shards
– Sharding is a popular approach to achieve write scale-out. Users can use
MySQL Group Replication to implement highly available shards. Each shard
can map into a Replication Group.
• Alternative to Master-Slave replication
– It may be that a single master server makes it a single point of contention.
Writing to an entire group may prove more scalable under certain
circumstances.
10Sunday,March 20, 2016 FOSSASIA'2016 -Singapore
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
The theory behind it...
• Implementation based in Replicated Database State Machines
– Group Communication Primitives resenble properties of Databases
– Distributed systems meet Databases: Pedone, Guerraoui and Schiper paper
• Deferred update replication: before committing locally we certify in all
nodes
– In order to implement it one needs Atomic Broadcast
– Necessary to avoid inconsistent Certification outcome. Endured by Atomic
Broadcast:minimum requirement for DBSM.
• Membership Service
– Group Members: It allows one to know in a moment in time all the members that
are participating in the protocol, associated with a logical identifier (view id)
– View Synchrony: Ensure that messages from past views are all delivered before a
new view is installed.
11Sunday,March 20, 2016 FOSSASIA'2016 -Singapore
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
How things work!2
Sunday,March 20, 2016 FOSSASIA'2016 -Singapore
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Lets add a node to an existing group: Setup
• Create a user for distributed recovery
• Server needs to be started with the correct configuration:
13
./bin/mysqld --no-defaults --basedir=. --datadir=<DATADIR_LOCATION> –P <PORT> 
--socket=mysqld<ID>.sock --log-bin=master-bin --server-id=<ID>         
--gtid-mode=on --enforce-gtid-consistency --log-slave-updates    
--binlog-checksum=NONE --binlog-format=row                       
--master-info-repository=TABLE --relay-log-info-repository=TABLE 
--transaction-write-set-extraction=MURMUR32                      
--plugin-dir=lib/plugin --plugin-load=group_replication.so
./bin/mysqld --no-defaults --basedir=. --datadir=<DATADIR_LOCATION> –P <PORT> 
--socket=mysqld<ID>.sock --log-bin=master-bin --server-id=<ID>         
--gtid-mode=on --enforce-gtid-consistency --log-slave-updates    
--binlog-checksum=NONE --binlog-format=row                       
--master-info-repository=TABLE --relay-log-info-repository=TABLE 
--transaction-write-set-extraction=MURMUR32                      
--plugin-dir=lib/plugin --plugin-load=group_replication.so
./bin/mysql -uroot -h 127.0.0.1 -P 13001 -p --prompt='server1>'
 
server1>
CREATE USER 'rpl_user'@'%' IDENTIFIED BY 'rpl_pass';
GRANT REPLICATION SLAVE ON *.* TO rpl_user@'%';
./bin/mysql -uroot -h 127.0.0.1 -P 13001 -p --prompt='server1>'
 
server1>
CREATE USER 'rpl_user'@'%' IDENTIFIED BY 'rpl_pass';
GRANT REPLICATION SLAVE ON *.* TO rpl_user@'%';
Sunday,March 20, 2016 FOSSASIA'2016 -Singapore
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Lets add a node to a group : Setup (2)
• Now lets configure the replication user for recovery...
• ...and the communication backbone
14
SET GLOBAL group_replication_recovery_user='rpl_user';
SET GLOBAL group_replication_recovery_password='rpl_pass';
SET GLOBAL group_replication_recovery_user='rpl_user';
SET GLOBAL group_replication_recovery_password='rpl_pass';
SET GLOBAL group_replication_group_name= <valid UUID>;
SET GLOBAL group_replication_local_address=<this node address:port for the
communication backbone>;
SET GLOBAL group_replication_peer_addresses= <comma-separated list of all other
nodes in the group>;
SET GLOBAL group_replication_bootstrap_group= 0;
SET GLOBAL group_replication_group_name= <valid UUID>;
SET GLOBAL group_replication_local_address=<this node address:port for the
communication backbone>;
SET GLOBAL group_replication_peer_addresses= <comma-separated list of all other
nodes in the group>;
SET GLOBAL group_replication_bootstrap_group= 0;
Sunday,March 20, 2016 FOSSASIA'2016 -Singapore
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Start me up!
• Server that joins the group will automatically synchronize with the
others.
• It will retrieve the difference from its data to the data of the group members
• Hint: provision the new node with data before joining an existing group
15
M M M M M N
I want to play with you
START GROUP REPLICATION;
ONLINE
Sunday,March 20, 2016 FOSSASIA'2016 -Singapore
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Start me up! (2)
16
M M M M M N
ONLINE
RECOVERING
SELECT * FROM performance_schema.replication_group_membersG
M M M M M N
ONLINE
Sunday,March 20, 2016 FOSSASIA'2016 -Singapore
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Well, I need to go now...
• If a server leaves the group, the others will automatically be informed.
17
M M M M M M
My machine needs maintenance
or a system crash happens
Each membership configuration
is identified by a view_id
view_id: 4
STOP GROUP REPLICATION;
Sunday,March 20, 2016 FOSSASIA'2016 -Singapore
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
The world keeps spinning until...
• If a server leaves the group, the others will automatically be informed.
• Server that (re)joins the group will automatically synchronize with the
others.
18
M M M M M
view_id: 5
M M M M M M
RECOVERING -> ONLINE
view_id: 6
Sunday,March 20, 2016 FOSSASIA'2016 -Singapore
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
How to use3
Sunday,March 20, 2016 FOSSASIA'2016 -Singapore
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Multi-Master update everywhere!
• Any two transactions on different servers can write to the same tuple.
• Conflicts will be detected and dealt with.
– First committer wins rule.
20
M M M M M
UPDATE t1 SET a=4 WHERE a=2UPDATE t1 SET a=3 WHERE a=1
OKOK
M M M M M
UPDATE t1 SET a=2 WHERE a=1UPDATE t1 SET a=3 WHERE a=1
OK
Sunday,March 20, 2016 FOSSASIA'2016 -Singapore
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Full GTID support!
• All group members share the same UUID, the group name.
21
M M M M M
INSERT y;
Will have GTID: group_name:2
INSERT x;
Will have GTID: group_name:1
Sunday,March 20, 2016 FOSSASIA'2016 -Singapore
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Management
• Monitor group replication stats though Performance Schema tables.
22
mysql> SELECT * FROM
performance_schema.replication_connection_statusG
*************************** 1. row ***************************
CHANNEL_NAME: group_replication_applier
GROUP_NAME: 8a94f357-aab4-11df-86ab-c80aa9429563
SOURCE_UUID: 8a94f357-aab4-11df-86ab-c80aa9429563
THREAD_ID: NULL
SERVICE_STATE: ON
...
mysql> SELECT * FROM
performance_schema.replication_connection_statusG
*************************** 1. row ***************************
CHANNEL_NAME: group_replication_applier
GROUP_NAME: 8a94f357-aab4-11df-86ab-c80aa9429563
SOURCE_UUID: 8a94f357-aab4-11df-86ab-c80aa9429563
THREAD_ID: NULL
SERVICE_STATE: ON
...
mysql> SELECT * FROM performance_schema.replication_group_member_statsG
*************************** 1. row ***************************
CHANNEL_NAME: group_replication_applier
VIEW_ID: 1428497631:3
MEMBER_ID: e38fdea8-dded-11e4-b211-e8b1fc3848de
COUNT_TRANSACTIONS_IN_QUEUE: 0
COUNT_TRANSACTIONS_CHECKED: 12
COUNT_CONFLICTS_DETECTED: 5
COUNT_TRANSACTIONS_VALIDATING: 6
TRANSACTIONS_COMMITTED_ALL_MEMBERS: 8a84f397-aaa4-18df-89ab-
c70aa9823561:1-7
LAST_CONFLICT_FREE_TRANSACTION: 8a84f397-aaa4-18df-89ab-c70aa9823561:7
mysql> SELECT * FROM performance_schema.replication_group_member_statsG
*************************** 1. row ***************************
CHANNEL_NAME: group_replication_applier
VIEW_ID: 1428497631:3
MEMBER_ID: e38fdea8-dded-11e4-b211-e8b1fc3848de
COUNT_TRANSACTIONS_IN_QUEUE: 0
COUNT_TRANSACTIONS_CHECKED: 12
COUNT_CONFLICTS_DETECTED: 5
COUNT_TRANSACTIONS_VALIDATING: 6
TRANSACTIONS_COMMITTED_ALL_MEMBERS: 8a84f397-aaa4-18df-89ab-
c70aa9823561:1-7
LAST_CONFLICT_FREE_TRANSACTION: 8a84f397-aaa4-18df-89ab-c70aa9823561:7
mysql> SELECT * FROM performance_schema.replication_group_membersG
*************************** 1. row ***************************
CHANNEL_NAME: group_replication_applier
MEMBER_ID: 597dbb72-3e2c-11e4-9d9d-ecf4bb227f3b
MEMBER_HOST: nightfury
MEMBER_PORT: 13000
MEMBER_STATE: ONLINE
*************************** 2. row ***************************
...
mysql> SELECT * FROM performance_schema.replication_group_membersG
*************************** 1. row ***************************
CHANNEL_NAME: group_replication_applier
MEMBER_ID: 597dbb72-3e2c-11e4-9d9d-ecf4bb227f3b
MEMBER_HOST: nightfury
MEMBER_PORT: 13000
MEMBER_STATE: ONLINE
*************************** 2. row ***************************
...
Sunday,March 20, 2016 FOSSASIA'2016 -Singapore
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Conclusion4
Sunday,March 20, 2016 FOSSASIA'2016 -Singapore
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Summary
• Cloud Friendly
– Great technology for deployments where elasticity is a requirement, such as cloud
based infrastructures.
• Integrated
– With server core through a well defined API.
– With GTIDs, row based replication, performance schema tables.
• Autonomic and Operations Friendly
– It is self-healing: no administrative overhead for handling server fail-overs.
– Provides fault-tolerance, enables multi-master update everywhere and a
dependable MySQL service.
• Lab releases provide a sneak peek at what is coming - a new replication plugin and
exciting new infrastructure: MySQL Group Replication and MySQL Router.
24Sunday,March 20, 2016 FOSSASIA'2016 -Singapore
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
• Strong development cycles and continuous community
engagement through regular lab releases.
Releases
25
2014-Apr-06
Labs release: 0.3.0
2014-Aug-06
Labs release: 0.4.0
2015-Sep-14
Labs release: 0.5.0
Introduces new
communication engine!
2015-Oct-22
Labs release: 0.6.0
2016-Jan-13
Labs release: 0.7.0
WINDOWS SUPPORT
Sunday,March 20, 2016 FOSSASIA'2016 -Singapore
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Where to go from here?
• Packages
– http://labs.mysql.com
• Blogs from the Engineers (news, technical information, and
much more)
– http://mysqlhighavailability.com
26Sunday,March 20, 2016 FOSSASIA'2016 -Singapore
MySQL Group Replication

Contenu connexe

Tendances

Reducing Risk When Upgrading MySQL
Reducing Risk When Upgrading MySQLReducing Risk When Upgrading MySQL
Reducing Risk When Upgrading MySQL
Kenny Gryp
 
Plny12 galera-cluster-best-practices
Plny12 galera-cluster-best-practicesPlny12 galera-cluster-best-practices
Plny12 galera-cluster-best-practices
Dimas Prasetyo
 

Tendances (20)

MySQL Replication Performance Tuning for Fun and Profit!
MySQL Replication Performance Tuning for Fun and Profit!MySQL Replication Performance Tuning for Fun and Profit!
MySQL Replication Performance Tuning for Fun and Profit!
 
Reducing Risk When Upgrading MySQL
Reducing Risk When Upgrading MySQLReducing Risk When Upgrading MySQL
Reducing Risk When Upgrading MySQL
 
MySQL Group Replication
MySQL Group ReplicationMySQL Group Replication
MySQL Group Replication
 
Fine-tuning Group Replication for Performance
Fine-tuning Group Replication for PerformanceFine-tuning Group Replication for Performance
Fine-tuning Group Replication for Performance
 
Advanced Percona XtraDB Cluster in a nutshell... la suite
Advanced Percona XtraDB Cluster in a nutshell... la suiteAdvanced Percona XtraDB Cluster in a nutshell... la suite
Advanced Percona XtraDB Cluster in a nutshell... la suite
 
Why MySQL Replication Fails, and How to Get it Back
Why MySQL Replication Fails, and How to Get it BackWhy MySQL Replication Fails, and How to Get it Back
Why MySQL Replication Fails, and How to Get it Back
 
MySQL Group Replication - an Overview
MySQL Group Replication - an OverviewMySQL Group Replication - an Overview
MySQL Group Replication - an Overview
 
MySQL InnoDB Cluster - New Features in 8.0 Releases - Best Practices
MySQL InnoDB Cluster - New Features in 8.0 Releases - Best PracticesMySQL InnoDB Cluster - New Features in 8.0 Releases - Best Practices
MySQL InnoDB Cluster - New Features in 8.0 Releases - Best Practices
 
MySQL Database Architectures - InnoDB ReplicaSet & Cluster
MySQL Database Architectures - InnoDB ReplicaSet & ClusterMySQL Database Architectures - InnoDB ReplicaSet & Cluster
MySQL Database Architectures - InnoDB ReplicaSet & Cluster
 
MySQL Connectors 8.0.19 & DNS SRV
MySQL Connectors 8.0.19 & DNS SRVMySQL Connectors 8.0.19 & DNS SRV
MySQL Connectors 8.0.19 & DNS SRV
 
Plny12 galera-cluster-best-practices
Plny12 galera-cluster-best-practicesPlny12 galera-cluster-best-practices
Plny12 galera-cluster-best-practices
 
Introduction to Galera
Introduction to GaleraIntroduction to Galera
Introduction to Galera
 
Percona XtraDB Cluster
Percona XtraDB ClusterPercona XtraDB Cluster
Percona XtraDB Cluster
 
MySQL InnoDB Cluster / ReplicaSet - Tutorial
MySQL InnoDB Cluster / ReplicaSet - TutorialMySQL InnoDB Cluster / ReplicaSet - Tutorial
MySQL InnoDB Cluster / ReplicaSet - Tutorial
 
MySQL InnoDB Cluster 미리보기 (remote cluster test)
MySQL InnoDB Cluster 미리보기 (remote cluster test)MySQL InnoDB Cluster 미리보기 (remote cluster test)
MySQL InnoDB Cluster 미리보기 (remote cluster test)
 
Oss4b - pxc introduction
Oss4b   - pxc introductionOss4b   - pxc introduction
Oss4b - pxc introduction
 
Intro ProxySQL
Intro ProxySQLIntro ProxySQL
Intro ProxySQL
 
Introduction to ClustrixDB
Introduction to ClustrixDBIntroduction to ClustrixDB
Introduction to ClustrixDB
 
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
 
Maria DB Galera Cluster for High Availability
Maria DB Galera Cluster for High AvailabilityMaria DB Galera Cluster for High Availability
Maria DB Galera Cluster for High Availability
 

En vedette

MySQL Best Practices - OTN LAD Tour
MySQL Best Practices - OTN LAD TourMySQL Best Practices - OTN LAD Tour
MySQL Best Practices - OTN LAD Tour
Ronald Bradford
 

En vedette (20)

Explain
ExplainExplain
Explain
 
Inno db internals innodb file formats and source code structure
Inno db internals innodb file formats and source code structureInno db internals innodb file formats and source code structure
Inno db internals innodb file formats and source code structure
 
High Availability Using MySQL Group Replication
High Availability Using MySQL Group ReplicationHigh Availability Using MySQL Group Replication
High Availability Using MySQL Group Replication
 
Online MySQL Backups with Percona XtraBackup
Online MySQL Backups with Percona XtraBackupOnline MySQL Backups with Percona XtraBackup
Online MySQL Backups with Percona XtraBackup
 
2010丹臣的思考
2010丹臣的思考2010丹臣的思考
2010丹臣的思考
 
Эффективная отладка репликации MySQL
Эффективная отладка репликации MySQLЭффективная отладка репликации MySQL
Эффективная отладка репликации MySQL
 
MySQL Server Defaults
MySQL Server DefaultsMySQL Server Defaults
MySQL Server Defaults
 
Redis介绍
Redis介绍Redis介绍
Redis介绍
 
MySQL 5.7: Focus on InnoDB
MySQL 5.7: Focus on InnoDBMySQL 5.7: Focus on InnoDB
MySQL 5.7: Focus on InnoDB
 
Mysql展示功能与源码对应
Mysql展示功能与源码对应Mysql展示功能与源码对应
Mysql展示功能与源码对应
 
淘宝数据库架构演进历程
淘宝数据库架构演进历程淘宝数据库架构演进历程
淘宝数据库架构演进历程
 
MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?
MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?
MySQL Storage Engines - which do you use? TokuDB? MyRocks? InnoDB?
 
Requirements the Last Bottleneck
Requirements the Last BottleneckRequirements the Last Bottleneck
Requirements the Last Bottleneck
 
10x Performance Improvements - A Case Study
10x Performance Improvements - A Case Study10x Performance Improvements - A Case Study
10x Performance Improvements - A Case Study
 
Lessons Learned: Troubleshooting Replication
Lessons Learned: Troubleshooting ReplicationLessons Learned: Troubleshooting Replication
Lessons Learned: Troubleshooting Replication
 
MySQL High Availability Deep Dive
MySQL High Availability Deep DiveMySQL High Availability Deep Dive
MySQL High Availability Deep Dive
 
Advanced mysql replication techniques
Advanced mysql replication techniquesAdvanced mysql replication techniques
Advanced mysql replication techniques
 
MySQL Best Practices - OTN LAD Tour
MySQL Best Practices - OTN LAD TourMySQL Best Practices - OTN LAD Tour
MySQL Best Practices - OTN LAD Tour
 
MySQL InnoDB Cluster and Group Replication - OSI 2017 Bangalore
MySQL InnoDB Cluster and Group Replication - OSI 2017 BangaloreMySQL InnoDB Cluster and Group Replication - OSI 2017 Bangalore
MySQL InnoDB Cluster and Group Replication - OSI 2017 Bangalore
 
MySQL - checklist для новичка в Highload
MySQL - checklist для новичка в HighloadMySQL - checklist для новичка в Highload
MySQL - checklist для новичка в Highload
 

Similaire à MySQL Group Replication

MySQL Enterprise Monitor
MySQL Enterprise MonitorMySQL Enterprise Monitor
MySQL Enterprise Monitor
Mario Beck
 

Similaire à MySQL Group Replication (20)

InnoDb Vs NDB Cluster
InnoDb Vs NDB ClusterInnoDb Vs NDB Cluster
InnoDb Vs NDB Cluster
 
MySQL High Availability -- InnoDB Clusters
MySQL High Availability -- InnoDB ClustersMySQL High Availability -- InnoDB Clusters
MySQL High Availability -- InnoDB Clusters
 
Solving Performance Problems Using MySQL Enterprise Monitor
Solving Performance Problems Using MySQL Enterprise MonitorSolving Performance Problems Using MySQL Enterprise Monitor
Solving Performance Problems Using MySQL Enterprise Monitor
 
MySQL Group Replication - HandsOn Tutorial
MySQL Group Replication - HandsOn TutorialMySQL Group Replication - HandsOn Tutorial
MySQL Group Replication - HandsOn Tutorial
 
20161029 py con-mysq-lv3
20161029 py con-mysq-lv320161029 py con-mysq-lv3
20161029 py con-mysq-lv3
 
MySQL InnoDB Cluster - Group Replication
MySQL InnoDB Cluster - Group ReplicationMySQL InnoDB Cluster - Group Replication
MySQL InnoDB Cluster - Group Replication
 
MySQL Day Paris 2016 - MySQL HA: InnoDB Cluster and NDB Cluster
MySQL Day Paris 2016 - MySQL HA: InnoDB Cluster and NDB ClusterMySQL Day Paris 2016 - MySQL HA: InnoDB Cluster and NDB Cluster
MySQL Day Paris 2016 - MySQL HA: InnoDB Cluster and NDB Cluster
 
2016 oSC MySQL Firewall
2016 oSC MySQL Firewall2016 oSC MySQL Firewall
2016 oSC MySQL Firewall
 
MySQL Day Paris 2018 - MySQL InnoDB Cluster; A complete High Availability sol...
MySQL Day Paris 2018 - MySQL InnoDB Cluster; A complete High Availability sol...MySQL Day Paris 2018 - MySQL InnoDB Cluster; A complete High Availability sol...
MySQL Day Paris 2018 - MySQL InnoDB Cluster; A complete High Availability sol...
 
Performance schema and sys schema
Performance schema and sys schemaPerformance schema and sys schema
Performance schema and sys schema
 
MySQL 8 High Availability with InnoDB Clusters
MySQL 8 High Availability with InnoDB ClustersMySQL 8 High Availability with InnoDB Clusters
MySQL 8 High Availability with InnoDB Clusters
 
FOSSASIA 2015: MySQL Group Replication
FOSSASIA 2015: MySQL Group ReplicationFOSSASIA 2015: MySQL Group Replication
FOSSASIA 2015: MySQL Group Replication
 
MySQL InnoDB Cluster and NDB Cluster
MySQL InnoDB Cluster and NDB ClusterMySQL InnoDB Cluster and NDB Cluster
MySQL InnoDB Cluster and NDB Cluster
 
Mysql repos testing.odp
Mysql repos testing.odpMysql repos testing.odp
Mysql repos testing.odp
 
Hkosc group replication-lecture_lab07
Hkosc group replication-lecture_lab07Hkosc group replication-lecture_lab07
Hkosc group replication-lecture_lab07
 
MySQL for Software-as-a-Service (SaaS)
MySQL for Software-as-a-Service (SaaS)MySQL for Software-as-a-Service (SaaS)
MySQL for Software-as-a-Service (SaaS)
 
MySQL Enterprise Monitor
MySQL Enterprise MonitorMySQL Enterprise Monitor
MySQL Enterprise Monitor
 
My sql8 innodb_cluster
My sql8 innodb_clusterMy sql8 innodb_cluster
My sql8 innodb_cluster
 
MySQL InnoDB Cluster: High Availability Made Easy!
MySQL InnoDB Cluster: High Availability Made Easy!MySQL InnoDB Cluster: High Availability Made Easy!
MySQL InnoDB Cluster: High Availability Made Easy!
 
MySQL HA
MySQL HAMySQL HA
MySQL HA
 

Dernier

+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Dernier (20)

Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 

MySQL Group Replication

  • 1. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |Sunday,March 20, 2016 FOSSASIA'2016 -Singapore Enhanced High Availability using MySQL Group Replication Manish Kumar (manish.4.kumar@oracle.com) Senior Member Technical Staf 1
  • 2. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Safe Harbor Statement The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle. 2Sunday,March 20, 2016 FOSSASIA'2016 -Singapore
  • 3. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Program Agenda Sunday,March 20, 2016 FOSSASIA'2016 -Singapore
  • 4. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Program Agenda The Theory How things work! How to Use Conclusion 1 2 3 4 4Sunday,March 20, 2016 FOSSASIA'2016 -Singapore
  • 5. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | The theory1 Sunday,March 20, 2016 FOSSASIA'2016 -Singapore
  • 6. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | M S S S S M write clients read clients read clients write clients More reads? More slaves! Read scale-out Background: What is Replication Used For? 6Sunday,March 20, 2016 FOSSASIA'2016 -Singapore
  • 7. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | C B A C B ACrashCrash C B A B is the new master Uh Oh! Whew! Redundancy: If master crashes, promote slave to master Background: What is Replication Used For? 7Sunday,March 20, 2016 FOSSASIA'2016 -Singapore
  • 8. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | MySQL Group Replication 8 M M M M M Replication Group Clients Sunday,March 20, 2016 FOSSASIA'2016 -Singapore
  • 9. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | MySQL Group Replication • What is MySQL Group Replication? “Multi-master update everywhere replication plugin for MySQL with built-in automatic distributed recovery, conflict detection and group membership.” • What does the MySQL Group Replication plugin do for the user? – Removes the need for handling server fail-over. – Provides fault tolerance. – Enables update everywhere setups. – Automates group reconfiguration (handling of crashes, failures, re-connects) Provides a highly available replicated database. 9Sunday,March 20, 2016 FOSSASIA'2016 -Singapore
  • 10. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Use Cases • Elastic Replication – Environments that require a very fluid replication infrastructure, where the number of servers has to grow or shrink dynamically and with as little pain as possible. • Highly Available Shards – Sharding is a popular approach to achieve write scale-out. Users can use MySQL Group Replication to implement highly available shards. Each shard can map into a Replication Group. • Alternative to Master-Slave replication – It may be that a single master server makes it a single point of contention. Writing to an entire group may prove more scalable under certain circumstances. 10Sunday,March 20, 2016 FOSSASIA'2016 -Singapore
  • 11. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | The theory behind it... • Implementation based in Replicated Database State Machines – Group Communication Primitives resenble properties of Databases – Distributed systems meet Databases: Pedone, Guerraoui and Schiper paper • Deferred update replication: before committing locally we certify in all nodes – In order to implement it one needs Atomic Broadcast – Necessary to avoid inconsistent Certification outcome. Endured by Atomic Broadcast:minimum requirement for DBSM. • Membership Service – Group Members: It allows one to know in a moment in time all the members that are participating in the protocol, associated with a logical identifier (view id) – View Synchrony: Ensure that messages from past views are all delivered before a new view is installed. 11Sunday,March 20, 2016 FOSSASIA'2016 -Singapore
  • 12. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | How things work!2 Sunday,March 20, 2016 FOSSASIA'2016 -Singapore
  • 13. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Lets add a node to an existing group: Setup • Create a user for distributed recovery • Server needs to be started with the correct configuration: 13 ./bin/mysqld --no-defaults --basedir=. --datadir=<DATADIR_LOCATION> –P <PORT> --socket=mysqld<ID>.sock --log-bin=master-bin --server-id=<ID>         --gtid-mode=on --enforce-gtid-consistency --log-slave-updates    --binlog-checksum=NONE --binlog-format=row                       --master-info-repository=TABLE --relay-log-info-repository=TABLE --transaction-write-set-extraction=MURMUR32                      --plugin-dir=lib/plugin --plugin-load=group_replication.so ./bin/mysqld --no-defaults --basedir=. --datadir=<DATADIR_LOCATION> –P <PORT> --socket=mysqld<ID>.sock --log-bin=master-bin --server-id=<ID>         --gtid-mode=on --enforce-gtid-consistency --log-slave-updates    --binlog-checksum=NONE --binlog-format=row                       --master-info-repository=TABLE --relay-log-info-repository=TABLE --transaction-write-set-extraction=MURMUR32                      --plugin-dir=lib/plugin --plugin-load=group_replication.so ./bin/mysql -uroot -h 127.0.0.1 -P 13001 -p --prompt='server1>'   server1> CREATE USER 'rpl_user'@'%' IDENTIFIED BY 'rpl_pass'; GRANT REPLICATION SLAVE ON *.* TO rpl_user@'%'; ./bin/mysql -uroot -h 127.0.0.1 -P 13001 -p --prompt='server1>'   server1> CREATE USER 'rpl_user'@'%' IDENTIFIED BY 'rpl_pass'; GRANT REPLICATION SLAVE ON *.* TO rpl_user@'%'; Sunday,March 20, 2016 FOSSASIA'2016 -Singapore
  • 14. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Lets add a node to a group : Setup (2) • Now lets configure the replication user for recovery... • ...and the communication backbone 14 SET GLOBAL group_replication_recovery_user='rpl_user'; SET GLOBAL group_replication_recovery_password='rpl_pass'; SET GLOBAL group_replication_recovery_user='rpl_user'; SET GLOBAL group_replication_recovery_password='rpl_pass'; SET GLOBAL group_replication_group_name= <valid UUID>; SET GLOBAL group_replication_local_address=<this node address:port for the communication backbone>; SET GLOBAL group_replication_peer_addresses= <comma-separated list of all other nodes in the group>; SET GLOBAL group_replication_bootstrap_group= 0; SET GLOBAL group_replication_group_name= <valid UUID>; SET GLOBAL group_replication_local_address=<this node address:port for the communication backbone>; SET GLOBAL group_replication_peer_addresses= <comma-separated list of all other nodes in the group>; SET GLOBAL group_replication_bootstrap_group= 0; Sunday,March 20, 2016 FOSSASIA'2016 -Singapore
  • 15. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Start me up! • Server that joins the group will automatically synchronize with the others. • It will retrieve the difference from its data to the data of the group members • Hint: provision the new node with data before joining an existing group 15 M M M M M N I want to play with you START GROUP REPLICATION; ONLINE Sunday,March 20, 2016 FOSSASIA'2016 -Singapore
  • 16. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Start me up! (2) 16 M M M M M N ONLINE RECOVERING SELECT * FROM performance_schema.replication_group_membersG M M M M M N ONLINE Sunday,March 20, 2016 FOSSASIA'2016 -Singapore
  • 17. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Well, I need to go now... • If a server leaves the group, the others will automatically be informed. 17 M M M M M M My machine needs maintenance or a system crash happens Each membership configuration is identified by a view_id view_id: 4 STOP GROUP REPLICATION; Sunday,March 20, 2016 FOSSASIA'2016 -Singapore
  • 18. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | The world keeps spinning until... • If a server leaves the group, the others will automatically be informed. • Server that (re)joins the group will automatically synchronize with the others. 18 M M M M M view_id: 5 M M M M M M RECOVERING -> ONLINE view_id: 6 Sunday,March 20, 2016 FOSSASIA'2016 -Singapore
  • 19. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | How to use3 Sunday,March 20, 2016 FOSSASIA'2016 -Singapore
  • 20. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Multi-Master update everywhere! • Any two transactions on different servers can write to the same tuple. • Conflicts will be detected and dealt with. – First committer wins rule. 20 M M M M M UPDATE t1 SET a=4 WHERE a=2UPDATE t1 SET a=3 WHERE a=1 OKOK M M M M M UPDATE t1 SET a=2 WHERE a=1UPDATE t1 SET a=3 WHERE a=1 OK Sunday,March 20, 2016 FOSSASIA'2016 -Singapore
  • 21. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Full GTID support! • All group members share the same UUID, the group name. 21 M M M M M INSERT y; Will have GTID: group_name:2 INSERT x; Will have GTID: group_name:1 Sunday,March 20, 2016 FOSSASIA'2016 -Singapore
  • 22. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Management • Monitor group replication stats though Performance Schema tables. 22 mysql> SELECT * FROM performance_schema.replication_connection_statusG *************************** 1. row *************************** CHANNEL_NAME: group_replication_applier GROUP_NAME: 8a94f357-aab4-11df-86ab-c80aa9429563 SOURCE_UUID: 8a94f357-aab4-11df-86ab-c80aa9429563 THREAD_ID: NULL SERVICE_STATE: ON ... mysql> SELECT * FROM performance_schema.replication_connection_statusG *************************** 1. row *************************** CHANNEL_NAME: group_replication_applier GROUP_NAME: 8a94f357-aab4-11df-86ab-c80aa9429563 SOURCE_UUID: 8a94f357-aab4-11df-86ab-c80aa9429563 THREAD_ID: NULL SERVICE_STATE: ON ... mysql> SELECT * FROM performance_schema.replication_group_member_statsG *************************** 1. row *************************** CHANNEL_NAME: group_replication_applier VIEW_ID: 1428497631:3 MEMBER_ID: e38fdea8-dded-11e4-b211-e8b1fc3848de COUNT_TRANSACTIONS_IN_QUEUE: 0 COUNT_TRANSACTIONS_CHECKED: 12 COUNT_CONFLICTS_DETECTED: 5 COUNT_TRANSACTIONS_VALIDATING: 6 TRANSACTIONS_COMMITTED_ALL_MEMBERS: 8a84f397-aaa4-18df-89ab- c70aa9823561:1-7 LAST_CONFLICT_FREE_TRANSACTION: 8a84f397-aaa4-18df-89ab-c70aa9823561:7 mysql> SELECT * FROM performance_schema.replication_group_member_statsG *************************** 1. row *************************** CHANNEL_NAME: group_replication_applier VIEW_ID: 1428497631:3 MEMBER_ID: e38fdea8-dded-11e4-b211-e8b1fc3848de COUNT_TRANSACTIONS_IN_QUEUE: 0 COUNT_TRANSACTIONS_CHECKED: 12 COUNT_CONFLICTS_DETECTED: 5 COUNT_TRANSACTIONS_VALIDATING: 6 TRANSACTIONS_COMMITTED_ALL_MEMBERS: 8a84f397-aaa4-18df-89ab- c70aa9823561:1-7 LAST_CONFLICT_FREE_TRANSACTION: 8a84f397-aaa4-18df-89ab-c70aa9823561:7 mysql> SELECT * FROM performance_schema.replication_group_membersG *************************** 1. row *************************** CHANNEL_NAME: group_replication_applier MEMBER_ID: 597dbb72-3e2c-11e4-9d9d-ecf4bb227f3b MEMBER_HOST: nightfury MEMBER_PORT: 13000 MEMBER_STATE: ONLINE *************************** 2. row *************************** ... mysql> SELECT * FROM performance_schema.replication_group_membersG *************************** 1. row *************************** CHANNEL_NAME: group_replication_applier MEMBER_ID: 597dbb72-3e2c-11e4-9d9d-ecf4bb227f3b MEMBER_HOST: nightfury MEMBER_PORT: 13000 MEMBER_STATE: ONLINE *************************** 2. row *************************** ... Sunday,March 20, 2016 FOSSASIA'2016 -Singapore
  • 23. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Conclusion4 Sunday,March 20, 2016 FOSSASIA'2016 -Singapore
  • 24. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Summary • Cloud Friendly – Great technology for deployments where elasticity is a requirement, such as cloud based infrastructures. • Integrated – With server core through a well defined API. – With GTIDs, row based replication, performance schema tables. • Autonomic and Operations Friendly – It is self-healing: no administrative overhead for handling server fail-overs. – Provides fault-tolerance, enables multi-master update everywhere and a dependable MySQL service. • Lab releases provide a sneak peek at what is coming - a new replication plugin and exciting new infrastructure: MySQL Group Replication and MySQL Router. 24Sunday,March 20, 2016 FOSSASIA'2016 -Singapore
  • 25. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | • Strong development cycles and continuous community engagement through regular lab releases. Releases 25 2014-Apr-06 Labs release: 0.3.0 2014-Aug-06 Labs release: 0.4.0 2015-Sep-14 Labs release: 0.5.0 Introduces new communication engine! 2015-Oct-22 Labs release: 0.6.0 2016-Jan-13 Labs release: 0.7.0 WINDOWS SUPPORT Sunday,March 20, 2016 FOSSASIA'2016 -Singapore
  • 26. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Where to go from here? • Packages – http://labs.mysql.com • Blogs from the Engineers (news, technical information, and much more) – http://mysqlhighavailability.com 26Sunday,March 20, 2016 FOSSASIA'2016 -Singapore