久久久精品一区ed2k-女人被男人叉到高潮的视频-中文字幕乱码一区久久麻豆樱花-俄罗斯熟妇真实视频

如何使用Anemometer分析MySQL慢查詢記錄

這篇文章將為大家詳細(xì)講解有關(guān)如何使用Anemometer分析MySQL慢查詢記錄,小編覺得挺實(shí)用的,因此分享給大家做個(gè)參考,希望大家閱讀完這篇文章后可以有所收獲。

讓客戶滿意是我們工作的目標(biāo),不斷超越客戶的期望值來自于我們對(duì)這個(gè)行業(yè)的熱愛。我們立志把好的技術(shù)通過有效、簡(jiǎn)單的方式提供給客戶,將通過不懈努力成為客戶在信息化領(lǐng)域值得信任、有價(jià)值的長(zhǎng)期合作伙伴,公司提供的服務(wù)項(xiàng)目有:域名注冊(cè)、雅安服務(wù)器托管、營(yíng)銷軟件、網(wǎng)站建設(shè)、雁峰網(wǎng)站維護(hù)、網(wǎng)站推廣。

數(shù)據(jù)庫管理員一般是用percona的toolkit工具來分析MySQL慢查詢記錄,但是不夠直觀。

下面介紹一款比較直觀的工具來統(tǒng)計(jì)分析MySQL慢查詢記錄anemometer。

在使用之前需要安裝percona的toolkit工具,anemometer提供web界面。

1. toolkit安裝

# cd /data/www/my.xuebuyuan.com

# git clone https://github.com/box/Anemometer.git anemometer

# cd anemometer

2. 創(chuàng)建表和用戶名

mysql < install.sql   mysql -e "grant ALL ON slow_query_log.* to 'anemometer'@'localhost' IDENTIFIED BY 'my.xuebuyuan.com';"   mysql -e "grant SELECT ON *.* to 'anemometer'@'localhost' IDENTIFIED BY 'my.xuebuyuan.com';"   3. 分析MySQL慢日志

# pt-query-digest --user=anemometer --password=superSecurePass \

--review D=slow_query_log,t=global_query_review \

--review-history D=slow_query_log,t=global_query_review_history \

--no-report --limit=0% --filter=" \$event->{Bytes} = length(\$event->{arg}) and \$event->{hostname}=\"$HOSTNAME\"" /data/log/mysql/slow.log

4. 配置anemometer

# cp conf/sample.config.inc.php conf/config.inc.php

# vi conf/config.inc.php

$conf['datasources']['localhost'] = array(

'host' => 'localhost',

'port' => 3306,

'db' => 'slow_query_log',

'user' => 'anemometer',

'password' => 'my.ttlsa.com',

'tables' => array(

'global_query_review' => 'fact',

'global_query_review_history' => 'dimension'

),

'source_type' => 'slow_query_log'

);

$conf['plugins'] = array(

'visual_explain' => '/usr/bin/pt-visual-explain',

'query_advisor' => '/usr/bin/pt-query-advisor',

#... other lines

$conn['user'] = 'anemometer';

$conn['password'] = 'my.ttlsa.com';

return $conn;

},

5. 自動(dòng)化處理

# vi /etc/logrotate.d/mysql

postrotate

pt-query-digest --user=anemometer --password=superSecurePass \

--review D=slow_query_log,t=global_query_review \

--review-history D=slow_query_log,t=global_query_review_history \

--no-report --limit=0% --filter=" \$event->{Bytes} = length(\$event->{arg}) and \$event->{hostname}=\"$HOSTNAME\"" /data/log/mysql/slow.log.1

endscript

這樣就可以通過my.ttlsa.com/anemometer來訪問查看慢查詢了。

關(guān)于“如何使用Anemometer分析MySQL慢查詢記錄”這篇文章就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,使各位可以學(xué)到更多知識(shí),如果覺得文章不錯(cuò),請(qǐng)把它分享出去讓更多的人看到。

分享題目:如何使用Anemometer分析MySQL慢查詢記錄
網(wǎng)頁地址:http://sd-ha.com/article18/ghdhdp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站建設(shè)響應(yīng)式網(wǎng)站、網(wǎng)站內(nèi)鏈、搜索引擎優(yōu)化、外貿(mào)網(wǎng)站建設(shè)、云服務(wù)器

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

成都定制網(wǎng)站建設(shè)