来源:http://www./?p=2653 percona toolkit 几个实用工具记录: pt-heartbeat 通过监控实际的复制信息来监控MySQL复制延迟.监控过程由两部分组成,--update命令及--check或--monitor命令. 基本用法: pt-heartbeat [OPTION...] [DSN] --update|--monitor|--check|--stop Master:开启pt-heartbeat守护进程,将监测信息更新到数据库表pts.heartbeat [root@centos190 www]# pt-heartbeat -D pts --table=heartbeat --create-table --update -h 192.168.1.190 -uroot --ask-pass --daemonize Enter password: [root@centos190 www]# ps -ef | grep pt-heartbeat | grep -v "grep" root 9118 1 0 09:03 ? 00:00:00 perl /usr/local/bin/pt-heartbeat -D pts --table=heartbeat --create-table --update -h 192.168.1.190 -uroot --ask-pass --daemonize 监测slave复制延迟 [root@centos190 www]# pt-heartbeat -D pts --table=heartbeat --monitor -h 192.168.1.192 792.00s [ 13.20s, 2.64s, 0.88s ] 793.00s [ 26.42s, 5.28s, 1.76s ] 794.00s [ 39.65s, 7.93s, 2.64s ] 795.00s [ 52.90s, 10.58s, 3.53s ] 或是使用--check监测一次就退出: [root@centos190 www]# pt-heartbeat -D pts --table=heartbeat --check -h 192.168.1.192 921.00 使pt-heartbeat守护进程停止 [root@centos190 www]# pt-heartbeat --stop Successfully created file /tmp/pt-heartbeat-sentinel [root@centos190 www]# rm -f /tmp/pt-heartbeat-sentinel ps -ef | grep pt-heartbeat | grep -v "grep pt-variable-advisor 检查变量设置是否合理: 1.pt-variable-advisor --user=root --password=×××× 192.168.0.13 2.pt-mysql-summary 总结下mysql的状态信息 3.pt-mysql-summary --user=root --password=×××× 192.168.0.13 4.pt-query-digest --user=root --password=dbelroy! --review h=192.168.0.13 slow.log | more # 1.3s user time, 30ms system time, 24.01M rss, 200.74M vsz # Current date: Tue Mar 4 10:16:44 2014 # Hostname: db2.zhijin # Files: slow.log # Overall: 4.20k total, 45 unique, 0.00 QPS, 0.00x concurrency ___________ # Time range: 2013-12-25 23:00:06 to 2014-03-04 06:43:18 # Attribute total min max avg 95% stddev median # ============ ======= ======= ======= ======= ======= ======= ======= # Exec time 16227s 1s 987s 4s 7s 21s 2s # Lock time 343ms 0 5ms 81us 144us 78us 84us # Rows sent 367.45M 0 2.00M 89.63k 97.04k 148.32k 68.96k # Rows examine 389.75M 0 6.66M 95.07k 101.89k 192.78k 68.96k # Query size 191.27k 14 5.31k 46.66 54.21 261.60 28.75 # Profile # Rank Query ID Response time Calls R/Call V/M Item # ==== ================== =============== ===== ======== ===== =========== # 1 0x67A347A2812914DF 4691.2704 28.9% 486 9.6528 64.95 SELECT pt_test # 2 0x0350693B7D7BD1BD 4619.4348 28.5% 1794 2.5749 0.58 SELECT t_paradisedata # 3 0x72222DEC3FAB270C 3733.6401 23.0% 1740 2.1458 0.67 SELECT t_globaluserdata # 4 0x50116ACA954DBE17 987.4332 6.1% 1 987.4332 0.00 CALL pt_test_1 # 5 0x82B748D384D49EAC 705.5784 4.3% 1 705.5784 0.00 SELECT t_paradisedata # 6 0x9F7EAE9F3642898D 260.7795 1.6% 3 86.9265 3.81 SELECT t_globaluserdata zhagnwei # 7 0xFE197778028763B7 195.8401 1.2% 13 15.0646 2.81 SELECT t_char # 8 0xB42F4A108B8FBCDA 184.0034 1.1% 2 92.0017 0.00 SELECT t_globaluserdata # 9 0xB670C209FCA172F3 158.0179 1.0% 2 79.0090 39.99 SELECT t_globaluserdata t_char # 11 0x718378B5EA88EB45 99.8915 0.6% 70 1.4270 0.41 SELECT nova_card # MISC 0xMISC 590.6406 3.6% 86 6.8679 0.0 <35 ITEMS> |
|