pt-heartbeat monitoring mysql master-slave synchronization delay

pt-heartbeat monitoring mysql master-slave synchronization delay:

Installation percona toolkit (pt-heartbeat for the software sub-command):

http://repo.percona.com/release/6/RPMS/x86_64/percona-toolkit-3.0.13-1.el6.x86_64.rpm

yum install perl-DBD-MySQL

yum install perl-IO-Socket-SSL

yum install perl-TermReadKey

Create a heartbeat table in the main library:

mysql -u root -p'xxxxx'

use ming;
create table heartbeat(ts varchar(26) not NULL, server_id int unsigned NOT NULL PRIMARY KEY, file varchar(255) DEFAULT NULL, position bigint unsigned DEFAULT NULL, relay_master_log_file varchar(255) DEFAULT NULL, exec_master_log_pos bigint unsigned DEFAULT NULL);
exit

Update the main mysql heartbeat table, updated once every 1 second (root mysql herein is the root):

pt-heartbeat --user=root --ask-pass --host=localhost --create-table -D ming --interval=1 --update --replace --daemonize

Mysql running on the main monitor synchronization delay (from the authorization must first mysql):

pt-heartbeat -D ming --table=heartbeat --monitor --host=10.0.1.3 --user=ming --password=xxxxx --master-server-id=1

The delay results are recorded to file:

pt-heartbeat -D ming --table=heartbeat --monitor --host=10.0.1.3 --user=ming --password=xxxxx --master-server-id=1 --log=/log/slave.txt --daemonize

Guess you like

Origin blog.51cto.com/yangzhiming/2437707