PT-HeartBeat Monitor Mysql Synchronization Delay

pt-heartbeat monitors mysql master-slave synchronization delay:

Install percona toolkit (pt-heartbeat is a subcommand of the software):

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 on 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 heartbeat table of the main mysql, which is updated once every 1 second (the root here is mysql root):

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

Run on the master mysql to monitor the synchronization delay (you need to authorize on the slave mysql first):

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

Record the delayed result in a 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

Leave a Comment

Your email address will not be published.