Databases 13 min read

Practical Guide to MySQL Clone Plugin: Local and Remote Cloning, Setup, Monitoring, and Comparison with XtraBackup

This article provides a comprehensive tutorial on MySQL 8.0's Clone Plugin, covering its concepts, local and remote cloning procedures, required permissions, configuration steps, monitoring queries, and a detailed comparison with XtraBackup for fast data replication and recovery.

Aikesheng Open Source Community
Aikesheng Open Source Community
Aikesheng Open Source Community
Practical Guide to MySQL Clone Plugin: Local and Remote Cloning, Setup, Monitoring, and Comparison with XtraBackup

The MySQL 8.0 Clone Plugin enables fast physical cloning of InnoDB data either locally or from a remote donor, creating a complete data directory that can be used to configure replication or group replication.

Plugin Overview – The plugin must be installed on both donor and recipient servers (e.g., plugin-load-add=mysql_clone.so in [mysqld] or INSTALL PLUGIN clone SONAME 'mysql_clone.so'; ) and verified with SELECT PLUGIN_NAME, PLUGIN_STATUS FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME LIKE 'clone'; .

Local Clone – Execute on the recipient server: CLONE LOCAL DATA DIRECTORY = '/path/to/clone_dir'; The operation proceeds through stages DROP DATA, FILE COPY, PAGE COPY, REDO COPY, and FILE SYNC, which can be monitored with: SELECT STAGE, STATE, END_TIME FROM performance_schema.clone_progress;

Remote Clone – Requires both servers to have the plugin installed and appropriate privileges (BACKUP_ADMIN/CLONE_ADMIN on the donor, CLONE_ADMIN on the recipient). Create users and grant rights, then set the donor list on the recipient: SET GLOBAL clone_valid_donor_list = 'donor_host:port'; Start the clone with: CLONE INSTANCE FROM clone_user@'donor_host':port IDENTIFIED BY 'password'; Progress can be checked with the same performance_schema.clone_progress query.

Monitoring and Control – Check overall status with: SELECT STATE FROM performance_schema.clone_status; Or retrieve error information: SELECT STATE, ERROR_NO, ERROR_MESSAGE FROM performance_schema.clone_status; The number of clone operations is tracked by SHOW GLOBAL STATUS LIKE 'Com_clone'; . A running clone can be aborted by locating its thread ID via SHOW PROCESSLIST and issuing KILL thread_id; .

Comparison with XtraBackup – Both are physical hot‑backup solutions, but the Clone Plugin does not require a separate restore step, preserves file permissions automatically, and works over the MySQL port without needing SSH or SCP. It also integrates replication metadata, allowing immediate setup of GTID or traditional replication.

Using the Clone for Replication – After cloning, configure a replication slave with standard statements such as: CHANGE MASTER TO MASTER_HOST='donor_host', MASTER_USER='repl', MASTER_PASSWORD='pwd', MASTER_PORT=port, MASTER_AUTO_POSITION=1; or set up group replication as described in the official MySQL documentation.

Conclusion – The Clone Plugin offers a simple, fast, and permission‑preserving method for data cloning, backup, and replication setup, making it a viable alternative to traditional tools like XtraBackup for many MySQL 8.0 environments.

performance monitoringMySQLReplicationbackupxtrabackupClone Plugin
Aikesheng Open Source Community
Written by

Aikesheng Open Source Community

The Aikesheng Open Source Community provides stable, enterprise‑grade MySQL open‑source tools and services, releases a premium open‑source component each year (1024), and continuously operates and maintains them.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.