Using MySQL 8.0.17 Clone Plugin to Create a Slave from Scratch
This article demonstrates how to install and verify the MySQL 8.0.17 clone plugin, create privileged clone users on both donor and recipient servers, configure cloning parameters, execute a full instance clone, set up replication with CHANGE MASTER, and discusses the plugin's limitations such as InnoDB‑only support and DDL restrictions.
The MySQL 8.0.17 clone plugin enables fast, physical cloning of an InnoDB data set from a donor (master) to a recipient (slave) server, simplifying the creation of a new replica.
Installation and verification
Install the plugin on each server with:
INSTALL PLUGIN clone SONAME 'mysql_clone.so';Confirm it is active:
SELECT PLUGIN_NAME, PLUGIN_STATUS FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME LIKE 'clone';Create clone users
On the donor:
CREATE USER clone_user@'%' IDENTIFIED BY 'sekret'; GRANT BACKUP_ADMIN ON *.* TO 'clone_user'@'%';On the recipient (slave):
CREATE USER clone_user@'localhost' IDENTIFIED BY 'sekret'; GRANT CLONE_ADMIN ON *.* TO 'clone_user'@'localhost';Replace the wildcard host with the specific IP or network mask for security.
Configure cloning parameters
Set the donor list on the recipient:
SET GLOBAL clone_valid_donor_list = '127.0.0.1:45008';Optionally increase error‑log verbosity for detailed progress:
SET GLOBAL log_error_verbosity = 3;Execute the clone
Run on the recipient:
CLONE INSTANCE FROM [email protected]:45008 IDENTIFIED BY 'sekret';Monitor progress in the error logs of both servers; the logs show a series of notes such as “Server: Acquired backup lock”, “Clone Begin Master Task”, and “Clone End Master Task”.
After cloning, restart the MySQL service on the recipient.
Set up replication
Retrieve binary log position and GTID from the donor:
SELECT BINLOG_FILE, BINLOG_POSITION FROM performance_schema.clone_status; SELECT @@GLOBAL.GTID_EXECUTED;Apply them on the recipient:
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=45008, MASTER_USER='root', MASTER_PASSWORD='msandbox', MASTER_AUTO_POSITION=1; START SLAVE;Limitations
The plugin clones only InnoDB tables; MyISAM or CSV tables are cloned as empty.
DDL statements (including TRUNCATE TABLE ) are blocked during cloning; DML can run concurrently.
If DDL is attempted, the operation waits for the backup lock, as shown by processlist entries with state “Waiting for backup lock”.
Conclusion
The clone plugin makes creating a fresh replica straightforward, works over SSL, and can also be used to provision Group Replication members.
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.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.