O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.

OpenSUSE Conf 2020 MySQL Clone

79 visualizações

Publicada em

MySQL Clone explained

Publicada em: Software
  • Seja o primeiro a comentar

  • Seja a primeira pessoa a gostar disto

OpenSUSE Conf 2020 MySQL Clone

  1. 1. Georgi Kodinov, MySQL team lead MySQL Clone A better way to migrate databases
  2. 2. Georgi “Joro” Kodinov • Doing MySQL server development since 2006 • Based in Plovdiv, Bulgaria • Works on security features, MySQL wire protocol, plugins • Speaker at OpenSUSE conferences since 2013 2 © 2020 Oracle
  3. 3. What is MySQL Clone ? A simple and efficient way to create a MySQL instance replica © 2020 Oracle3
  4. 4. WhyYet Another Method ? • It’s easy to use: a single command • It’s a data snapshot with consistent GTID and binary log position • Data can be cloned locally or from remote • It’s resumable ! © 2020 Oracle4
  5. 5. It’s FASTER Too ! © 2020 Oracle5 https://mydbops.wordpress.com/2019/11/14/ mysql-clone-plugin-speed-test/ 2 servers CPU: 2 Cores RAM: 4 GB DISK: 200 GB SSD approx. 122.40 GB data from sysbench
  6. 6. Clone: Use Cases © 2020 Oracle6
  7. 7. Provision a new replication node © 2020 Oracle7 Source Replica Replica2
  8. 8. Re-provision a returning node © 2020 Oracle8 BinlogSource ReplicaData ??
  9. 9. Clone: Operation © 2020 Oracle9
  10. 10. Terminology © 2020 Oracle10 Donor RecipientData
  11. 11. The big picture © 2020 Oracle11 Client Network Network Clone Plugin Innodb SE-2 [Future] Clone Plugin Innodb SE-2 [Future] Recipient Server Donor Server Clone SQL mysql> CLONE INSTANCE FROM clone_user@donor.host.com:3306 IDENTIFIED BY "clone_password"; Connect
  12. 12. Prerequisites on the Donor • Install the plugin: INSTALL PLUGIN clone SONAME 'mysql_clone.so'; • Grant BACKUP_ADMIN to a user account CREATE USER foo …; GRANT BACKUP_ADMIN TO foo; © 2020 Oracle12
  13. 13. Prerequisites on the Recipient • Install the plugin: INSTALL PLUGIN clone SONAME 'mysql_clone.so'; • Grant CLONE_ADMIN to a user account CREATE USER bar …; GRANT CLONE_ADMIN TO bar; • Allow the donor host SET GLOBAL clone_valid_donor_list='donor_computer:3306'; © 2020 Oracle13
  14. 14. On the recipient, as “bar” CLONE INSTANCE FROM foo@donor_computer:3306 IDENTIFIED BY 'foo_pwd‘ DATA DIRECTORY = 'clone_dir' REQUIRE SSL © 2020 Oracle14
  15. 15. Clone: What Has Just Happened ? © 2020 Oracle15
  16. 16. Clone Stages © 2020 Oracle16 Init Data Files File Copy Modified Page IDs Page Copy Redo Logs Redo Copy Done
  17. 17. Clone: Network Failure Recovery © 2020 Oracle17 Donor RecipientData Less than 5 min
  18. 18. Clone Monitoring: performance_schema.clone_status mysql> SELECT STATE FROM performance_schema.clone_status; +-----------+ | STATE | +-----------+ | Completed | +-----------+ © 2020 Oracle18
  19. 19. Clone Monitoring: performance_schema.clone_progress mysql> SELECT STAGE, STATE, END_TIME FROM performance_schema.clone_progress; +-----------+-----------+----------------------------+ | stage | state | end_time | +-----------+-----------+----------------------------+ | DROP DATA | Completed | 2020-09-27 14:45:43.141261 | | FILE COPY | Completed | 2020-09-27 14:45:44.457572 | | PAGE COPY | Completed | 2020-09-27 14:45:44.577330 | | REDO COPY | Completed | 2020-09-27 14:45:44.679570 | | FILE SYNC | Completed | 2020-09-27 14:45:44.918547 | | RESTART | Completed | 2020-09-27 14:45:48.583565 | | RECOVERY | Completed | 2020-09-27 14:45:49.626595 | +-----------+-----------+----------------------------+ © 2020 Oracle19
  20. 20. Performance And Resource Use Control © 2020 Oracle20 Variable Type Meaning clone_max_concurrency Int (Maximum) number of cloning threads clone_autotune_concurrency Bool Enable dynamic spawning of cloning threads clone_max_network_bandwidth Int, Mbps (recipient only) limit network usage clone_max_data_bandwidth Int, Mbps (recipient only) limit clone transfer rate
  21. 21. Clone Limitations • Does not clone configuration values • Does not clone binary logs • Supports only InnoDB • Blocks all concurrent DDLs on the Donor • Will FULLY override recipient data • Only to the SAME server version • Only on the same OS and platform • Doesn’t work over the X protocol © 2020 Oracle21
  22. 22. Further Reading • Reference Manual • https://dev.mysql.com/doc/refman/8.0/en/clone-plugin.html • Blogs • https://mysqlserverteam.com/clone-create-mysql-instance-replica/ • https://mysqlhighavailability.com/mysql-innodb-cluster-automatic-node-provisioning • https://mysqlhighavailability.com/a-breakthrough-in-usability-automatic-node-provisioning • https://mysqlhighavailability.com/automatic-provisioning-in-group-replication • InnoDB cluster video • https://lefred.be/content/migrate-from-a-single-mysql-instance-to-mysql-innodb-cluster- using-clone-plugin/ © 2020 Oracle22
  23. 23. Thank you ! Georgi Kodinov, Software Development Director Georgi.Kodinov@oracle.com https://www.slideshare.net/GeorgiKodinov © 2020 Oracle23

×