MySQL8数据迁移方法–克隆
MySQL8数据迁移方法–克隆
MySQL8数据迁移方法–克隆)
背景介绍
将旧环境A中的数据迁移至新环境B中
旧环境A与新环境B内部各有一套主从,将旧环境A从节点的数据进行备份,然后还原至新环境B的主节点,将旧环境A的从节点作为新环境B的主节点,整体框架为主从从模式的级联备份;
本次是基于新环境B内主从之间的克隆
MySQL版本为8.0.36
主节点ip: 192.168.1.110
从节点ip: 192.168.1.120
端口:3306
从节点120克隆主节点110的数据
提示
版本大于等于8.0.17且不支持跨版本。要求相同版本号,您无法MySQL 5.7和MySQL 8.0之间进行克隆,在8.0.19和8.0.20之间也不可以,而且要求版本>=8.0.17,版本在>=8.0.37以后支持小版本不一致之间的克隆。
步骤概览
主节点:
修改主节点my.cnf,添加级联和克隆插件参数->重启主节点->添加克隆用户,并赋权
从节点:
修改从节点my.cnf,添加级联和克隆插件参数->重启从节点->开始克隆->克隆完成后,停止slave->重置slave->设置主从关系->查看主从状态
1.旧环境A从节点与新环境B主节点主从关系建立
1.1 修改旧环境A从节点配置
编辑配置文件 my.cnf,再[mysqld]下边添加以下参数
#开启gtid模式
gtid_mode=ON
enforce_gtid_consistency=ON
#$# 级联开关
log-slave-updates=1
#$# 添加克隆插件
plugin-load-add=mysql_clone.so
clone=FORCE_PLUS_PERMANENT
1.2 重启旧环境A从节点
service mysqld restart
1.3 备份旧环境A从节点的数据
使用mysqldump或者xtrabackup工具进行备份
参考命令:
# mysqldump 方式:
mysqldump -uroot -p dbname > /backup/mysqldump/dbname.dump
# xtrabackup方式:
xtrabackup --user='bak_user' --password='123456' --socket=/var/run/mysqld/mysqld.sock --port=3306 --no-server-version-check --backup --target-dir=/data/backup_files/mysqlbak_20241202
1.4 将备份的数据环境至新环境B的主节点
1.4.1mysqldump 备份的还原方式
# mysqldump 备份的还原方式:
mysql -uroot -p db_name < /backup/mysqldump/db_name.dump
1.4.2xtrabackup备份的还原方式:
# 查看服务状态
service mysqld status
# 停服务
service mysqld stop
# 备份当前数据库的数据目录
mv /data/apps/mysql/data /data/apps/mysql/data_bak_241202
# 校验备份数据
echo `date ` && /data/apps/percona-xtrabackup-8.0.34-29-Linux-x86_64.glibc2.17/bin/xtrabackup --prepare --target-dir=/data/backup_files/mysqlbak_20241202 && echo `date ` && cat
# 校验完成标识 "[Note] [MY-011825] [Xtrabackup] completed OK!"
2024-12-02T17:24:21.675241+08:00 0 [Note] [MY-011825] [Xtrabackup] starting shutdown with innodb_fast_shutdown = 1
2024-12-02T17:24:21.675318+08:00 0 [Note] [MY-012330] [InnoDB] FTS optimize thread exiting.
2024-12-02T17:24:22.613393+08:00 0 [Note] [MY-013072] [InnoDB] Starting shutdown...
2024-12-02T17:24:22.714184+08:00 0 [Note] [MY-013084] [InnoDB] Log background threads are being closed...
2024-12-02T17:24:22.733256+08:00 0 [Note] [MY-012980] [InnoDB] Shutdown completed; log sequence number 10409446364182
2024-12-02T17:24:22.742294+08:00 0 [Note] [MY-011825] [Xtrabackup] completed OK!
# 导入备份数据
echo `date ` && /data/apps/percona-xtrabackup-8.0.34-29-Linux-x86_64.glibc2.17/bin/xtrabackup --copy-back --target-dir=/data/backup_files/mysqlbak_20241202 --data-dir=/data/apps/mysql/data/ && echo `date ` && cat
# 备份完成后启动mysql
service mysqld start
# 连接mysql
mysql -root -p"123456"
1.5 设置旧环境A从节点与新环境B的主从关系
# 根据备份文件查看数据同步点位
grep position /data/backup_files/mysqlbak_20241202/xtrabackup_info
## 同步点位如下:
binlog_pos = filename 'mysql-bin.000539', position '237', GTID of the last change '47cca224-688c-11ec-92de-fa163e6ee3b6:1,47d142f6-688c-11ec-b683-fa163ea4bbf3:16536-1208982072'
## 重置master状态
reset master;
## 重置所有从节点
reset slave all;
## 设置 GLOBAL gtid_purged
SET GLOBAL gtid_purged='47cca224-688c-11ec-92de-fa163e6ee3b6:1,47d142f6-688c-11ec-b683-fa163ea4bbf3:16536-1208982072';
## 设置主节点
change master to master_host='192.168.2.222',master_port=3306,master_user='repl',master_password='123456',MASTER_AUTO_POSITION=1;
## 启动从节点
start slave;
## 查看从节点状态
show slave status\G
2、主节点操作
2.1 设置级联和克隆插件参数
编辑配置文件 my.cnf,再[mysqld]下边添加以下参数
#开启gtid模式
gtid_mode=ON
enforce_gtid_consistency=ON
#$# 级联开关
log-slave-updates=1
#$# 添加克隆插件
plugin-load-add=mysql_clone.so
clone=FORCE_PLUS_PERMANENT
2.2重启mysql服务
service mysqld restart
2.3查看插件状态
## 操作命令
SELECT PLUGIN_NAME, PLUGIN_STATUS FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME = 'clone';
## 操作回显日志,查看插件状态
mysql> SELECT PLUGIN_NAME, PLUGIN_STATUS FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME = 'clone';
+-------------+---------------+
| PLUGIN_NAME | PLUGIN_STATUS |
+-------------+---------------+
| clone | ACTIVE |
+-------------+---------------+
1 row in set (0.00 sec)
mysql>
2.4创建克隆用户
## 命令如下:
create user clone_user@'%' identified by '123456';
grant backup_admin,clone_admin on *.* to clone_user@'%';
flush privileges;
## 操作回显日志
mysql> create user clone_user@'10.%' identified by '123456';
Query OK, 0 rows affected (0.01 sec)
mysql> grant backup_admin,clone_admin on *.* to clone_user@'%';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> show grants for clone_user@'%';
+-----------------------------------------------------------+
| Grants for clone_user@% |
+-----------------------------------------------------------+
| GRANT USAGE ON *.* TO `clone_user`@`%` |
| GRANT BACKUP_ADMIN,CLONE_ADMIN ON *.* TO `clone_user`@`%` |
+-----------------------------------------------------------+
2 rows in set (0.00 sec)
3.从节点操作
3.1设置级联和克隆插件参数
编辑配置文件 my.cnf,再[mysqld]下边添加以下参数
#开启gtid模式
gtid_mode=ON
enforce_gtid_consistency=ON
#$# 级联开关
log-slave-updates=1
#$# 添加克隆插件
plugin-load-add=mysql_clone.so
clone=FORCE_PLUS_PERMANENT
3.2重启mysql服务
service mysqld restart
3.3查看插件状态
## 操作命令
SELECT PLUGIN_NAME, PLUGIN_STATUS FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME = 'clone';
## 操作回显日志,查看插件状态
mysql> SELECT PLUGIN_NAME, PLUGIN_STATUS FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME = 'clone';
+-------------+---------------+
| PLUGIN_NAME | PLUGIN_STATUS |
+-------------+---------------+
| clone | ACTIVE |
+-------------+---------------+
1 row in set (0.00 sec)
mysql>
3.4从节点开始克隆
## 操作命令
## 设定CLONE的源址,如果从A主机上克隆,则clone_valid_donor_list = 'A主机的ip:数据库端口'
show variables like "%clone_valid_donor_list%";
SET GLOBAL clone_valid_donor_list = '192.168.1.110:3306';
## 操作回显日志,开始克隆
# mysql目录下的data文件夹有3.8T,主机裸金属,磁盘ssd,克隆时长为63mins,可以作为参考;
mysql> CLONE INSTANCE FROM 'clone_user'@'192.168.1.110':3306 IDENTIFIED BY '123456';
Query OK, 0 rows affected (1 hour 2 min 49.92 sec)
mysql>
3.5 查看克隆进度
再打开一个从节点窗口,连接mysql
## 操作命令:
## 1.连接数据库
mysql: mysql -uroot -p'123456'
## 2.查看克隆状态:
SELECT * FROM performance_schema.clone_status \G
## 3.查看克隆进度:
select
stage,
state,
cast(begin_time as DATETIME) as "START TIME",
cast(end_time as DATETIME) as "FINISH TIME",
lpad(sys.format_time(power(10,12) * (unix_timestamp(end_time) - unix_timestamp(begin_time))), 10, ' ') as DURATION,
lpad(concat(format(round(estimate/1024/1024,0), 0), "MB"), 16, ' ') as "Estimate",
case when begin_time is NULL then LPAD('%0', 7, ' ')
when estimate > 0 then
lpad(concat(round(data*100/estimate, 0), "%"), 7, ' ')
when end_time is NULL then lpad('0%', 7, ' ')
else lpad('100%', 7, ' ')
end as "Done(%)"
from performance_schema.clone_progress;
## 操作回显日志:
[mysql@192.168.1.120 plugin]$ mysql -uroot -p'123456'
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[mysql@192.168.1.120 plugin]$ mysql -uadmin -p"123456"
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 16
Server version: 8.0.36 MySQL Community Server - GPL
Copyright (c) 2000, 2024, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> SELECT * FROM performance_schema.clone_status \G
*************************** 1. row ***************************
ID: 1
PID: 8
STATE: In Progress
BEGIN_TIME: 2024-12-02 11:30:26.162
END_TIME: NULL
SOURCE: 192.168.1.110:3306
DESTINATION: LOCAL INSTANCE
ERROR_NO: 0
ERROR_MESSAGE:
BINLOG_FILE:
BINLOG_POSITION: 0
GTID_EXECUTED:
1 row in set (0.00 sec)
mysql> select stage, state, cast(begin_time as DATETIME) as "START TIME", cast(end_time as DATETIME) as "FINISH TIME", lpad(sys.format_time(power(10,12) * (unix_timestamp(end_time) - unix_timestamp(begin_time))), 10, ' ') as DURATION, lpad(concat(format(round(estimate/1024/1024,0), 0), "MB"), 16, ' ') as "Estimate", case when begin_time is NULL then LPAD('%0', 7, ' ') when
estimate > 0 then lpad(concat(round(data*100/estimate, 0), "%"), 7, ' ') when end_time is NULL then lpad('0%', 7, ' ') else lpad('100%', 7, ' ') end as "Done(%)" from performance_schema.clone_progress;
+-----------+-------------+---------------------+---------------------+------------+------------------+---------+
| stage | state | START TIME | FINISH TIME | DURATION | Estimate | Done(%) |
+-----------+-------------+---------------------+---------------------+------------+------------------+---------+
| DROP DATA | Completed | 2024-12-02 11:30:28 | 2024-12-02 11:30:35 | 7.1 s | 0MB | 100% |
| FILE COPY | In Progress | 2024-12-02 11:30:35 | NULL | NULL | 3,934,315MB | 13% |
| PAGE COPY | Not Started | NULL | NULL | NULL | 0MB | %0 |
| REDO COPY | Not Started | NULL | NULL | NULL | 0MB | %0 |
| FILE SYNC | Not Started | NULL | NULL | NULL | 0MB | %0 |
| RESTART | Not Started | NULL | NULL | NULL | 0MB | %0 |
| RECOVERY | Not Started | NULL | NULL | NULL | 0MB | %0 |
+-----------+-------------+---------------------+---------------------+------------+------------------+---------+
7 rows in set (0.00 sec)
mysql>
mysql> exit
Bye
#$# ***Tips:这里密码是克隆后数据库的用户名密码***
[mysql@192.168.1.120 plugin]$ mysql -uroot -p'123456'
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 16
Server version: 8.0.36 MySQL Community Server - GPL
Copyright (c) 2000, 2024, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> SELECT * FROM performance_schema.clone_status \G
*************************** 1. row ***************************
ID: 1
PID: 0
STATE: Completed
BEGIN_TIME: 2024-12-02 11:30:26.162
END_TIME: 2024-12-02 12:33:40.513
SOURCE: 192.168.1.110:3306
DESTINATION: LOCAL INSTANCE
ERROR_NO: 0
ERROR_MESSAGE:
BINLOG_FILE: mysql-bin.000104
BINLOG_POSITION: 662921016
GTID_EXECUTED: 1f25da5b-af1a-11ef-8c51-684aaea03ad1:1-9,
47cca224-688c-11ec-92de-fa163e6ee3b6:1,
47d142f6-688c-11ec-b683-fa163ea4bbf3:16536-1217308744
1 row in set (0.00 sec)
mysql> select stage, state, cast(begin_time as DATETIME) as "START TIME", cast(end_time as DATETIME) as "FINISH TIME", lpad(sys.format_time(power(10,12) * (unix_timestamp(end_time) - unix_timestamp(begin_time))), 10, ' ') as DURATION, lpad(concat(format(round(estimate/1024/1024,0), 0), "MB"), 16, ' ') as "Estimate", case when begin_time is NULL then LPAD('%0', 7, ' ') when
estimate > 0 then lpad(concat(round(data*100/estimate, 0), "%"), 7, ' ') when end_time is NULL then lpad('0%', 7, ' ') else lpad('100%', 7, ' ') end as "Done(%)" from performance_schema.clone_progress;
+-----------+-----------+---------------------+---------------------+------------+------------------+---------+
| stage | state | START TIME | FINISH TIME | DURATION | Estimate | Done(%) |
+-----------+-----------+---------------------+---------------------+------------+------------------+---------+
| DROP DATA | Completed | 2024-12-02 11:30:28 | 2024-12-02 11:30:35 | 7.1 s | 0MB | 100% |
| FILE COPY | Completed | 2024-12-02 11:30:35 | 2024-12-02 12:33:04 | 1.04 h | 3,934,315MB | 100% |
| PAGE COPY | Completed | 2024-12-02 12:33:04 | 2024-12-02 12:33:08 | 3.97 s | 4,174MB | 100% |
| REDO COPY | Completed | 2024-12-02 12:33:08 | 2024-12-02 12:33:08 | 272.79 ms | 135MB | 100% |
| FILE SYNC | Completed | 2024-12-02 12:33:08 | 2024-12-02 12:33:16 | 8.14 s | 0MB | 100% |
| RESTART | Completed | 2024-12-02 12:33:16 | 2024-12-02 12:33:26 | 9.53 s | 0MB | 100% |
| RECOVERY | Completed | 2024-12-02 12:33:26 | 2024-12-02 12:33:41 | 14.91 s | 0MB | 100% |
+-----------+-----------+---------------------+---------------------+------------+------------------+---------+
7 rows in set (0.00 sec)
mysql>
3.6设置主从关系
## 操作命令:
## 1.停止slave
STOP SLAVE;
## 2.重置slave
RESET SLAVE;
## 3.设置主从
CHANGE REPLICATION SOURCE TO SOURCE_HOST = '192.168.1.110', SOURCE_PORT = 3306, SOURCE_USER = 'repl', SOURCE_PASSWORD = '123456', SOURCE_AUTO_POSITION = 1,GET_SOURCE_PUBLIC_KEY=1;
START SLAVE;
## 4.查看主从状态
SHOW SLAVE STATUS\G
## 操作回显日志:
mysql> STOP SLAVE;
Query OK, 0 rows affected, 1 warning (0.01 sec)
mysql> RESET SLAVE;
Query OK, 0 rows affected, 1 warning (0.07 sec)
mysql> CHANGE REPLICATION SOURCE TO SOURCE_HOST = '192.168.1.110', SOURCE_PORT = 3306, SOURCE_USER = 'repl', SOURCE_PASSWORD = 'R8e$pl_h!pl!y8k', SOURCE_AUTO_POSITION = 1,GET_SOURCE_PUBLIC_KEY=1;
Query OK, 0 rows affected, 2 warnings (0.00 sec)
mysql> START SLAVE;
Query OK, 0 rows affected, 1 warning (0.01 sec)
mysql> SHOW SLAVE STATUS\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for source to send event
Master_Host: 192.168.1.110
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000105
Read_Master_Log_Pos: 16171803
Relay_Log_File: TEST-relay-bin.000002
Relay_Log_Pos: 530531
Relay_Master_Log_File: mysql-bin.000105
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 16166687
Relay_Log_Space: 535864
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 1
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 110
Master_UUID: 1f25da5b-af1a-11ef-8c51-684aaea03ad1
Master_Info_File: mysql.slave_master_info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Replica has read all relay log; waiting for more updates
Master_Retry_Count: 86400
Master_Bind:
Last_IO_Error_Timestamp:
Last_SQL_Error_Timestamp:
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set: 47d142f6-688c-11ec-b683-fa163ea4bbf3:1217582717-1217583329
Executed_Gtid_Set: 1f25da5b-af1a-11ef-8c51-684aaea03ad1:1-9,
47cca224-688c-11ec-92de-fa163e6ee3b6:1,
47d142f6-688c-11ec-b683-fa163ea4bbf3:16536-1217583329
Auto_Position: 1
Replicate_Rewrite_DB:
Channel_Name:
Master_TLS_Version:
Master_public_key_path:
Get_master_public_key: 1
Network_Namespace:
1 row in set, 1 warning (0.00 sec)
mysql> select * from safe.t_safe_performance_config_xt_test_sync;
+----+-----------+-----------+----------------+---------+-------------+--------------+-----------------+------+---------------------+-------------+------------------+---------------------+-------------+------------------+
| id | dept_code | dept_name | dept_full_name | content | config_type | up_config_id | config_id_level | sort | create_time | create_user | create_user_name | update_time | update_user | update_user_name |
+----+-----------+-----------+----------------+---------+-------------+--------------+-----------------+------+---------------------+-------------+------------------+---------------------+-------------+------------------+
| 1 | 666666 | test | tetsss | dfaf | 1 | 1 | 111 | 2 | 2024-12-02 14:07:00 | 122 | 12313 | 2024-12-02 14:19:00 | 32131 | 1231 |
+----+-----------+-----------+----------------+---------+-------------+--------------+-----------------+------+---------------------+-------------+------------------+---------------------+-------------+------------------+
1 row in set (0.00 sec)
mysql> SHOW SLAVE STATUS\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for source to send event
Master_Host: 192.168.1.110
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000105
Read_Master_Log_Pos: 19209786
Relay_Log_File: TEST-relay-bin.000002
Relay_Log_Pos: 3564217
Relay_Master_Log_File: mysql-bin.000105
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 19200373
Relay_Log_Space: 3573847
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 110
Master_UUID: 1f25da5b-af1a-11ef-8c51-684aaea03ad1
Master_Info_File: mysql.slave_master_info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Replica has read all relay log; waiting for more updates
Master_Retry_Count: 86400
Master_Bind:
Last_IO_Error_Timestamp:
Last_SQL_Error_Timestamp:
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set: 47d142f6-688c-11ec-b683-fa163ea4bbf3:1217582717-1217585843
Executed_Gtid_Set: 1f25da5b-af1a-11ef-8c51-684aaea03ad1:1-9,
47cca224-688c-11ec-92de-fa163e6ee3b6:1,
47d142f6-688c-11ec-b683-fa163ea4bbf3:16536-1217585842
Auto_Position: 1
Replicate_Rewrite_DB:
Channel_Name:
Master_TLS_Version:
Master_public_key_path:
Get_master_public_key: 1
Network_Namespace:
1 row in set, 1 warning (0.00 sec)
4.主从数据校验
## 在主节点上修改下表,在从节点上查询西,看是否和主节点修改后的一致
mysql> SELECT id, dept_code, dept_name, dept_full_name FROM test.t_xt_test_sync;
+----+-----------+-----------+----------------+
| id | dept_code | dept_name | dept_full_name |
+----+-----------+-----------+----------------+
| 1 | 666666 | test | tetsss |
+----+-----------+-----------+----------------+
1 row in set (0.00 sec)
#$# 主库更新后,从节点也跟着变
mysql> SELECT id, dept_code, dept_name, dept_full_name FROM test.t_xt_test_sync;
+----+-----------+-----------+----------------+
| id | dept_code | dept_name | dept_full_name |
+----+-----------+-----------+----------------+
| 1 | 77777 | test | tetsss |
+----+-----------+-----------+----------------+
1 row in set (0.00 sec)
mysql>
4.1 辅助查看主从情况
mysql> SHOW SLAVE STATUS\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for source to send event
Master_Host: 192.168.1.110
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000105
Read_Master_Log_Pos: 19209786
Relay_Log_File: TEST-relay-bin.000002
Relay_Log_Pos: 3564217
Relay_Master_Log_File: mysql-bin.000105
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 19200373
Relay_Log_Space: 3573847
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 110
Master_UUID: 1f25da5b-af1a-11ef-8c51-684aaea03ad1
Master_Info_File: mysql.slave_master_info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Replica has read all relay log; waiting for more updates
Master_Retry_Count: 86400
Master_Bind:
Last_IO_Error_Timestamp:
Last_SQL_Error_Timestamp:
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set: 47d142f6-688c-11ec-b683-fa163ea4bbf3:1217582717-1217585843
Executed_Gtid_Set: 1f25da5b-af1a-11ef-8c51-684aaea03ad1:1-9,
47cca224-688c-11ec-92de-fa163e6ee3b6:1,
47d142f6-688c-11ec-b683-fa163ea4bbf3:16536-1217585842
Auto_Position: 1
Replicate_Rewrite_DB:
Channel_Name:
Master_TLS_Version:
Master_public_key_path:
Get_master_public_key: 1
Network_Namespace:
1 row in set, 1 warning (0.00 sec)
## 观察上面的输出,若显示类似如下,则表示主从同步是正常的
Replica_IO_Running: Yes
Replica_SQL_Running: Yes
Skip_Counter: 0
Replica_SQL_Running_State: Replica has read all relay log; waiting for more updates