标签:sla lease follow com mysq lock 安装 结果 host
pt-heartbeat监测mysql主从同步延迟:安装percona toolkit(pt-heartbeat为该软件的子命令):
http://repo.percona.com/release/6/RPMS/x86_64/percona-toolkit-3.0.13-1.el6.x86_64.rpm
在主库上创建heartbeat表:
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
更新主mysql的heartbeat表,每1秒钟更新1次(这里的root为mysql的root):
在主mysql上运行监测同步延迟(需先在从mysql上授权):
将延迟结果记录到文件里:
标签:sla lease follow com mysq lock 安装 结果 host
原文地址:https://blog.51cto.com/yangzhiming/2437707