1.检查MySQL有几个从库。
[root@mysql1 ~]# pt-slave-find --host=192.168.1.51 --port=3306 --user=root --password=rootroot
192.168.1.51
Version 5.7.23-log
Server ID 1311
Uptime 3+19:50:58 (started 2023-02-25T18:28:36)
Replication Is not a slave, has 1 slaves connected, is not read_only
Filters
Binary logging ROW
Slave status
Slave mode STRICT
Auto-increment increment 1, offset 1
InnoDB version 5.7.23
+- 192.168.1.58
Version 5.7.23-log
Server ID 13158
Uptime 3+19:51:37 (started 2023-02-25T18:27:57)
Replication Is a slave, has 0 slaves connected, is not read_only
Filters
Binary logging ROW
Slave status 0 seconds behind, running, no errors
Slave mode STRICT
Auto-increment increment 1, offset 1
InnoDB version 5.7.23
2.解释
从上面的内容可以看出,主库1.51有一个从库1.58;
数据库版本:5.7.23-log
SERVER_ID:13158
从库的启动时间:started 2023-02-25T18:27:57
二进制格式:ROW
从库的模式:STRICT
自增的偏移量1;
InnoDB的版本:5.7.23
3.总结
pt-slave-find 是个非常不错的检查从库的工具。同时可以查看主库和从库的版本等信息。
非常实用。