[![Project Status](http://opensource.box.com/badges/maintenance.svg)](http://opensource.box.com/badges)
Box Anemometer
--------------
This is the Box Anemometer, the MySQL Slow Query Monitor. This tool is used to analyze slow query logs collected from MySQL instances to identify problematic queries.
### Documentation ###
1. [What is Anemometer?](https://github.com/box/Anemometer/wiki)
2. [Extra Features](https://github.com/box/Anemometer/wiki/Extra-Features)
3. [Using PERFORMANCE_SCHEMA](https://github.com/box/Anemometer/wiki/Using-PERFORMANCE_SCHEMA-in-MySQL-5.6)
4. [Collection Script](https://github.com/box/Anemometer/wiki/Anemometer-Collection-Script)
5. [Development with Vagrant](https://github.com/box/Anemometer/wiki/Development-with-Vagrant)
6. Installation: See Quickstart below
7. [Unit Testing](https://github.com/box/Anemometer/wiki/Unit-Testing)
### Quickstart ###
If you're just completely itching to start using this tool, here's what you need:
1. a MySQL database to store query analysis data in.
2. [pt-query-digest](http://www.percona.com/doc/percona-toolkit/pt-query-digest.html).
* You may as well just get the whole [Percona Toolkit](http://www.percona.com/doc/percona-toolkit) while you're at it :)
3. a slow query log from a MySQL server (see [The Slow Query Log](http://dev.mysql.com/doc/refman/5.5/en/slow-query-log.html) for info on getting one)
4. a webserver with PHP
#### Setup DB ####
First up, grab the anemometer code from github. Navigate to the document root of your web server and snag a copy of the Box Anemometer code.
$ git clone git://github.com/box/Anemometer.git anemometer
Or, if you have 9418 port closed:
$ git clone https://github.com/box/Anemometer.git anemometer
Then change your current working directory to the Anemometer directory:
$ cd anemometer
Next, you should connect to the MySQL database you're looking to store the analysis data in and issue the following command:
$ mysql -h db.example.com < install.sql
$ mysql -h db.example.com -e "grant ALL ON slow_query_log.* to 'anemometer'@'%' IDENTIFIED BY 'superSecurePass';"
#### Put some data in the DB ####
Next, grab that slow query log file you have (mine's called "slow.log"!), and run pt-query-digest on it:
**NOTE:** I'm using a BASH 3.0 shell here on my MySQL database server! This is so the "$HOSTNAME" variable properly replaces with "db.example.com")
For pt-query-digest version < 2.2
$ pt-query-digest --user=anemometer --password=superSecurePass \
--review h=db.example.com,D=slow_query_log,t=global_query_review \
--review-history h=db.example.com,D=slow_query_log,t=global_query_review_history \
--no-report --limit=0% \
--filter=" \$event->{Bytes} = length(\$event->{arg}) and \$event->{hostname}=\"$HOSTNAME\"" \
/var/lib/mysql/db.example.com-slow.log
For pt-query-digest version >= 2.2
$ pt-query-digest --user=anemometer --password=superSecurePass \
--review h=db.example.com,D=slow_query_log,t=global_query_review \
--history h=db.example.com,D=slow_query_log,t=global_query_review_history \
--no-report --limit=0% \
--filter=" \$event->{Bytes} = length(\$event->{arg}) and \$event->{hostname}=\"$HOSTNAME\"" \
/var/lib/mysql/db.example.com-slow.log
Pipeline process 11 (aggregate fingerprint) caused an error: Argument "57A" isn't numeric in numeric gt (>) at (eval 40) line 6, <> line 27.
Pipeline process 11 (aggregate fingerprint) caused an error: Argument "57B" isn't numeric in numeric gt (>) at (eval 40) line 6, <> line 28.
Pipeline process 11 (aggregate fingerprint) caused an error: Argument "57C" isn't numeric in numeric gt (>) at (eval 40) line 6, <> line 29.
You may see an error like above, that's okay!
TODO: explain what the options above are doing.
#### View the data! ####
Now, navigate to the document root of your web server and copy the sample config so you can edit it:
$ cd anemometer/conf
$ cp sample.config.inc.php config.inc.php
The sample config explains every setting you may want to change in it. At the very least, make sure you set the Datasource to the MySQL database you're storing the analyzed digest information in:
$conf['datasources']['localhost'] = array(
'host' => 'db.example.com',
'port' => 3306,
'db' => 'slow_query_log',
'user' => 'anemometer',
'password' => 'superSecurePass',
'tables' => array(
'global_query_review' => 'fact',
'global_query_review_history' => 'dimension'
)
);
In addition, the "explain" plugin is enabled by default in the current release and you'll need to setup the username and password it uses to an account that has privileges to explain queries on a given schema on a host. For example, if you're digesting slow logs that primarily contain queries from the "world" database on db.example.com, you'll need to ensure that the user account you put into the following section of the config has the necessary privileges on the "world" database on db.example.com. To do this, scroll down in the sample config to the section containing the plugins configuration and change the 'user' and 'password' parameters to an appropriate account:
$conf['plugins'] = array(
...
'explain' => function ($sample) {
$conn['user'] = 'anemometer';
$conn['password'] = 'superSecurePass';
return $conn;
},
);
Now you should be able to navigate to your webserver in a browser and see Box Anemometer in action!
### Phpdocs ###
Phpdocs for this tool can be found in the "docs" sub-directory of the project.
### Dependencies ###
This application requires an Apache webserver with PHP 5.3+ and a MySQL database that contains the data aggregated from MySQL slow query logs.
## Copyright and License
Copyright 2014 Box, Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
没有合适的资源?快使用搜索试试~ 我知道了~
mysql慢查询工具Anemometer
共157个文件
html:53个
js:35个
php:28个
3星 · 超过75%的资源 需积分: 13 23 下载量 71 浏览量
2015-12-17
10:45:42
上传
评论
收藏 529KB ZIP 举报
温馨提示
Anemometer从MySQL的慢查询日志收集信息,并生成报告。
资源推荐
资源详情
资源评论
收起资源包目录
mysql慢查询工具Anemometer (157个子文件)
bootstrap.css 80KB
jquery-ui.css 30KB
bootstrap-responsive.css 10KB
stylesheet.css 5KB
bootstrap-combobox.css 2KB
prettify.css 2KB
banner.css 393B
ajax-loader.gif 3KB
.gitignore 44B
MySQLTableReport.html 70KB
MySQLTableReport.html 61KB
elementindex_default.html 43KB
elementindex.html 43KB
AnemometerModel.html 30KB
AnemometerModel.html 30KB
elementindex_MySQLTableReport.html 21KB
elementindex_AnemometerModel.html 13KB
Anemometer.html 11KB
Anemometer.html 10KB
QueryExplain.html 10KB
QueryExplain.html 9KB
elementindex_Anemometer.html 8KB
QueryTableParser.html 8KB
QueryTableParser.html 8KB
elementindex_QueryExplain.html 6KB
_Helpers.php.html 5KB
elementindex_QueryTableParser.html 5KB
Loader.html 4KB
Loader.html 4KB
_QueryExplain.php.html 4KB
errors.html 4KB
_Anemometer.php.html 3KB
_Anemometer.php.html 3KB
li_default.html 3KB
_QueryExplain.php.html 3KB
elementindex_Loader.html 3KB
_AnemometerModel.php.html 3KB
_AnemometerModel.php.html 3KB
_MySQLTableReport.php.html 2KB
_MySQLTableReport.php.html 2KB
_Loader.php.html 2KB
_Loader.php.html 2KB
_QueryTableParser.php.html 2KB
_QueryTableParser.php.html 2KB
li_QueryTableParser.html 1KB
li_MySQLTableReport.html 1KB
classtrees_default.html 1KB
li_AnemometerModel.html 1KB
li_QueryExplain.html 1KB
li_Anemometer.html 1KB
li_Loader.html 1KB
index.html 952B
packages.html 920B
classtrees_MySQLTableReport.html 810B
classtrees_QueryTableParser.html 810B
classtrees_AnemometerModel.html 806B
classtrees_QueryExplain.html 794B
classtrees_Anemometer.html 786B
classtrees_Loader.html 770B
blank.html 416B
index.html 0B
index.html 0B
favicon.ico 2KB
jquery-ui-1.9.2.custom.min.js 232KB
jquery.flot.js 104KB
jquery.flot.js 104KB
jquery-1.8.3.min.js 91KB
prettify.js 58KB
jquery-ui-timepicker-addon.js 50KB
jquery.flot.min.js 37KB
jquery.flot.pie.js 22KB
jquery.flot.navigate.js 13KB
jquery.flot.selection.js 12KB
jquery.flot.pie.min.js 9KB
jquery.flot.image.js 7KB
jquery.flot.stack.js 7KB
jquery.flot.fillbetween.js 7KB
bootstrap-typeahead.js 7KB
jquery.colorhelpers.js 6KB
jquery.flot.navigate.min.js 5KB
jquery.flot.crosshair.js 5KB
bootstrap-combobox.js 5KB
bootstrap-collapse.js 4KB
jquery.flot.selection.min.js 3KB
lang-sql.js 3KB
bootstrap-tab.js 3KB
jquery.flot.threshold.js 3KB
jquery.colorhelpers.min.js 3KB
bootstrap-dropdown.js 2KB
jquery.flot.resize.js 2KB
jquery.flot.symbol.js 2KB
jquery.flot.image.min.js 2KB
jquery.flot.crosshair.min.js 1KB
jquery.flot.fillbetween.min.js 1KB
jquery.flot.stack.min.js 1KB
jquery.flot.resize.min.js 1KB
jquery.flot.threshold.min.js 910B
jquery.flot.symbol.min.js 755B
composer.json 67B
LICENSE 9KB
共 157 条
- 1
- 2
资源评论
- itishsy2019-04-12资源可用,谢谢分享
上海阿丽
- 粉丝: 61
- 资源: 22
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 老飞飞搭建基础通用数据库V19数据库.rar
- jquery.js
- 机械设计多工位ACF贴胶带&预压设备sw18可编辑非常好的设计图纸100%好用.zip
- 基于Pytorch复现Point-Transformer,用于ShapeNet数据集点云分割
- 【医学影像分析】2D超声图像的分割检测(Ultrasound Nerve Segmentation - Kaggle数据集)
- 嘎嘎香的五款神仙谷歌插件
- .arch书源导入教程.mp4
- 贪心算法介绍及代码示例讲解
- CR13SP35MSI64 Crystal 水晶报表运行组件最后版本64位
- 图像分类数据集:玉米叶是否感染分类数据集(2分类,包含训练集、验证集)
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功