主库创建监控用户:
mysql> grant select,process,super,replication slave on *.* to 'pt_checksum'@'%' identified by 'mysql';
Query OK, 0 rows affected, 1 warning (0.00 sec)
授权test库,pt-heartbeat会创建监控用表
mysql> grant all privileges on test.* to pt_checksum@'%';
Query OK, 0 rows affected (0.00 sec)
在后台启动心疼守护进程:
[mysql@server-254-163 ~]$ pt-heartbeat h='172.16.254.163',u='pt_checksum',p='mysql',P=3307 -D test --create-table --interval=1 --update --replace --daemonize
[mysql@server-254-163 ~]$
[mysql@server-254-163 ~]$
[mysql@server-254-163 ~]$ ps -ef|grep heartbeat
mysql 40548 1 0 18:24 ? 00:00:00 perl /usr/local/bin/pt-heartbeat h=172.16.254.163,u=pt_checksum,p=mysql,P=3307 -D test --create-table --interval=1 --update --replace --daemonize
mysql 40563 34992 0 18:25 pts/10 00:00:00 grep --color=auto heartbeat
在从库服务器监控延迟:
[mysql@server-254-163 ~]$ pt-heartbeat h='172.16.254.163',u='pt_checksum',p='mysql',P=3307 -D test --table=heartbeat --monitor --master-server-id=1633307
*******************************************************************
Using the default of SSL_verify_mode of SSL_VERIFY_NONE for client
is deprecated! Please set SSL_verify_mode to SSL_VERIFY_PEER
possibly with SSL_ca_file|SSL_ca_path for verification.
If you really don't want to verify the certificate and keep the
connection open to Man-In-The-Middle attacks please set
SSL_verify_mode explicitly to SSL_VERIFY_NONE in your application.
*******************************************************************
at /usr/local/bin/pt-heartbeat line 4556.
*******************************************************************
Using the default of SSL_verify_mode of SSL_VERIFY_NONE for client
is deprecated! Please set SSL_verify_mode to SSL_VERIFY_PEER
possibly with SSL_ca_file|SSL_ca_path for verification.
If you really don't want to verify the certificate and keep the
connection open to Man-In-The-Middle attacks please set
SSL_verify_mode explicitly to SSL_VERIFY_NONE in your application.
*******************************************************************
at /usr/local/bin/pt-heartbeat line 4556.
# A software update is available:
0.00s [ 0.00s, 0.00s, 0.00s ]
0.00s [ 0.00s, 0.00s, 0.00s ]
0.00s [ 0.00s, 0.00s, 0.00s ]
0.00s [ 0.00s, 0.00s, 0.00s ]
0.00s [ 0.00s, 0.00s, 0.00s ]
0.00s [ 0.00s, 0.00s, 0.00s ]
0.00s [ 0.00s, 0.00s, 0.00s ]