建立主从后,登录从库检查状态
show slave status\G
#查看同步状态,
比对Read_Master_Log_Pos和Exec_Master_Log_Pos是否一致,Seconds_Behind_Master是否为0
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Seconds_Behind_Master: 0
Read_Master_Log_Pos: 432
Exec_Master_Log_Pos: 432
登录从库执行进程命令
#查进程
show processlist;
#Replica has read all relay log; waiting for more updates
Mysql8.0才有,mysql5.7没有这个字段
SELECT GTID_SUBSET(master_gtid_executed, slave_gtid_executed);
#返回1代表GTID已经在从库完成执行过,同步完成。
主库执行进程命令
show processlist;