内射老阿姨1区2区3区4区_久久精品人人做人人爽电影蜜月_久久国产精品亚洲77777_99精品又大又爽又粗少妇毛片

Mysql中Anemometer怎么用-創(chuàng)新互聯(lián)

這篇文章給大家分享的是有關(guān)Mysql中Anemometer怎么用的內(nèi)容。小編覺得挺實(shí)用的,因此分享給大家做個(gè)參考,一起跟隨小編過(guò)來(lái)看看吧。

創(chuàng)新互聯(lián)是一家集網(wǎng)站建設(shè),新興企業(yè)網(wǎng)站建設(shè),新興品牌網(wǎng)站建設(shè),網(wǎng)站定制,新興網(wǎng)站建設(shè)報(bào)價(jià),網(wǎng)絡(luò)營(yíng)銷,網(wǎng)絡(luò)優(yōu)化,新興網(wǎng)站推廣為一體的創(chuàng)新建站企業(yè),幫助傳統(tǒng)企業(yè)提升企業(yè)形象加強(qiáng)企業(yè)競(jìng)爭(zhēng)力??沙浞譂M足這一群體相比中小企業(yè)更為豐富、高端、多元的互聯(lián)網(wǎng)需求。同時(shí)我們時(shí)刻保持專業(yè)、時(shí)尚、前沿,時(shí)刻以成就客戶成長(zhǎng)自我,堅(jiān)持不斷學(xué)習(xí)、思考、沉淀、凈化自己,讓我們?yōu)楦嗟钠髽I(yè)打造出實(shí)用型網(wǎng)站。

準(zhǔn)備條件:
1.MySQL開啟慢查詢


2.安裝Percona Toolkit
rpm -qa|grep percona
percona-toolkit-2.2.7-1


3.下載Anemometer
官網(wǎng):https://github.com/box/Anemometer


4.準(zhǔn)備好php相關(guān)模塊(或者yum)


5.啟動(dòng)apache服務(wù)
rpm -qa|grep http
httpd-2.2.3-45.el5


安裝:
1.安裝Percona Toolkit:
rpm -ivh percona-toolkit-2.2.7-1.noarch.rpm


2.將Anemometer文件包解壓,重命名為anemometer,并移動(dòng)到/var/www/html 下(apache默認(rèn)路徑)
pwd
/var/www/html/anemometer


3.安裝php相關(guān)模塊:
  rpm -qa|grep php
php53-common-5.3.3-1.el5
php53-bcmath-5.3.3-1.el5
php53-mysql-5.3.3-1.el5
php53-dba-5.3.3-1.el5
php53-cli-5.3.3-1.el5
php53-gd-5.3.3-1.el5
php53-5.3.3-1.el5
php53-pdo-5.3.3-1.el5
NOTE:
PHP版本要大于5.3,否則就報(bào)錯(cuò),如:
Anemometer requires PHP 5.3 or newer. You have 5.1.6
除此之外還需要:bcmath
rpm -qa|grep bcmath
php53-bcmath-5.3.3-1.el5


4.執(zhí)行setup 腳本,創(chuàng)建用戶:
[root@/var/www/html/anemometer]mysql -uroot -pxxx < install.sql
[root@/var/www/html/anemometer]mysql -uroot -pxxx
mysql > grant all on slow_query_log.* to 'anemometer'@'%' identified by 'test';
mysql > grant select on *.* to  'anemometer'@'%';
mysql > grant all on slow_query_log.* to 'anemometer'@'localhost';
mysql > grant select on *.* to  'anemometer'@'localhost';




5.將慢查詢?nèi)罩就ㄟ^(guò)pt-query-digest分析后存入數(shù)據(jù)庫(kù)中:
pt 版本小于2.2版本的語(yǔ)句:
pt-query-digest --user=anemometer --password=test \
                  --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\"" \ 
                  /root/test/localhost-slow.log


pt 版本大于2.2版本的語(yǔ)句:
pt-query-digest --user=anemometer --password=test --review h=hd-119-186,D=slow_query_log,t=global_query_review --history h=hd-119-186,D=slow_query_log,t=global_query_review_history --no-report --limit=0% --filter=" \$event->{Bytes} = length(\$event->{arg}) and \$event->{hostname}=\"$HOSTNAME\"" /root/test/localhost-slow.log


執(zhí)行這個(gè)操作后,將會(huì)把慢日志分析后存入mysql的slow_query_log數(shù)據(jù)庫(kù)。


NOTE:
記得保證相應(yīng) '用戶'@'主機(jī)' 的訪問(wèn)權(quán)限




6.修改可視界面的配置信息:
cd /var/www/html/anemometer/conf
cp sample.config.inc.php config.inc.php
vi config.inc.php
 Mysql中Anemometer怎么用
以及:
 Mysql中Anemometer怎么用

NOTE:
主機(jī)名一定要修改正確,不能保留為localhost,否則會(huì)導(dǎo)致最終界面無(wú)法訪問(wèn)。






7.最終本地通過(guò)IP訪問(wèn):
http://192.168.44.130/anemometer
 Mysql中Anemometer怎么用


查詢后可獲得慢查詢?nèi)罩镜慕Y(jié)果:
 
Mysql中Anemometer怎么用

補(bǔ)充:如何監(jiān)控多個(gè)數(shù)據(jù)庫(kù)

  1. [root@RZ-SI1-DB-14 conf]# ll

  2. total 40

  3. -rwxr-xr-x 1 root root 15504 Oct 12 14:51 config.inc.php                   ###新版都不需要修改里面的配置了,只需要修改下面的datasource

  4. -rwxrwxrwx 1 root root   314 Oct 12 14:54 datasource_si1.inc.php

  5. -rwxr-xr-x 1 root root   314 Oct 12 15:05 datasource_st1.inc.php         ---配置多個(gè)datasource,si1 st1 機(jī)器上分別導(dǎo)入install.sql  并pt-query-digest 慢日志進(jìn)去

  6. -rwxrwxrwx 1 root root     0 Oct 13  2016 index.html

  7. -rwxrwxrwx 1 root root 15487 Oct 13  2016 sample.config.inc.php


[root@RZ-SI1-DB-14 conf]# more datasource_si1.inc.php 
<?php
$conf['datasources']['si1'] = array(
        'host'  => '10.38.96.132',
        'port'  => 3306,
        'db'    => 'slow_query_log',
        'user'  => 'xxxxxx',
        'password' => 'xxxxxx',
        'tables' => array(
                'global_query_review' => 'fact',
                'global_query_review_history' => 'dimension'
        ),
        'source_type' => 'slow_query_log'
);


[root@RZ-SI1-DB-14 conf]# more datasource_st1.inc.php 
<?php
$conf['datasources']['st1'] = array(
        'host'  => '10.38.96.128',
        'port'  => 3306,
        'db'    => 'slow_query_log',
        'user'  => 'xxxxxxx',
        'password' => 'xxxxxxxx',
        'tables' => array(
                'global_query_review' => 'fact',
                'global_query_review_history' => 'dimension'
        ),
        'source_type' => 'slow_query_log'
);

Mysql中Anemometer怎么用

感謝各位的閱讀!關(guān)于“Mysql中Anemometer怎么用”這篇文章就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,讓大家可以學(xué)到更多知識(shí),如果覺得文章不錯(cuò),可以把它分享出去讓更多的人看到吧!

新聞標(biāo)題:Mysql中Anemometer怎么用-創(chuàng)新互聯(lián)
瀏覽路徑:http://www.rwnh.cn/article40/cejoeo.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站策劃、軟件開發(fā)、自適應(yīng)網(wǎng)站、微信公眾號(hào)電子商務(wù)、服務(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í)需注明來(lái)源: 創(chuàng)新互聯(lián)

手機(jī)網(wǎng)站建設(shè)
吉林市| 英山县| 临泽县| 大渡口区| 黔东| 汕尾市| 云和县| 米泉市| 新丰县| 东山县| 日喀则市| 稻城县| 疏附县| 台安县| 灌云县| 余江县| 中江县| 丹阳市| 望谟县| 玉山县| 黄陵县| 乌鲁木齐市| 友谊县| 青田县| 桃园市| 封开县| 炎陵县| 新民市| 会同县| 习水县| 通城县| 淮安市| 东丽区| 额尔古纳市| 达拉特旗| 阳原县| 井陉县| 海兴县| 百色市| 宜兰市| 阿拉尔市|