This document discusses the risks of using asynchronous master-master replication for MySQL databases and provides strategies for setting it up safely. It explains that having two nodes actively accepting writes can lead to conflicts like duplicate key errors. It recommends dividing writes across nodes by database, table, or row to avoid conflicts. The document also discusses using synchronous replication tools like Galera to ensure consistency across nodes at the cost of reduced performance.
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
How Safe is Asynchronous Master-Master Setup?
1. How Safe is Asynchronous Master-Master
February, 01, 2020
Sveta Smirnova
2. • MySQL Support engineer
• Author of
• MySQL Troubleshooting
• JSON UDF functions
• FILTER clause for MySQL
• Speaker
• Percona Live, OOW, Fosdem,
DevConf, HighLoad...
Sveta Smirnova
2
3. •What Happens with Two Active Nodes?
•Why to Write to Multiple Nodes?
•Galera, PXC, InnoDB Cluster
•How to Setup Safe Asynchronous Master-Master
Table of Contents
3
15. Node1
DELETE WHERE id=42
Sends the update →
Receives the update →
Node2
DELETE WHERE id=42
← Sends the update
← Receives the update
DELETE
7
16. Node1
DELETE WHERE id=42
Sends the update →
Receives the update →
Key not found error!
Node2
DELETE WHERE id=42
← Sends the update
← Receives the update
Key not found error!
DELETE
7
43. • Agreement on which rows
•
E.g. AUTO INCREMENT
• auto increment increment=NUMBER OF SERVERS
• auto increment offset = server id
• Custom index
• Create your own unique pattern for the each node
Rows
21
44. • Hot Standby
•
Easy to setup and maintain
•
Separating writes by database/table
• Comparatively easy to setup and maintain
• Separating writes by row
• Should be used very carefully
Conclusion
22
45. MySQL User Reference Manual
Why MySQL Replication Fails, and How to...
MySQL High Availability
More information
23