- 5.6.7.1 Installing the Clone Plugin
- 5.6.7.2 Cloning Data Locally
- 5.6.7.3 Cloning Remote Data
- 5.6.7.4 Cloning Encrypted Data
- 5.6.7.5 Cloning Compressed Data
- 5.6.7.6 Cloning for Replication
- 5.6.7.7 Directories and Files Created During a Cloning Operation
- 5.6.7.8 Remote Cloning Operation Failure Handling
- 5.6.7.9 Monitoring Cloning Operations
- 5.6.7.10 Stopping a Cloning Operation
- 5.6.7.11 Clone System Variable Reference
- 5.6.7.12 Clone System Variables
- 5.6.7.13 Clone Plugin Limitations
The clone plugin permits cloning data locally or from a remote MySQL server instance. Cloned data is a physical snapshot of data stored in InnoDB
that includes schemas, tables, tablespaces, and data dictionary metadata. The cloned data comprises a fully functional data directory, which permits using the clone plugin for MySQL server provisioning.
A local cloning operation clones data from the MySQL server instance where the cloning operation is initiated to a directory on the same server or node where MySQL server instance runs.
A remote cloning operation involves a local MySQL server instance (the “recipient”) where the cloning operation is initiated, and a remote MySQL server instance (the “donor”) where the source data is located. When a remote cloning operation is initiated on the recipient, cloned data is transferred over the network from the donor to the recipient. By default, a remote cloning operation removes the data in the recipient data directory and replaces it with the cloned data. Optionally, you can clone data to a different directory on the recipient to avoid removing existing data.
There is no difference with respect to data that is cloned by a local cloning operation as compared to a remote cloning operation. Both operations clone the same data.
The clone plugin supports replication. In addition to cloning data, a cloning operation extracts and transfers replication coordinates from the donor and applies them on the recipient, which enables using the clone plugin for provisioning Group Replication members and replication slaves. Using the clone plugin for provisioning is considerably faster and more efficient than replicating a large number of transactions (see Section 5.6.7.6, “Cloning for Replication”). Group Replication members can also be configured to use the clone plugin as an alternative method of recovery, so that members automatically choose the most efficient way to retrieve group data from seed members. For more information, see Section 18.4.3.1, “Cloning for Distributed Recovery”.
The clone plugin supports cloning of encrypted and page-compressed data. See Section 5.6.7.4, “Cloning Encrypted Data”, and Section 5.6.7.5, “Cloning Compressed Data”.
The clone plugin must be installed before you can use it. For installation instructions, see Section 5.6.7.1, “Installing the Clone Plugin”. For cloning instructions, see Section 5.6.7.2, “Cloning Data Locally”, and Section 5.6.7.3, “Cloning Remote Data”.
Performance Schema tables and instrumentation are provided for monitoring cloning operations. See Section 5.6.7.9, “Monitoring Cloning Operations”.
This section describes how to install and configure the clone plugin. For remote cloning operations, the clone plugin must be installed on the donor and recipient MySQL server instances.
For general information about installing or uninstalling plugins, see Section 5.6.1, “Installing and Uninstalling Plugins”.
To be usable by the server, the plugin library file must be located in the
MySQL plugin directory (the directory named by the plugin_dir
system variable). If necessary, set the
value of plugin_dir
at server startup to tell the server the
plugin directory location.
The plugin library file base name is mysql_clone.so
. The file name suffix differs by platform
(for example, .so
for Unix and Unix-like systems,
.dll
for Windows).
To load the plugin at server startup, use the --plugin-load-add
option to name the library file that
contains it. With this plugin-loading method, the option must be given each time
the server starts. For example, put these lines in your my.cnf
file (adjust the .so
suffix for your platform as necessary):
[mysqld] plugin-load-add=mysql_clone.so
After modifying my.cnf
, restart the server to cause the new settings to take effect.
The --plugin-load-add
option cannot be used to load the clone plugin when restarting the server during an upgrade from a previous MySQL version. For example, after upgrading binaries or packages from MySQL 5.7 to MySQL 8.0, attempting to restart the server with plugin-load-add=mysql_clone.so
causes this error: [ERROR] [MY-013238] [Server] Error installing plugin 'clone': Cannot install during upgrade. The workaround is to upgrade the server before attempting to start the server with plugin-load-add=mysql_clone.so
.
Alternatively, to load the plugin at runtime, use this statement (adjust the .so
suffix for your platform as necessary):
INSTALL PLUGIN clone SONAME 'mysql_clone.so';
INSTALL PLUGIN
loads the plugin, and also registers it in the mysql.plugins
system table to cause the plugin to be loaded for each subsequent normal server startup without the need for --plugin-load-add
.
To verify plugin installation, examine the INFORMATION_SCHEMA.PLUGINS
table or use the SHOW PLUGINS
statement (see Section 5.6.2, “Obtaining Server Plugin Information”). For example:
mysql>SELECT PLUGIN_NAME, PLUGIN_STATUS
FROM INFORMATION_SCHEMA.PLUGINS
WHERE PLUGIN_NAME = 'clone';
+------------------------+---------------+ | PLUGIN_NAME | PLUGIN_STATUS | +------------------------+---------------+ | clone | ACTIVE | +------------------------+---------------+
If the plugin fails to initialize, check the server error log for clone or plugin-related diagnostic messages.
If the plugin has been previously registered with INSTALL PLUGIN
or is loaded with --plugin-load-add
, you can use the --clone
option at server startup to control the plugin activation state. For example, to load the plugin at startup and prevent it from being removed at runtime, use these options:
[mysqld] plugin-load-add=mysql_clone.so clone=FORCE_PLUS_PERMANENT
If you want to prevent the server from running without the clone plugin, use --clone
with a value of FORCE
or FORCE_PLUS_PERMANENT
to force server startup to fail if the plugin does not initialize successfully.
For more information about plugin activation states, see Controlling Plugin Activation State.
The clone plugin supports the following syntax for cloning data locally; that is, cloning data from the local MySQL data directory to another directory on the same server or node where the MySQL server instance runs:
CLONE LOCAL DATA DIRECTORY [=] 'clone_dir
';
To use CLONE
syntax, the clone plugin must be installed. For installation instructions, see Section 5.6.7.1, “Installing the Clone Plugin”.
The BACKUP_ADMIN
privilege is required to execute CLONE LOCAL DATA DIRECTORY
statements.
mysql> GRANT BACKUP_ADMIN ON *.* TO 'clone_user
';
where
is the MySQL user that will perform the cloning operation. The user you select to perform the cloning operation can be any MySQL user with the clone_user
BACKUP_ADMIN
privilege on *.*.
The following example demonstrates cloning data locally:
mysql> CLONE LOCAL DATA DIRECTORY = '/path/to/clone_dir
';
where /path/to/clone_dir
is the full path of the local directory that data is cloned to. An absolute path is required, and the specified directory (“clone_dir
”) must not exist, but the specified path must be an existent path. The MySQL server must have the necessary write access to create the directory.
A local cloning operation does not support cloning of user-created tables or tablespaces that reside outside of the data directory. Attempting to clone such tables or tablespaces causes the following error: ERROR 1086 (HY000): File '/path/to/tablespace_name.ibd
' already exists. Cloning a tablespace with the same path as the source tablespace would cause a conflict and is therefore prohibited.
All other user-created InnoDB
tables and tablespaces, the InnoDB
system tablespace, redo logs, and undo tablespaces are cloned to the specified directory.
If desired, you can start the MySQL server on the cloned directory after the cloning operation is complete.
shell> mysqld_safe --datadir=clone_dir
where clone_dir
is the directory that data was cloned to.
For information about monitoring cloning operation status and progress, see Section 5.6.7.9, “Monitoring Cloning Operations”.
The clone plugin supports the following syntax for cloning remote data; that is, cloning data from a remote MySQL server instance (the donor) and transferring it to the MySQL instance where the cloning operation was initiated (the recipient).
CLONE INSTANCE FROM 'user
'@'host
':port
IDENTIFIED BY 'password
' [DATA DIRECTORY [=] 'clone_dir
'] [REQUIRE [NO] SSL];
where:
-
is the clone user on the donor MySQL server instance.user
-
is thepassword
password.user
-
is thehost
hostname
address of the donor MySQL server instance. Internet Protocol version 6 (IPv6) address format is not supported. An alias to the IPv6 address can be used instead. An IPv4 address can be used as is. -
is theport
port
number of the donor MySQL server instance. (The X Protocol port specified bymysqlx_port
is not supported. Connecting to the donor MySQL server instance through MySQL Router is also not supported.) -
DATA DIRECTORY [=] '
is an optional clause used to specify a directory on the recipient for the data you are cloning. Use this option if you do not want to remove existing data in the recipient data directory. An absolute path is required, and the directory must not exist. The MySQL server must have the necessary write access to create the directory.clone_dir
'When the optional
DATA DIRECTORY [=] '
clause is not used, a cloning operation removes existing data in the recipient data directory, replaces it with the cloned data, and automatically restarts the server afterward.clone_dir
' -
[REQUIRE [NO] SSL]
explicitly specifies whether an encrypted connection is to be used or not when transferring cloned data over the network. An error is returned if the explicit specification cannot be satisfied. If an SSL clause is not specified, clone attempts to establish an encrypted connection by default, falling back to an insecure connection if the secure connection attempt fails. A secure connection is required when cloning encrypted data regardless of whether this clause is specified. For more information, see Configuring an Encrypted Connection for Cloning.
By default, user-created InnoDB
tables and tablespaces that reside in the data directory on the donor MySQL server instance are cloned to the data directory on the recipient MySQL server instance. If the DATA DIRECTORY [=] '
clause is specified, they are cloned to the specified directory.clone_dir
'
User-created InnoDB
tables and tablespaces that reside outside of the data directory on the donor MySQL server instance are cloned to the same path on the recipient MySQL server instance. An error is reported if a table or tablespace already exists.
By default, the InnoDB
system tablespace, redo logs, and undo tablespaces are cloned to the same locations that are configured on the donor (as defined by innodb_data_home_dir
and innodb_data_file_path
, innodb_log_group_home_dir
, and innodb_undo_directory
, respectively). If the DATA DIRECTORY [=] '
clause is specified, those tablespaces and logs are cloned to the specified directory.clone_dir
'
To perform a cloning operation, the clone plugin must be active on both the donor and recipient MySQL server instances. For installation instructions, see Section 5.6.7.1, “Installing the Clone Plugin”.
A MySQL user on the donor and recipient is required for executing the cloning operation (the “clone user”).
-
On the donor, the clone user requires the
BACKUP_ADMIN
privilege for accessing and transferring data from the donor, and for blocking DDL during the cloning operation. -
On the recipient, the clone user requires the
CLONE_ADMIN
privilege for replacing recipient data, blocking DDL during the cloning operation, and automatically restarting the server. TheCLONE_ADMIN
privilege includesBACKUP_ADMIN
andSHUTDOWN
privileges implicitly.
Instructions for creating the clone user and granting the required privileges are included in the remote cloning example that follows this prerequisite information.
The following prerequisites are checked when the CLONE INSTANCE
statement is executed:
-
The donor and recipient must have the same MySQL server version. The clone plugin is supported in MYSQL 8.0.17 and higher.
mysql> SHOW VARIABLES LIKE 'version'; +---------------+--------+ | Variable_name | Value | +---------------+--------+ | version | 8.0.17 | +---------------+--------+
-
The donor and recipient MySQL server instances must run on the same operating system and platform. For example, if the donor instance runs on a Linux 64-bit platform, the recipient instance must also run on that platform. Refer to your operating system documentation for information about how to determine your operating system platform.
-
The recipient must have enough disk space for the cloned data. By default, recipient data is removed prior to cloning the donor data, so you only require enough space for the donor data. If you clone to a named directory using the
DATA DIRECTORY
clause, you must have enough disk space for the existing recipient data and the cloned data. You can estimate the size of your data by checking the data directory size on your file system and the size of any tablespaces that reside outside of the data directory. When estimating data size on the donor, remember that onlyInnoDB
data is cloned. If you store data in other storage engines, adjust your data size estimate accordingly. -
InnoDB
permits creating some tablespace types outside of the data directory. If the donor MySQL server instance has tablespaces that reside outside of the data directory, the cloning operation must be able access those tablespaces. You can query theINFORMATION_SCHEMA.FILES
table to identify tablespaces that reside outside of the data directory. Files that reside outside of the data directory have a fully qualified path to a directory other than the data directory.mysql> SELECT FILE_NAME FROM INFORMATION_SCHEMA.FILES;
-
Plugins that are active on the donor, including any keyring plugin, must also be active on the recipient. You can identify active plugins by issuing a
SHOW PLUGINS
statement or by querying theINFORMATION_SCHEMA.PLUGINS
table. -
The donor and recipient must have the same MySQL server character set and collation. For information about MySQL server character set and collation configuration, see Section 10.15, “Character Set Configuration”.
-
The same
innodb_page_size
andinnodb_data_file_path
settings are required on the donor and recipient. Theinnodb_data_file_path
setting on the donor and recipient must specify the same number of data files of an equivalent size. You can check variable settings usingSHOW VARIABLES
syntax.mysql> SHOW VARIABLES LIKE 'innodb_page_size'; mysql> SHOW VARIABLES LIKE 'innodb_data_file_path';
-
If cloning encrypted or page-compressed data, the donor and recipient must have the same file system block size. For page-compressed data, the recipient file system must support sparse files and hole punching for hole punching to occur on the recipient. For information about these features and how to identify tables and tablespaces that use them, see Section 5.6.7.4, “Cloning Encrypted Data”, and Section 5.6.7.5, “Cloning Compressed Data”. To determine your file system block size, refer to your operating system documentation.
-
A secure connection is required if you are cloning encrypted data. See Configuring an Encrypted Connection for Cloning.
-
The
clone_valid_donor_list
setting on the recipient must include the host address of the donor MySQL server instance. You can only clone data from a host on the valid donor list. A MySQL user with theSYSTEM_VARIABLES_ADMIN
privilege is required to configure this variable. Instructions for setting theclone_valid_donor_list
variable are provided in the remote cloning example that follows this section. You can check theclone_valid_donor_list
setting usingSHOW VARIABLES
syntax.mysql> SHOW VARIABLES LIKE 'clone_valid_donor_list';
-
There must be no other cloning operation running. Only a single cloning operation is permitted at a time. To determine if a clone operation is running, query the
clone_status
table. See Monitoring Cloning Operations using Performance Schema Clone Tables. -
The clone plugin transfers data in 1MB packets plus metadata. The minimum required
max_allowed_packet
value is therefore 2MB on the donor and the recipient MySQL server instances. Amax_allowed_packet
value less than 2MB results in an error. Use the following query to check yourmax_allowed_packet
setting:mysql> SHOW VARIABLES LIKE 'max_allowed_packet';
The following prerequisites also apply:
-
Undo tablespace file names on the donor must be unique. When data is cloned to the recipient, undo tablespaces, regardless of their location on the donor, are cloned to the
innodb_undo_directory
location on the recipient or to the directory specified by theDATA DIRECTORY [=] '
clause, if used. Duplicate undo tablespace file names on the donor are not permitted for this reason. As of MySQL 8.0.18, an error is reported if duplicate undo tablespace file names are encountered during a cloning operation. Prior to MySQL 8.0.18, cloning undo tablespaces with the same file name could result in undo tablespace files being overwritten on the recipient.clone_dir
'To view undo tablespace file names on the donor to ensure that they are unique, query
INFORMATION_SCHEMA.FILES
:mysql> SELECT TABLESPACE_NAME, FILE_NAME FROM INFORMATION_SCHEMA.FILES WHERE FILE_TYPE LIKE 'UNDO LOG';
For information about dropping and adding undo tablespace files, see Section 15.6.3.4, “Undo Tablespaces”.
-
By default, the recipient MySQL server instance is restarted (stopped and started) automatically after the data is cloned. For an automatic restart to occur, a monitoring process must be available on the recipient to detect server shutdowns. Otherwise, the cloning operation halts with the following error after the data is cloned, and the recipient MySQL server instance is shut down:
ERROR 3707 (HY000): Restart server failed (mysqld is not managed by supervisor process).
This error does not indicate a cloning failure. It means that the recipient MySQL server instance must be started again manually after the data is cloned. After starting the server manually, you can connect to the recipient MySQL server instance and check the Performance Schema clone tables to verify that the cloning operation completed successfully (see Monitoring Cloning Operations using Performance Schema Clone Tables.) The
RESTART
statement has the same monitoring process requirement. For more information, see Section 13.7.8.8, “RESTART Statement”. This requirement is not applicable if cloning to a named directory using theDATA DIRECTORY
clause, as an automatic restart is not performed in this case. -
Several variables control various aspects of a remote cloning operation. Before performing a remote cloning operation, review the variables and adjust settings as necessary to suit your computing environment. Clone variables are set on recipient MySQL server instance where the cloning operation is executed. See Section 5.6.7.12, “Clone System Variables”.
The following example demonstrates cloning remote data. By default, a remote cloning operation removes the data in the recipient data directory, replaces it with the cloned data, and restarts the MySQL server afterward.
The example assumes that remote cloning prerequisites are met. See Remote Cloning Prerequisites.
-
Login to the donor MySQL server instance with an administrative user account.
-
Create a clone user with the
BACKUP_ADMIN
privilege.mysql> CREATE USER 'donor_clone_user'@'example.donor.host.com' IDENTIFIED BY '
password
'; mysql> GRANT BACKUP_ADMIN on *.* to 'donor_clone_user'@'example.donor.host.com'; -
Install the clone plugin:
mysql> INSTALL PLUGIN clone SONAME 'mysql_clone.so';
-
-
Login to the recipient MySQL server instance with an administrative user account.
-
Create a clone user with the
CLONE_ADMIN
privilege.mysql> CREATE USER 'recipient_clone_user'@'example.recipient.host.com' IDENTIFIED BY '
password
'; mysql> GRANT CLONE_ADMIN on *.* to 'recipient_clone_user'@'example.recipient.host.com'; -
Install the clone plugin:
mysql> INSTALL PLUGIN clone SONAME 'mysql_clone.so';
-
Add the host address of the donor MySQL server instance to the
clone_valid_donor_list
variable setting.mysql> SET GLOBAL clone_valid_donor_list = '
example.donor.host.com
:3306
';
-
-
Log on to the recipient MySQL server instance as the clone user you created previously (
recipient_clone_user'@'example.recipient.host.com
) and execute theCLONE INSTANCE
statement.mysql> CLONE INSTANCE FROM 'donor_clone_user'@'example.donor.host.com':3306 IDENTIFIED BY '
password
';After the data is cloned, the MySQL server instance on the recipient is restarted automatically.
For information about monitoring cloning operation status and progress, see Section 5.6.7.9, “Monitoring Cloning Operations”.
By default, a remote cloning operation removes the data in the recipient data directory and replaces it with the cloned data. By cloning to a named directory, you can avoid removing existing data from the recipient data directory.
The procedure for cloning to a named directory is the same procedure described in Cloning Remote Data with one exception: The CLONE INSTANCE
statement must include the DATA DIRECTORY
clause. For example:
mysql> CLONE INSTANCE FROM 'user
'@'example.donor.host.com
':3306
IDENTIFIED BY 'password
' DATA DIRECTORY = '/path/to/clone_dir
';
An absolute path is required, and the directory must not exist. The MySQL server must have the necessary write access to create the directory.
When cloning to a named directory, the recipient MySQL server instance is not restarted automatically after the data is cloned. If you want to restart the MySQL server on the named directory, you must do so manually:
shell> mysqld_safe --datadir=/path/to/clone_dir
where /path/to/clone_dir
is the path to the named directory on the recipient.
You can configure an encrypted connection for remote cloning operations to protect data as it is cloned over the network. An encrypted connection is required by default when cloning encrypted data. (see Section 5.6.7.4, “Cloning Encrypted Data”.)
The instructions that follow describe how to configure the recipient MySQL server instance to use an encrypted connection. It is assumed that the donor MySQL server instance is already configured to use encrypted connections. If not, refer to Section 6.3.1, “Configuring MySQL to Use Encrypted Connections” for server-side configuration instructions.
To configure the recipient MySQL server instance to use an encrypted connection:
-
Make the client certificate and key files of the donor MySQL server instance available to the recipient host. Either distribute the files to the recipient host using a secure channel or place them on a mounted partition that is accessible to the recipient host. The client certificate and key files to make available include:
-
ca.pem
The self-signed certificate authority (CA) file.
-
client-cert.pem
The client public key certificate file.
-
client-key.pem
The client private key file.
-
-
Configure the following SSL options on the recipient MySQL server instance.
-
Specifies the path to the self-signed certificate authority (CA) file.
-
Specifies the path to the client public key certificate file.
-
Specifies the path to the client private key file.
For example:
clone_ssl_ca=/
path
/to
/ca.pem clone_ssl_cert=/path
/to
/client-cert.pem clone_ssl_key=/path
/to
/client-key.pem -
-
To require that an encrypted connection is used, include the
REQUIRE SSL
clause when issuing theCLONE
statement on the recipient.mysql> CLONE INSTANCE FROM '
user
'@'example.donor.host.com
':3306
IDENTIFIED BY 'password
' DATA DIRECTORY = '/path/to/clone_dir
' REQUIRE SSL;If an SSL clause is not specified, the clone plugin attempts to establish an encrypted connection by default, falling back to an unencrypted connection if the encrypted connection attempt fails.
NoteIf you are cloning encrypted data, an encrypted connection is required by default regardless of whether the
REQUIRE SSL
clause is specified. UsingREQUIRE NO SSL
causes an error if you attempt to clone encrypted data.
Cloning of encrypted data is supported. The following requirements apply:
-
A secure connection is required when cloning remote data to ensure safe transfer of unencrypted tablespace keys over the network. Tablespace keys are decrypted at the donor before transport and re-encrypted at the recipient using the recipient master key. An error is reported if an encrypted connection is not available or the
REQUIRE NO SSL
clause is used in theCLONE INSTANCE
statement. For information about configuring an encrypted connection for cloning, see Configuring an Encrypted Connection for Cloning. -
When cloning data to a local data directory that uses a locally managed keyring, the same keyring must be used when starting the MySQL server on the clone directory.
-
When cloning data to a remote data directory (the recipient directory) that uses a locally managed keyring, the recipient keyring must be used when starting the MySQL sever on the cloned directory.
The innodb_redo_log_encrypt
and innodb_undo_log_encrypt
variable settings cannot be modified while a cloning operation is in progress.
For information about the data encryption feature, see Section 15.13, “InnoDB Data-at-Rest Encryption”.
Cloning of page-compressed data is supported. The following requirements apply when cloning remote data:
-
The recipient file system must support sparse files and hole punching for hole punching to occur on the recipient.
-
The donor and recipient file systems must have the same block size. If file system block sizes differ, an error similar to the following is reported: ERROR 3868 (HY000): Clone Configuration FS Block Size: Donor value: 114688 is different from Recipient value: 4096.
For information about the page compression feature, see Section 15.9.2, “InnoDB Page Compression”.
The clone plugin supports replication. In addition to cloning data, a cloning operation extracts replication coordinates from the donor and transfers them to the recipient, which enables using the clone plugin for provisioning Group Replication members and replication slaves. Using the clone plugin for provisioning is considerably faster and more efficient than replicating a large number of transactions.
Group Replication members can also be configured to use the clone plugin as an option for distributed recovery, in which case joining members automatically choose the most efficient way to retrieve group data from existing group members. For more information, see Section 18.4.3.1, “Cloning for Distributed Recovery”.
During the cloning operation, both the binary log position (filename, offset) and the gtid_executed
GTID set are extracted and transferred from the donor MySQL server instance to the recipient. This data permits initiating replication at a consistent position in the replication stream. The binary logs and relay logs, which are held in files, are not copied from the donor to the recipient. To initiate replication, the binary logs required for the recipient to catch up to the donor must not be purged between the time that the data is cloned and the time that replication is started. If the required binary logs are not available, a replication handshake error is reported. A cloned instance should therefore be added to a replication group without excessive delay to avoid required binary logs being purged or the new member lagging behind significantly, requiring more recovery time.
-
Issue this query on a cloned MySQL server instance to check the binary log position that was transferred to the recipient:
mysql> SELECT BINLOG_FILE, BINLOG_POSITION FROM performance_schema.clone_status;
-
Issue this query on a cloned MySQL server instance to check the
gtid_executed
GTID set that was transferred to the recipient:mysql> SELECT @@GLOBAL.GTID_EXECUTED;
When master_info_repository=TABLE
and relay_log_info_repository=TABLE
are set on the recipient (which is the default in MySQL 8.0), the slave status logs are held in tables that are copied from the donor to the recipient during the cloning operation. The slave status logs hold replication-related configuration settings that can be used to resume replication correctly after the cloning operation.
-
In MySQL 8.0.17 and 8.0.18, only the table
mysql.slave_master_info
(the master info log) is copied. -
From MySQL 8.0.19, the tables
mysql.slave_relay_log_info
(the relay log info log) andmysql.slave_worker_info
(the slave worker log) are also copied.
For a list of what is included in each table, see Section 17.2.4.2, “Slave Status Logs”. Note that if master_info_repository=FILE
and relay_log_info_repository=FILE
are set on the server (which is not the default in MySQL 8.0 and is deprecated), the slave status logs are not cloned; they are only cloned if TABLE
is set.
To clone for replication, perform the following steps:
-
For a new group member for Group Replication, first configure the MySQL Server instance for Group Replication, following the instructions in Section 18.2.1.6, “Adding Instances to the Group”. Also set up the prerequisites for cloning described in Section 18.4.3.1, “Cloning for Distributed Recovery”. When you issue
START GROUP_REPLICATION
on the joining member, the cloning operation is managed automatically by Group Replication, so you do not need to carry out the operation manually, and you do not need to perform any further setup steps on the joining member. -
For a slave in a master/slave MySQL replication topology, first clone the data from the donor MySQL server instance to the recipient manually. The donor must be a master or slave in the replication topology. For cloning instructions, see Section 5.6.7.3, “Cloning Remote Data”.
-
After the cloning operation completes successfully, if you want to use the same replication channels on the recipient MySQL server instance that were present on the donor, verify which of them can resume replication automatically in the master/slave MySQL replication topology, and which need to be set up manually.
-
For GTID-based replication, if the recipient is configured with
gtid_mode=ON
and has cloned from a donor withgtid_mode=ON
,ON_PERMISSIVE
, orOFF_PERMISSIVE
, thegtid_executed
GTID set from the donor is applied on the recipient. If the recipient is cloned from a slave already in the topology, replication channels on the recipient that use GTID auto-positioning (as specified by theMASTER_AUTO_POSITION
option on theCHANGE MASTER TO
statement) can resume replication automatically after the cloning operation when the channel is started. You do not need to perform any manual setup if you just want to use these same channels. -
For binary log file position based replication, if the recipient is at MySQL 8.0.17 or 8.0.18, the binary log position from the donor is not applied on the recipient, only recorded in the Performance Schema
clone_status
table. Replication channels on the recipient that use binary log file position based replication must therefore be set up manually to resume replication after the cloning operation. Ensure that these channels are not configured to start replication automatically at server startup, as they will not have the binary log position and will attempt to start replication from the beginning. -
For binary log file position based replication, if the recipient is at MySQL 8.0.19 or above, the binary log position from the donor is applied on the recipient. Replication channels on the recipient that use binary log file position based replication automatically attempt to carry out the relay log recovery process, using the cloned relay log information, before restarting replication. For a single-threaded slave (
slave_parallel_workers
is set to 0), relay log recovery should succeed in the absence of any other issues, enabling the channel to resume replication with no further setup. For a multithreaded slave (slave_parallel_workers
is greater than 0), relay log recovery is likely to fail because it cannot usually be completed automatically. In this case, an error message is issued, and you must set the channel up manually.
-
-
If you need to set up cloned replication channels manually, or want to use different replication channels on the recipient, the following instructions provide a summary and abbreviated examples for adding a recipient MySQL server instance to a replication topology. Also refer to the detailed instructions that apply to your replication setup.
-
To add a recipient MySQL server instance to a MySQL replication topology that uses GTID-based transactions as the replication data source, configure the instance as required, following the instructions in Section 17.1.3.4, “Setting Up Replication Using GTIDs”. Add replication channels for the instance as shown in the following abbreviated example. The
CHANGE MASTER TO
statement must define the host address and port number of the master, and theMASTER_AUTO_POSITION
option should be enabled, as shown:mysql> CHANGE MASTER TO MASTER_HOST = '
master_host_name
', MASTER_PORT =master_port_num
, ... MASTER_AUTO_POSITION = 1, FOR CHANNEL 'setup_channel
'; mysql> START SLAVE USER = 'user_name
' PASSWORD = 'password
' FOR CHANNEL 'setup_channel
'; -
To add a recipient MySQL server instance to a MySQL replication topology that uses binary log file position based replication, configure the instance as required, following the instructions in Section 17.1.2, “Setting Up Binary Log File Position Based Replication”. Add replication channels for the instance as shown in the following abbreviated example, using the binary log position that was transferred to the recipient during the cloning operation:
mysql> SELECT BINLOG_FILE, BINLOG_POSITION FROM performance_schema.clone_status; mysql> CHANGE MASTER TO MASTER_HOST = '
master_host_name
', MASTER_PORT =master_port_num
, ... MASTER_LOG_FILE = 'master_log_name
', MASTER_LOG_POS =master_log_pos
, FOR CHANNEL 'setup_channel
'; mysql> START SLAVE USER = 'user_name
' PASSWORD = 'password
' FOR CHANNEL 'setup_channel
';
-
When data is cloned, the following directories and files are created for internal use. They should not be modified.
-
#clone
: Contains internal clone files used by the cloning operation. Created in the directory that data is cloned to. -
#ib_archive
: Contains internally archived log files, archived on the donor during the cloning operation. -
*.#clone
files: Temporary data files created on the recipient while the existing data directory is replaced by a remote cloning operation.
This section describes failure handing at different stages of a cloning operation.
-
Prerequisites are checked (see Remote Cloning Prerequisites).
-
If a failure occurs during the prerequisite check, the
CLONE INSTANCE
operation reports an error.
-
-
A backup lock is taken to block DDL operations.
-
If the cloning operation is unable to obtain a DDL lock within the time limit specified by the
clone_ddl_timeout
variable, an error is reported.
-
-
User-created data (schemas, tables, tablespaces) and binary logs on the recipient are removed before data is cloned to the recipient data directory.
-
When user created data is removed from the recipient during a remote cloning operation, existing data in the recipient data directory is not saved and may be lost if a failure occurs. If the data to be replaced on the recipient is of importance, a backup should be taken before initiating a remote cloning operation.
For informational purposes, warnings are printed to the server error log to specify when data removal starts and finishes:
[Warning] [MY-013453] [InnoDB] Clone removing all user data for provisioning: Started... [Warning] [MY-013453] [InnoDB] Clone removing all user data for provisioning: Finished
If a failure occurs while removing data, the recipient may be left with a partial set of schemas, tables, and tablespaces that existed before the cloning operation. Any time during the execution of a cloning operation or after a failure, the server is always in a consistent state.
-
-
Data is cloned from the donor. User-created data, dictionary metadata, and other system data are cloned.
-
If a failure occurs while cloning data, the cloning operation is rolled back and all cloned data removed. At this stage, the previously existing data on the recipient has also been removed, which leaves the recipient with no user data.
Should this scenario occur, you can either rectify the cause of the failure and re-execute the cloning operation, or forgo the cloning operation and restore the recipient data from a backup taken before the cloning operation.
-
-
The server is restarted automatically (applies to remote cloning operations that do not clone to a named directory). During startup, typical server startup tasks are performed.
-
If the automatic server restart fails, you can restart the server manually to complete the cloning operation.
-
If a network error occurs during a cloning operation, the operation resumes if the error is resolved within five minutes. Otherwise, the operation aborts and returns an error.
This section describes options for monitoring cloning operations.
A cloning operation may take some time to complete, depending on the amount of data and other factors related to data transfer. You can monitor the status and progress of a cloning operation on the recipient MySQL server instance using the clone_status
and clone_progress
Performance Schema tables.
The clone_status
and clone_progress
Performance Schema tables can be used to monitor a cloning operation on the recipient MySQL server instance only. To monitor a cloning operation on the donor MySQL server instance, use the clone stage events, as described in Monitoring Cloning Operations Using Performance Schema Stage Events.
-
The
clone_status
table provides the state of the current or last executed cloning operation. A clone operation has four possible states:Not Started
,In Progress
,Completed
, andFailed
. -
The
clone_progress
table provides progress information for the current or last executed clone operation, by stage. The stages of a cloning operation includeDROP DATA
,FILE COPY
,PAGE_COPY
,REDO_COPY
,FILE_SYNC
,RESTART
, andRECOVERY
.
The SELECT
and EXECUTE
privileges on the Performance Schema is required to access the Performance Schema clone tables.
To check the state of a cloning operation:
-
Connect to the recipient MySQL server instance.
-
Query the
clone_status
table:mysql>
SELECT STATE FROM performance_schema.clone_status;
+-----------+ | STATE | +-----------+ | Completed | +-----------+
Should a failure occur during a cloning operation, you can query the clone_status
table for error information:
mysql> SELECT STATE, ERROR_NO, ERROR_MESSAGE FROM performance_schema.clone_status;
+-----------+----------+---------------+
| STATE | ERROR_NO | ERROR_MESSAGE |
+-----------+----------+---------------+
| Failed | xxx | "xxxxxxxxxxx" |
+-----------+----------+---------------+
To review the details of each stage of a cloning operation:
-
Connect to the recipient MySQL server instance.
-
Query the
clone_progress
table. For example, the following query provides state and end time data for each stage of the cloning operation:mysql>
SELECT STAGE, STATE, END_TIME FROM performance_schema.clone_progress;
+-----------+-----------+----------------------------+ | stage | state | end_time | +-----------+-----------+----------------------------+ | DROP DATA | Completed | 2019-01-27 22:45:43.141261 | | FILE COPY | Completed | 2019-01-27 22:45:44.457572 | | PAGE COPY | Completed | 2019-01-27 22:45:44.577330 | | REDO COPY | Completed | 2019-01-27 22:45:44.679570 | | FILE SYNC | Completed | 2019-01-27 22:45:44.918547 | | RESTART | Completed | 2019-01-27 22:45:48.583565 | | RECOVERY | Completed | 2019-01-27 22:45:49.626595 | +-----------+-----------+----------------------------+For other clone status and progress data points that you can monitor, refer to Section 26.12.16, “Performance Schema Clone Tables”.
A cloning operation may take some time to complete, depending on the amount of data and other factors related to data transfer. There are three stage events for monitoring the progress of a cloning operation. Each stage event reports
and WORK_COMPLETED
values. Reported values are revised as the operation progresses.WORK_ESTIMATED
This method of monitoring a cloning operation can be used on the donor or recipient MySQL server instance.
In order of occurrence, cloning operation stage events include:
-
stage/innodb/clone (file copy)
: Indicates progress of the file copy phase of the cloning operation.
andWORK_ESTIMATED
units are file chunks. The number of files to be transferred is known at the start of the file copy phase, and the number of chunks is estimated based on the number of files.WORK_COMPLETED
WORK_ESTIMATED
is set to the number of estimated file chunks.WORK_COMPLETED
is updated after each chunk is sent. -
stage/innodb/clone (page copy)
: Indicates progress of the page copy phase of cloning operation.WORK_ESTIMATED
andWORK_COMPLETED
units are pages. Once the file copy phase is completed, the number of pages to be transferred is known, andWORK_ESTIMATED
is set to this value.WORK_COMPLETED
is updated after each page is sent. -
stage/innodb/clone (redo copy)
: Indicates progress of the redo copy phase of cloning operation.WORK_ESTIMATED
andWORK_COMPLETED
units are redo chunks. Once the page copy phase is completed, the number of redo chunks to be transferred is known, andWORK_ESTIMATED
is set to this value.WORK_COMPLETED
is updated after each chunk is sent.
The following example demonstrates how to enable stage/innodb/clone%
event instruments and related consumer tables to monitor a cloning operation. For information about Performance Schema stage event instruments and related consumers, see Section 26.12.5, “Performance Schema Stage Event Tables”.
-
Enable the
stage/innodb/clone%
instruments:mysql>
UPDATE performance_schema.setup_instruments SET ENABLED = 'YES'
WHERE NAME LIKE 'stage/innodb/clone%';
-
Enable the stage event consumer tables, which include
events_stages_current
,events_stages_history
, andevents_stages_history_long
.mysql>
UPDATE performance_schema.setup_consumers SET ENABLED = 'YES'
WHERE NAME LIKE '%stages%';
-
Run a cloning operation. In this example, a local data directory is cloned to a directory named
cloned_dir
.mysql>
CLONE LOCAL DATA DIRECTORY = '/path/to/cloned_dir';
-
Check the progress of the cloning operation by querying the Performance Schema
events_stages_current
table. The stage event shown differs depending on the cloning phase that is in progress. TheWORK_COMPLETED
column shows the work completed. TheWORK_ESTIMATED
column shows the work required in total.mysql>
SELECT EVENT_NAME, WORK_COMPLETED, WORK_ESTIMATED FROM performance_schema.events_stages_current
WHERE EVENT_NAME LIKE 'stage/innodb/clone%';
+--------------------------------+----------------+----------------+ | EVENT_NAME | WORK_COMPLETED | WORK_ESTIMATED | +--------------------------------+----------------+----------------+ | stage/innodb/clone (redo copy) | 1 | 1 | +--------------------------------+----------------+----------------+The
events_stages_current
table returns an empty set if the cloning operation has finished. In this case, you can check theevents_stages_history
table to view event data for the completed operation. For example:mysql>
SELECT EVENT_NAME, WORK_COMPLETED, WORK_ESTIMATED FROM events_stages_history
WHERE EVENT_NAME LIKE 'stage/innodb/clone%';
+--------------------------------+----------------+----------------+ | EVENT_NAME | WORK_COMPLETED | WORK_ESTIMATED | +--------------------------------+----------------+----------------+ | stage/innodb/clone (file copy) | 301 | 301 | | stage/innodb/clone (page copy) | 0 | 0 | | stage/innodb/clone (redo copy) | 1 | 1 | +--------------------------------+----------------+----------------+
Performance Schema provides instrumentation for advanced performance monitoring of clone operations. To view the available clone instrumentation, issue the following query:
mysql>SELECT * FROM performance_schema.setup_instruments
WHERE NAME LIKE WHERE NAME LIKE '%clone%';
+----------------------------------------------+---------+ | NAME | ENABLED | +----------------------------------------------+---------+ | wait/synch/mutex/innodb/clone_snapshot_mutex | NO | | wait/synch/mutex/innodb/clone_sys_mutex | NO | | wait/synch/mutex/innodb/clone_task_mutex | NO | | wait/io/file/innodb/innodb_clone_file | YES | | stage/innodb/clone (file copy) | YES | | stage/innodb/clone (redo copy) | YES | | stage/innodb/clone (page copy) | YES | | statement/abstract/clone | YES | | statement/clone/local | YES | | statement/clone/client | YES | | statement/clone/server | YES | | memory/innodb/clone | YES | | memory/clone/data | YES | +----------------------------------------------+---------+
Wait Instruments
Performance schema wait instruments track events that take time. Clone wait event instruments include:
-
wait/synch/mutex/innodb/clone_snapshot_mutex
: Tracks wait events for the clone snapshot mutex, which synchronizes access to the dynamic snapshot object (on the donor and recipient) between multiple clone threads. -
wait/synch/mutex/innodb/clone_sys_mutex
: Tracks wait events for the clone sys mutex. There is one clone system object in a MySQL server instance. This mutex synchronizes access to the clone system object on the donor and recipient. It is acquired by clone threads and other foreground and background threads. -
wait/synch/mutex/innodb/clone_task_mutex
: Tracks wait events for the clone task mutex, used for clone task management. Theclone_task_mutex
is acquired by clone threads. -
wait/io/file/innodb/innodb_clone_file
: Tracks all I/O wait operations for files that clone operates on.
For information about monitoring InnoDB
mutex waits, see Section 15.16.2, “Monitoring InnoDB Mutex Waits Using Performance Schema”. For information about monitoring wait events in general, see Section 26.12.4, “Performance Schema Wait Event Tables”.
Stage Instruments
Performance Schema stage events track steps that occur during the statement-execution process. Clone stage event instruments include:
-
stage/innodb/clone (file copy)
: Indicates progress of the file copy phase of the cloning operation. -
stage/innodb/clone (redo copy)
: Indicates progress of the redo copy phase of cloning operation. -
stage/innodb/clone (page copy)
: Indicates progress of the page copy phase of cloning operation.
For information about monitoring cloning operations using stage events, see Monitoring Cloning Operations Using Performance Schema Stage Events. For general information about monitoring stage events, see Section 26.12.5, “Performance Schema Stage Event Tables”.
Statement Instruments
Performance Schema statement events track statement execution. When a clone operation is initiated, the different statement types tracked by clone statement instruments may be executed in parallel. You can observe these statement events in the Performance Schema statement event tables. The number of statements that execute depends on the clone_max_concurrency
and clone_autotune_concurrency
settings.
Clone statement event instruments include:
-
statement/abstract/clone
: Tracks statement events for any clone operation before it is classified as a local, client, or server operation type. -
statement/clone/local
: Tracks clone statement events for local clone operations; generated when executing aCLONE LOCAL
statement. -
statement/clone/client
: Tracks remote cloning statement events that occur on the recipient MySQL server instance; generated when executing aCLONE INSTANCE
statement on the recipient. -
statement/clone/server
: Tracks remote cloning statement events that occur on the donor MySQL server instance; generated when executing aCLONE INSTANCE
statement on the recipient.
For information about monitoring Performance Schema statement events, see Section 26.12.6, “Performance Schema Statement Event Tables”.
Memory Instruments
Performance Schema memory instruments track memory usage. Clone memory usage instruments include:
-
memory/innodb/clone
: Tracks memory allocated byInnoDB
for the dynamic snapshot. -
memory/clone/data
: Tracks memory allocated by the clone plugin during a clone operation.
For information about monitoring memory usage using Performance Schema, see Section 26.12.17.10, “Memory Summary Tables”.
The Com_clone
status variable provides a count of CLONE
statement executions.
For more information, refer to the discussion about Com_xxx
statement counter variables in Section 5.1.10, “Server Status Variables”.
If necessary, you can stop a cloning operation with a KILL QUERY
statement.processlist_id
On the recipient MySQL server instance, you can retrieve the processlist identifier (PID) for a cloning operation from the PID
column of the clone_status
table.
mysql> SELECT * FROM performance_schema.clone_statusG
*************************** 1. row ***************************
ID: 1
PID: 8
STATE: In Progress
BEGIN_TIME: 2019-07-15 11:58:36.767
END_TIME: NULL
SOURCE: LOCAL INSTANCE
DESTINATION: /path/to/clone_dir
/
ERROR_NO: 0
ERROR_MESSAGE:
BINLOG_FILE:
BINLOG_POSITION: 0
GTID_EXECUTED:
You can also retrieve the processlist identifier from the ID
column of the INFORMATION_SCHEMA
PROCESSLIST
table, the Id
column of SHOW PROCESSLIST
output, or the PROCESSLIST_ID
column of the Performance Schema threads
table. These methods of obtaining the PID information can be used on the donor or recipient MySQL server instance.
Table 5.5 Clone System Variable Reference
Name | Cmd-Line | Option File | System Var | Status Var | Var Scope | Dynamic |
---|---|---|---|---|---|---|
clone_autotune_concurrency | Yes | Yes | Yes | Global | Yes | |
clone_buffer_size | Yes | Yes | Yes | Global | Yes | |
clone_ddl_timeout | Yes | Yes | Yes | Global | Yes | |
clone_enable_compression | Yes | Yes | Yes | Global | Yes | |
clone_max_concurrency | Yes | Yes | Yes | Global | Yes | |
clone_max_data_bandwidth | Yes | Yes | Yes | Global | Yes | |
clone_max_network_bandwidth | Yes | Yes | Yes | Global | Yes | |
clone_ssl_ca | Yes | Yes | Yes | Global | Yes | |
clone_ssl_cert | Yes | Yes | Yes | Global | Yes | |
clone_ssl_key | Yes | Yes | Yes | Global | Yes | |
clone_valid_donor_list | Yes | Yes | Yes | Global | Yes |
This section describes the system variables that control operation of the clone plugin. If values specified at startup are incorrect, the clone plugin may fail to initialize properly and the server does not load it. In this case, the server may also produce error messages for other clone settings because it will not recognize them.
Each system variable has a default value. System variables can be set at server startup using options on the command line or in an option file. They can be changed dynamically at runtime using the SET
statement, which enables you to modify operation of the server without having to stop and restart it.
Setting a global system variable runtime value normally requires the SYSTEM_VARIABLES_ADMIN
or SUPER
privilege. For more information, see Section 5.1.9.1, “System Variable Privileges”.
Clone variables are configured on the recipient MySQL server instance where the cloning operation is executed.
-
Property Value Command-Line Format --clone-autotune-concurrency
Introduced 8.0.17 System Variable clone_autotune_concurrency
Scope Global Dynamic Yes SET_VAR
Hint AppliesNo Type Boolean Default Value ON
Enables dynamic spawning of threads for remote cloning operations. The setting is applicable to recipient MySQL server instance only. The
clone_max_concurrency
variable defines the maximum number of threads that can be spawned.If
clone_autotune_concurrency
is disabled,clone_max_concurrency
defines the actual number of threads spawned for a remote cloning operation. -
Property Value Command-Line Format --clone-buffer-size
Introduced 8.0.17 System Variable clone_buffer_size
Scope Global Dynamic Yes SET_VAR
Hint AppliesNo Type Integer Default Value 4194304
Minimum Value 1048576
Maximum Value 268435456
Defines the size of the intermediate buffer used when transferring data during a local cloning operation. This setting is not applicable to remote cloning operations. The default value is 4 mebibytes (MiB). A larger buffer size may permit I/O device drivers to fetch data in parallel, which can improve cloning performance.
-
Property Value Command-Line Format --clone-ddl-timeout
Introduced 8.0.17 System Variable clone_ddl_timeout
Scope Global Dynamic Yes SET_VAR
Hint AppliesNo Type Integer Default Value 300
Minimum Value 0
Maximum Value 2592000
The time in seconds to wait for a backup lock when executing a cloning operation. This setting is applied on both the donor and recipient MySQL server instances. A cloning operation cannot run concurrently with DDL operations. A backup lock is required on the donor and recipient MySQL server instances. The cloning operation waits for current DDL operations to finish. Once backup locks are acquired, DDL operations must wait for the cloning operation to finish. A value of 0 means that no backup lock is to be taken for the cloning operation. In this case, the cloning operation fails with an error if a DDL operation is attempted concurrently.
-
Property Value Command-Line Format --clone-enable-compression
Introduced 8.0.17 System Variable clone_enable_compression
Scope Global Dynamic Yes SET_VAR
Hint AppliesNo Type Boolean Default Value OFF
Enables compression of data at the network layer during a remote cloning operation. Compression saves network bandwidth at the cost of CPU. Enabling compression may improve the data transfer rate. This setting is only applied on the recipient MySQL server instance.
-
Property Value Command-Line Format --clone-max-concurrency
Introduced 8.0.17 System Variable clone_max_concurrency
Scope Global Dynamic Yes SET_VAR
Hint AppliesNo Type Integer Default Value 16
Minimum Value 1
Maximum Value 128
Defines the maximum number of concurrent threads for a remote cloning operation. The default value is 16. A greater number of threads can improve cloning performance but also reduces the number of permitted simultaneous client connections, which can affect the performance of existing client connections. This setting is only applied on the recipient MySQL server instance.
If
clone_autotune_concurrency
is enabled (the default),clone_max_concurrency
is the maximum number of threads that can be dynamically spawned for a remote cloning operation. Ifclone_autotune_concurrency
is disabled,clone_max_concurrency
defines the actual number of threads spawned for a remote cloning operation.A minimum data transfer rate of 1 mebibyte (MiB) per thread is recommended for remote cloning operations. The data transfer rate for a remote cloning operation is controlled by the
clone_max_data_bandwidth
variable. -
Property Value Command-Line Format --clone-max-data-bandwidth
Introduced 8.0.17 System Variable clone_max_data_bandwidth
Scope Global Dynamic Yes SET_VAR
Hint AppliesNo Type Integer Default Value 0
Minimum Value 0
Maximum Value 1048576
Defines the maximum data transfer rate in mebibytes (MiB) per second for a remote cloning operation. This variable helps manage the performance impact of a cloning operation. A limit should be set only when donor disk I/O bandwidth is saturated, affecting performance. A value of 0 means “unlimited”, which permits cloning operations to run at the highest possible data transfer rate. This setting is only applicable to the recipient MySQL server instance.
The minimum data transfer rate is 1 MiB per second, per thread. For example, if there are 8 threads, the minimum transfer rate is 8 MiB per second. The
clone_max_concurrency
variable controls the maximum number threads spawned for a remote cloning operation.The requested data transfer rate specified by
clone_max_data_bandwidth
may differ from the actual data transfer rate reported by theDATA_SPEED
column in theperformance_schema.clone_progress
table. If your cloning operation is not achieving the desired data transfer rate and you have available bandwidth, check I/O usage on the recipient and donor. If there is underutilized bandwidth, I/O is the next mostly likely bottleneck. -
Property Value Command-Line Format --clone-max-network-bandwidth
Introduced 8.0.17 System Variable clone_max_network_bandwidth
Scope Global Dynamic Yes SET_VAR
Hint AppliesNo Type Integer Default Value 0
Minimum Value 0
Maximum Value 1048576
Specifies the maximum approximate network transfer rate in mebibytes (MiB) per second for a remote cloning operation. This variable can be used to manage the performance impact of a cloning operation on network bandwidth. It should be set only when network bandwidth is saturated, affecting performance on the donor instance. A value of 0 means “unlimited”, which permits cloning at the highest possible data transfer rate over the network, providing the best performance. This setting is only applicable to the recipient MySQL server instance.
-
Property Value Command-Line Format --clone-ssl-ca=file_name
Introduced 8.0.14 System Variable clone_ssl_ca
Scope Global Dynamic Yes SET_VAR
Hint AppliesNo Type File name Default Value empty string
Specifies the path to the certificate authority (CA) file. Used to configure an encrypted connection for a remote cloning operation. This setting configured on the recipient and used when connecting to the donor.
-
Property Value Command-Line Format --clone-ssl-cert=file_name
Introduced 8.0.14 System Variable clone_ssl_cert
Scope Global Dynamic Yes SET_VAR
Hint AppliesNo Type File name Default Value empty string
Specifies the path to the public key certificate. Used to configure an encrypted connection for a remote cloning operation. This setting configured on the recipient and used when connecting to the donor.
-
Property Value Command-Line Format --clone-ssl-key=file_name
Introduced 8.0.14 System Variable clone_ssl_key
Scope Global Dynamic Yes SET_VAR
Hint AppliesNo Type File name Default Value empty string
Specifies the path to the private key file. Used to configure an encrypted connection for a remote cloning operation. This setting configured on the recipient and used when connecting to the donor.
-
Property Value Command-Line Format --clone-valid-donor-list=value
Introduced 8.0.17 System Variable clone_valid_donor_list
Scope Global Dynamic Yes SET_VAR
Hint AppliesNo Type String Default Value NULL
Defines valid donor host addresses for remote cloning operations. This setting is applied on the recipient MySQL server instance. A comma-separated list of values is permitted in the following format: “
HOST1:PORT1,HOST2:PORT2,HOST3:PORT3
”. Spaces are not permitted.The
clone_valid_donor_list
variable adds a layer of security by providing control over the sources of cloned data. The privilege required to configureclone_valid_donor_list
is different from the privilege required to execute remote cloning operations, which permits assigning those responsibilities to different roles. Configuringclone_valid_donor_list
requires theSYSTEM_VARIABLES_ADMIN
privilege, whereas executing a remote cloning operation requires theCLONE_ADMIN
privilege.Internet Protocol version 6 (IPv6) address format is not supported. Internet Protocol version 6 (IPv6) address format is not supported. An alias to the IPv6 address can be used instead. An IPv4 address can be used as is.
The clone plugin is subject to these limitations:
-
DDL, including
TRUNCATE TABLE
, is not permitted during a cloning operation. This limitation should be considered when selecting data sources. A workaround is to use dedicated donor instances, which can accommodate DDL operations being blocked while data is cloned. Concurrent DML is permitted. -
An instance cannot be cloned from a different MySQL server version. The donor and recipient must have the same MySQL server version. For example, you cannot clone between MySQL 5.7 and MySQL 8.0. The clone plugin is only supported in MySQL 8.0.17 and higher.
-
Only a single MySQL instance can be cloned at a time. Cloning multiple MySQL instances in a single cloning operation is not supported.
-
The X Protocol port specified by
mysqlx_port
is not supported for remote cloning operations (when specifying the port number of the donor MySQL server instance in aCLONE INSTANCE
statement). -
The clone plugin does not support cloning of MySQL server configurations. The recipient MySQL server instance retains its configuration, including persisted system variable settings (see Section 5.1.9.3, “Persisted System Variables”.)
-
The clone plugin does not support cloning of binary logs.
-
The clone plugin only clones data stored in
InnoDB
. Other storage engine data is not cloned.MyISAM
andCSV
tables stored in any schema including thesys
schema are cloned as empty tables. -
Connecting to the donor MySQL server instance through MySQL Router is not supported.
-
Local cloning operations do not support cloning of general tablespaces that were created with an absolute path. A cloned tablespace file with the same path as the source tablespace file would cause a conflict.