MariaDB社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 6104|回复: 1
打印 上一主题 下一主题

[分析优化工具] mysqlsla工具安装与介绍

[复制链接]
跳转到指定楼层
1#
发表于 2009-9-14 17:06:33 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
原创出处:MySQLpub.com  ,作者:kider  ,转载请注明作者和出处,并不能用于商业用途,违者必究。

介绍:
一款帮助语句分析、过滤、分析和排序MySQL慢日志、查询日志、二进制日志和microslow patched日志的分析工具。整体来说, 功能非常强大. 数据报表,非常有利于分析慢查询的原因, 包括执行频率, 数据量, 查询消耗等。

官方网站及向导:
http://hackmysql.com/
http://hackmysql.com/mysqlsla_guide

安装:
[root@node01 mysqlsla]# tar -xzvf mysqlsla-2.03.tar.gz
mysqlsla-2.03/
mysqlsla-2.03/Changes
mysqlsla-2.03/INSTALL
mysqlsla-2.03/README
mysqlsla-2.03/Makefile.PL
mysqlsla-2.03/bin/
mysqlsla-2.03/bin/mysqlsla
mysqlsla-2.03/META.yml
mysqlsla-2.03/lib/
mysqlsla-2.03/lib/mysqlsla.pm
mysqlsla-2.03/MANIFEST

[root@node01 tools]# cd mysqlsla-2.03/

[root@node01 mysqlsla-2.03]# perl Makefile.PL
Checking if your kit is complete...
Looks good
Writing Makefile for mysqlsla

[root@node01 mysqlsla-2.03]# make
cp lib/mysqlsla.pm blib/lib/mysqlsla.pm
cp bin/mysqlsla blib/script/mysqlsla
/usr/bin/perl "-MExtUtils::MY" -e "MY->fixin(shift)" blib/script/mysqlsla
Manifying blib/man3/mysqlsla.3pm

[root@node01 mysqlsla-2.03]# make install
Installing /usr/lib/perl5/site_perl/5.8.8/mysqlsla.pm
Installing /usr/share/man/man3/mysqlsla.3pm
Installing /usr/bin/mysqlsla
Writing /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/mysqlsla/.packlist
Appending installation info to /usr/lib/perl5/5.8.8/i386-linux-thread-multi/perllocal.pod

注:
需要Perl
及perl-DBI-1.52-.....rpm

安装完毕。

使用:
#mysqlsla LOG
(2.03自动判断日志类型做日志分析)


详细使用方法:
# Basic operation: parse a MySQL slow or general log
mysqlsla --log-type slow LOG
mysqlsla --log-type general LOG

# Parse output from mysqlbinlog
# mysqlsla cannot directly parse binary logs
mysqlbinlog LOG mysqlsla --log-type binary -

# Parse a microslow patched slow log
mysqlsla --log-type msl LOG

# Replay a replay file
mysqlsla --replay FILE

# Parse a user-defined log specify its format
mysqlsla --log-type udl --udl-format FILE

# Let mysqlsla automatically determine the log type
mysqlsla LOG

报表:
[root@node01 testing]# mysqlsla SRVR00-slow.log
Auto-detected logs as slow logs
Report for slow logs: SRVR00-slow.log
1.65k queries total, 10 unique
Sorted by 't_sum'
Grand Totals: Time 36.20k s, Lock 0 s, Rows sent 41.59M, Rows Examined 2.70G


______________________________________________________________________ 001 ___
Count
: 1.62k
(98.25%)
Time
: 34947 s total, 21.519089 s avg, 16 s to 42 s max
(96.54%)

95% of Time : 32271 s total, 20.928016 s avg, 16 s to 29 s max
Lock Time (s) : 0 total, 0 avg, 0 to 0 max
(0.00%)

95% of Lock : 0 total, 0 avg, 0 to 0 max
Rows sent
: 4 avg, 4 to 4 max
(0.02%)
Rows examined : 1.64M avg, 1.07M to 2.13M max
(98.32%)
Database
: teachingfile
Users
:

tfile@SRVR00.localdomin 172.100.5.27 : 100.00% (1624) of query, 98.37% (1626) of all users

Query abstract:
SELECT DISTINCT ...
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 转播转播 分享分享 分享淘帖 顶 踩
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|小黑屋|手机版|MariaDB社区 ( 京ICP备07012489号    |
业务联系: QQ:48474881; 邮箱: 48474881@qq.com; 电话:13911732319
声明:本站部分文章是网友转载,若未经作者同意或署名有误,请联系网站管理员。

GMT+8, 2024-11-10 07:40 , Processed in 0.071228 second(s), 20 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表