(root@node01) > create user 'donor'@'%' identified by 'donor';
Query OK, 0 rows affected (0.10 sec)
(root@node01) > grant backup_admin on *.* to 'donor'@'%';
Query OK, 0 rows affected (0.23 sec)
(root@node01) > show grants for 'donor'@'%';
+------------------------------------------+
| Grants for donor@% |
+------------------------------------------+
| GRANT USAGE ON *.* TO `donor`@`%` |
| GRANT BACKUP_ADMIN ON *.* TO `donor`@`%` |
+------------------------------------------+
2 rows in set (0.11 sec)
(root@node01) > install plugin clone soname 'mysql_clone.so';
Query OK, 0 rows affected (1.66 sec)
(root@node01) > show global variables like 'clone%';
+-------------------------------------------+---------+
| Variable_name | Value |
+-------------------------------------------+---------+
| clone_autotune_concurrency | ON |
| clone_block_ddl | OFF |
| clone_buffer_size | 4194304 |
| clone_ddl_timeout | 300 |
| clone_delay_after_data_drop | 0 |
| clone_donor_timeout_after_network_failure | 5 |
| clone_enable_compression | OFF |
| clone_max_concurrency | 16 |
| clone_max_data_bandwidth | 0 |
| clone_max_network_bandwidth | 0 |
| clone_ssl_ca | |
| clone_ssl_cert | |
| clone_ssl_key | |
| clone_valid_donor_list | |
+-------------------------------------------+---------+
14 rows in set (0.11 sec)
(root@node02) > create user 'replica'@'%' identified by 'replica';
Query OK, 0 rows affected (0.03 sec)
(root@node02) > grant clone_admin,system_variables_admin on *.* to 'replica'@'%';
Query OK, 0 rows affected (0.01 sec)
(root@node02) > show grants for 'replica'@'%';
+------------------------------------------------------------------+
| Grants for replica@% |
+------------------------------------------------------------------+
| GRANT USAGE ON *.* TO `replica`@`%` |
| GRANT CLONE_ADMIN,SYSTEM_VARIABLES_ADMIN ON *.* TO `replica`@`%` |
+------------------------------------------------------------------+
2 rows in set (0.00 sec)
(root@node02) > install plugin clone soname 'mysql_clone.so';
Query OK, 0 rows affected (0.08 sec)
[mysql@node02 ~]$ mysql -ureplica -preplica -hnode02
(replica@node02) > set global clone_valid_donor_list='192.168.1.101:3306';
Query OK, 0 rows affected (0.00 sec)
(replica@node02) > clone instance from 'donor'@'192.168.1.101':3306 identified by 'donor';
Query OK, 0 rows affected (1 min 35.41 sec)
(root@node02) > select * from performance_schema.clone_progress;
+------+-----------+-----------+----------------------------+----------------------------+---------+------------+------------+------------+------------+---------------+
| ID | STAGE | STATE | BEGIN_TIME | END_TIME | THREADS | ESTIMATE | DATA | NETWORK | DATA_SPEED | NETWORK_SPEED |
+------+-----------+-----------+----------------------------+----------------------------+---------+------------+------------+------------+------------+---------------+
| 1 | DROP DATA | Completed | 2023-08-04 10:58:20.067783 | 2023-08-04 10:58:20.560624 | 1 | 0 | 0 | 0 | 0 | 0 |
| 1 | FILE COPY | Completed | 2023-08-04 10:58:20.561700 | 2023-08-04 10:59:52.534608 | 2 | 2088062436 | 2088062436 | 2088183441 | 0 | 0 |
| 1 | PAGE COPY | Completed | 2023-08-04 10:59:52.535234 | 2023-08-04 10:59:52.668787 | 2 | 0 | 0 | 197 | 0 | 0 |
| 1 | REDO COPY | Completed | 2023-08-04 10:59:52.669329 | 2023-08-04 10:59:52.802320 | 2 | 2560 | 2560 | 2999 | 0 | 0 |
| 1 | FILE SYNC | Completed | 2023-08-04 10:59:52.802949 | 2023-08-04 10:59:54.415432 | 2 | 0 | 0 | 0 | 0 | 0 |
| 1 | RESTART | Completed | 2023-08-04 10:59:54.415432 | 2023-08-04 10:59:59.931717 | 0 | 0 | 0 | 0 | 0 | 0 |
| 1 | RECOVERY | Completed | 2023-08-04 10:59:59.931717 | 2023-08-04 11:00:08.709242 | 0 | 0 | 0 | 0 | 0 | 0 |
+------+-----------+-----------+----------------------------+----------------------------+---------+------------+------------+------------+------------+---------------+
7 rows in set (0.00 sec)
(root@node02) > select * from performance_schema.clone_status\G;
*************************** 1. row ***************************
ID: 1
PID: 0
STATE: Completed
BEGIN_TIME: 2023-08-04 10:58:19.007
END_TIME: 2023-08-04 11:00:08.709
SOURCE: 192.168.1.101:3306
DESTINATION: LOCAL INSTANCE
ERROR_NO: 0
ERROR_MESSAGE:
BINLOG_FILE: mysql-bin.000006
BINLOG_POSITION: 2001
GTID_EXECUTED:
1 row in set (0.00 sec)
(root@node02) > change replication source to \
source_host='192.168.1.101', \
source_log_file='mysql-bin.000006', \
source_log_pos=2001,
get_source_public_key=1;
Query OK, 0 rows affected (0.05 sec)
(root@node02) > start replica user='repl' password='repl';
Query OK, 0 rows affected (0.04 sec)
(root@node02) > show replica status\G;
标签:clone,8.0,rows,04,Plugin,Clone,sec,2023,08
From: https://blog.51cto.com/dbprofessional/7233194