More Related Content Similar to MySQL Group Replication @osi days 2014 (20) MySQL Group Replication @osi days 20142. Open Source India, 2014
MySQL Group Replication
Manish Kumar (manish.4.kumar@oracle.com)
Senior Member technical Staff, MySQL Replication Team
2 Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Open Source India | Bangalore, India, 8th November, 2014. |
3. 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.
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Open Source India | Bangalore, India, 8th November, 2014. |
4. MySQL Labs features are not fit for production.
They are provided solely for testing purposes, to try the latest bug fixes and
generally to keep up with the development.
Please, do not use these binaries in production.
Instead, install them on a spare server.
If you are looking for production ready binaries, please visit MySQL Downloads.
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Open Source India | Bangalore, India, 8th November, 2014. |
5. MySQL Group Replication :
Multi-master update everywhere with conflict resolution.
Automatic distributed member recovery
— When a server joins the group, it gets all the missing transactions before actually
start serving requests.
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Open Source India | Bangalore, India, 8th November, 2014. |
6. Group-Based Replication Plugin
M M M M M
MySQL
Server
API
Replication
Plugin
Group Comm.
System (Corosync)
Group Comm.
System (Corosync)
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Open Source India | Bangalore, India, 8th November, 2014. |
7. Group-Based Replication Plugin
Update ...
M M M M M
Application issues an update.
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Open Source India | Bangalore, India, 8th November, 2014. |
8. Group-Based Replication Plugin
M M M M M
Replication
Events
Application issues an update.
Master executes and multi/broadcasts
the update to the other servers.
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Open Source India | Bangalore, India, 8th November, 2014. |
9. Group-Based Replication Plugin
M M M M M
Application issues an update.
Master executes and multi/broadcasts
the update to the other servers.
Servers receive same transaction in the
same order and check for conflicts.
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Open Source India | Bangalore, India, 8th November, 2014. |
10. Group-Based Replication Plugin
M M M M M
Application issues an update.
Master executes and multi/broadcasts
the update to the other servers.
Servers receive same transaction in the
same order and check for conflicts.
All servers, independently, decide to
commit the transaction – no conflicts.
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Open Source India | Bangalore, India, 8th November, 2014. |
11. Group-Based Replication Plugin
Application issues an update.
Master executes and multi/broadcasts
the update to the other servers.
Servers receive same transaction in the
same order and check for conflicts.
All servers, independently, decide to
commit the transaction – no conflicts.
Originating master replies to the
application.
M M M M M
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Open Source India | Bangalore, India, 8th November, 2014. |
12. MySQL Group Replication: Use Cases
● Automatic group membership management and failure detection
- No need for server fail-over
● No single point of failure
- Automatic reconfiguration
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Open Source India | Bangalore, India, 8th November, 2014. |
13. Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Open Source India | Bangalore, India, 8th November, 2014. |
Under the hood
● Each server can belong to a group.
● The Group is identified by a name which is the Group UUID string, so group behaves
like a single server.
● The Group UUID is used to log transactions.
● Whenever a server joins or leaves, it will start a new stable period in time on which
servers can agree on distributed decisions. A special message called View Message
is sent to each group member notifying that.
● Server join/leave can be issue manually or by scripts by DBA.
● Server leave can be caused also by node failures.
14. Current used group communication toolkit is Corosync. It provides:
— Virtual synchrony guarantees for creating replicated state machines.
Replicated state machine simple definition:
— If a set of processes with the same initial state receives the same set of deterministic
messages at the same order, them will reach the same state.
All write operations are sent to all group members for certification.
Read operations are only local.
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Open Source India | Bangalore, India, 8th November, 2014. |
Under the hood
15. COMMIT dbv: 2
OK
OK
OK
Certification - Positive
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Open Source India | Bangalore, India, 8th November, 2014. |
s1
s2
dbv: 1 UPDATE
dbv: 2
s3
dbv: 2
COMMIT
COMMIT
cv: 1 1 >= 1
1 >= 1
1 >= 1
cv: 1
cv: 1
dbv: 1
dbv: 1
cv: 2
cv: 2
cv: 2
s ← server
v ← snapshot version
sn ← certifier sequence number (write set version)
16. T1: COMMIT dbv: 2
OK
OK
Certification - Negative
T2: UPDATE cv: 2
OK
KO
KO
KO
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Open Source India | Bangalore, India, 8th November, 2014. |
s1
s2
dbv: 1 T1: UPDATE
dbv: 2
s3
dbv: 2
T1: COMMIT
T1: COMMIT
cv: 1
cv: 1
cv: 1
1 >= 1
1 >= 1
1 >= 1
cv: 2
cv: 2
1 >= 2
1 >= 2
1 >= 2
dbv: 1
dbv: 1
s ← server
v ← snapshot version
sn ← certifier sequence number (write set version)
17. Automated distributed member recovery
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Open Source India | Bangalore, India, 8th November, 2014. |
R1
R2
R3
R4
GCS
R1
R2
R3
R4
R4 joins the group.
GCS
18. Automated distributed member recovery
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Open Source India | Bangalore, India, 8th November, 2014. |
R1
R2
R3
R4
R1 is R4 Donor
GCS
R1
R2
R3
R4
GCS
19. Automated distributed member recovery
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Open Source India | Bangalore, India, 8th November, 2014. |
R1
R2
R3
R4
GCS
R1
R2
R3
R4
GCS
20. Automated distributed member recovery
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Open Source India | Bangalore, India, 8th November, 2014. |
R1
R2
R3
R4
GCS
R1
R2
R3
R4
R4 has caught up
with the view!
GCS
21. Automated distributed member recovery
R1
R2
R3
R4
GCS
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Open Source India | Bangalore, India, 8th November, 2014. |
R1
R2
R3
R4
GCS
Execute buffered
transactions from the view.
22. PERFORMANCE SCHEMA TABLE
– REPLICATION_NODE_STATUS
● Statistics regarding Applier and Certifier module.
– REPLICATION_CONNECTION_NODES
● Information regarding different nodes in the group and its
connection details
– REPLICATION_CONNECTION_STATUS
● Extended table to give details about the group connection status.
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Open Source India | Bangalore, India, 8th November, 2014. |
23. Replication Monitoring: replication_node_status
node1> SELECT * FROM performance_schema.replication_node_statusG
*************************** 1. row ***************************
GROUP_NAME: 8a84f397-aaa4-18df-89ab-c70aa9823561
NODE_ID: 2af09cb1-3e46-11e4-9e45-ecf4bb227f3b
TRANSACTIONS_IN_QUEUE: 0
CERTIFIED_TRANSACTIONS: 12
POSITIVELY_CERTIFIED: 7
NEGATIVELY_CERTIFIED: 5
CERTIFICATION_DB_SIZE: 6
STABLE_SET: 8a84f397-aaa4-18df-89ab-c70aa9823561:1-7
LAST_CERTIFIED_TRANSACTION: 8a84f397-aaa4-18df-89ab-c70aa9823561:7
APPLIER_MODULE_STATUS: ON
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Open Source India | Bangalore, India, 8th November, 2014. |
24. Replication Monitoring: replication_node_status
node1> SELECT * FROM performance_schema.replication_connection_nodesG
*************************** 1. row ***************************
GROUP_NAME 8a94f357-aab4-11df-86ab-c80aa9429573
NODE_ID 597dbb72-3e2c-11e4-9d9d-ecf4bb227f3b
NODE_HOST nightfury
NODE_PORT 13000
NODE_STATE ONLINE
*************************** 2. row ***************************
GROUP_NAME 8a94f357-aab4-11df-86ab-c80aa9429573
NODE_ID 59efb8a1-3e2c-11e4-9d9d-ecf4bb227f3b
NODE_HOST nightfury
NODE_PORT 13001
NODE_STATE ONLINE
*************************** 3. row ***************************
GROUP_NAME 8a94f357-aab4-11df-86ab-c80aa9429573
NODE_ID 5a706f6b-3e2c-11e4-9d9d-ecf4bb227f3b
NODE_HOST nightfury
NODE_PORT 13002
NODE_STATE RECOVERING
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Open Source India | Bangalore, India, 8th November, 2014. |
25. Replication Monitoring: replication_node_status
node1> SELECT * FROM performance_schema.replication_connection_statusG
*************************** 1. row ***************************
GROUP_NAME: 8a94f357-aab4-11df-86ab-c80aa9429563
SOURCE_UUID: 8a94f357-aab4-11df-86ab-c80aa9429563
THREAD_ID: NULL
SERVICE_STATE: ON
COUNT_RECEIVED_HEARTBEATS: 0
LAST_HEARTBEAT_TIMESTAMP: 0000-00-00 00:00:00
RECEIVED_TRANSACTION_SET:
LAST_ERROR_NUMBER: 0
LAST_ERROR_MESSAGE:
LAST_ERROR_TIMESTAMP: 0000-00-00 00:00:00
TOTAL_MESSAGES_RECEIVED: 9
TOTAL_MESSAGES_SENT: 5
TOTAL_BYTES_RECEIVED: 1891
TOTAL_BYTES_SENT: 1065
LAST_MESSAGE_TIMESTAMP: 2014-09-23 09:20:26
MAX_MESSAGE_LENGTH: 358
MIN_MESSAGE_LENGTH: 51
VIEW_ID: 2
NUMBER_OF_NODES: 2
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Open Source India | Bangalore, India, 8th November, 2014. |
26. Limitations
Only transactional engines are supported (currently only InnoDB).
All tables must have primary key
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Open Source India | Bangalore, India, 8th November, 2014. |
GTID must be enabled.
Only deterministic DDL is allowed.
Optimistic execution: transactions may abort on COMMIT.
27. Read More About MySQL Group Replication
● Read a feature preview of MySQL Group replication on Luis' blog:
http://mysqlhighavailability.com/mysql-group-replication-hello-world/
Read about how to get started with MySQL Group replication on Pedro's blog:
http://mysqlhighavailability.com/getting-started-with-mysql-group-replication/
● Read about Transaction life cycle in MySQL Group replication on Nuno's blog:
http://mysqlhighavailability.com/mysql-group-replication-transaction-life-cycle-explained/
● Read about Distributed recovery in MySQL Group Replication on Pedro's blog:
http://mysqlhighavailability.com/distributed-recovery-behind-the-scenes/
● Read about Monitoring for MySQL Group Replication on Manish's blog:
http://mysqlhighavailability.com/mysql-group-replication-monitoring/
● Read about Corosync and Group Communication details on Tiago's blog:
http://mysqlhighavailability.com/group-communication-behind-the-scenes/
http://mysqlhighavailability.com/mysql-group-replication-a-small-corosync-guide/
● Read about Testing of MySQL Group Replication on Manish's blog:
http://mysqlhighavailability.com/mysql-group-replication-testing/
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | Open Source India | Bangalore, India, 8th November, 2014. |
Editor's Notes <number>
New Cluster 7.3DMR, available now for download and eval
Intros
QA
Recorded
This is a Safe Harbor Front slide, one of two Safe Harbor Statement slides included in this template.
One of the Safe Harbor slides must be used if your presentation covers material affected by Oracle’s Revenue Recognition Policy
To learn more about this policy, e-mail: Revrec-americasiebc_us@oracle.com
For internal communication, Safe Harbor Statements are not required. However, there is an applicable disclaimer (Exhibit E) that should be used, found in the Oracle Revenue Recognition Policy for Future Product Communications. Copy and paste this link into a web browser, to find out more information.
http://my.oracle.com/site/fin/gfo/GlobalProcesses/cnt452504.pdf
For all external communications such as press release, roadmaps, PowerPoint presentations, Safe Harbor Statements are required. You can refer to the link mentioned above to find out additional information/disclaimers required depending on your audience.
<number>
<number>