Percona Toolkit使用之pt-slave-find

版权声明:本文为博主原创文章,转载敬请作出引用声明方便相互交流学习! https://blog.csdn.net/sweeper_freedoman/article/details/80187744

     pt-slave-find的功能是查找和打印MySQL从库的复制层次树。

     用法如下:

pt-slave-find [OPTIONS] [DSN]

     pt-slave-find查找和打印出MySQL从库的层次树。例如:

pt-slave-find --host master-host

     pt-slave-find连接到MySQL复制的master然后查找出其slave。目前它仅所能做的事情就是打印一个复制层次的类树视图。

     master服务器可以使用以下两种方法中的其一指定。第一种方法是使用标准连接相关命令行选项:--defaults-file、--password、--host、--port、--socket和--user。

     第二种方法是指定master服务器为一个DSN(MySQL连接访问)。DSN是一种特殊的语法,可以仅仅是hostname(例如 server.domain.com或者1.2.3.4),或者是key=value,key=value键值对字符串。键是单个字母:

KEY MEANING
=== =======
h   Connect to host
P   Port number to use for connection
S   Socket file to use for connection
u   User for login if not current user
p   Password to use when connecting
F   Only read default options from the given file

     pt-slave-find读取所有的标准MySQL配置文件,例如~/.my.cnf,因此你可能根本不需要指定username、password以及其他常规选项。

     以下为个人本地环境的测试数据,为一主(192.168.112.129)一从(192.168.112.128)的简单拓扑结构。

root@ubuntu:~# pt-slave-find -h192.168.112.129 -P3306 -uroot -p123456
192.168.112.129
Version         5.7.18-log
Server ID       1024
Uptime          05:16 (started 2018-05-03T22:17:10)
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.18
+- 192.168.112.128
   Version         5.7.18
   Server ID       1025
   Uptime          04:59 (started 2018-05-03T22:17:27)
   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.18
root@ubuntu:~# 



     参考

https://www.percona.com/doc/percona-toolkit/LATEST/pt-slave-find.html

猜你喜欢

转载自blog.csdn.net/sweeper_freedoman/article/details/80187744
今日推荐