zoukankan      html  css  js  c++  java
  • mysql监控管理工具--innotop

    https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/innotop/innotop-1.9.1-1.el6.noarch.rpm

    mysql监控管理工具--innotop

    INNOTOP是一个通过文本模式显示MySQL和InnoDB的监测工具。INNOTOP是用PERL语言写成的,这使它能更加灵活的使用在各种操作平台之上,它能详细的的监控出当前MYSQL和INNODB运行的状态,以DBA根据结果,可以合理的优化MYSQL,让MYSQL更稳定更高效的运行。


    1.innotop安装
    参考官网:http://innotop.googlecode.com/svn/html/installing.html

    # wget http://innotop.googlecode.com/files/innotop-1.9.0.tar.gz
    # tar -zxvf innotop-1.9.0.tar.gz 
    # cd innotop-1.9.0

    安装INNOTOP工具非常简单,其是由PERL写的,当然需要PERL环境和相关的工具包。在安装之前先要确定你的系统安装了Time::HiRes,Term::ReadKey,DBI,DBD::mysql这四个包

    # perl -MCPAN -eshell
    CPAN> install Time::HiRes
    CPAN> install Term::ReadKey
    CPAN> install DBI
    CPAN> install DBD::mysql

    在解压缩后的源码路径下有安装帮助文件,如下:

    # perl Makefile.PL

    如果没有报错,然后,使用
    # make install

    这样就安装 innotop,安装之后系统就会多出一个命令,innotop

    得到帮助
    # innptop --help


    2.使用方法
    参考官网:http://innotop.googlecode.com/svn/html/manual.html

    使用方法:
    # innotop -uroot -proot -h127.0.0.1

    [root@racdb2 innotop-1.9.0]# innotop -uroot -proot -h127.0.0.1
    [RO] Dashboard (? for help)                            127.0.0.1, 3h, 0.06 QPS, 2/1/0 con/run/cac thds, 5.1.67-log
    Uptime  MaxSQL  ReplLag  Cxns  Lock  QPS   QPS  Run  Run  Tbls  Repl  SQL
        3h                      2     0  0.06                   13  Off    

    输入“?”得到帮助

    Switch to a different mode:
       A  Dashboard         I  InnoDB I/O Info     Q  Query List
       B  InnoDB Buffers    K  InnoDB Lock Waits   R  InnoDB Row Ops
       C  Command Summary   L  Locks               S  Variables & Status
       D  InnoDB Deadlocks  M  Replication Status  T  InnoDB Txns
       F  InnoDB FK Err     O  Open Tables         U  User Statistics

    Actions:
       d  Change refresh interval        p  Pause innotop
       k  Kill a query's connection      q  Quit innotop
       n  Switch to the next connection  x  Kill a query

    Other:
     TAB  Switch to the next server group   /  Quickly filter what you see
       !  Show license and warranty         =  Toggle aggregation
       #  Select/create server groups       @  Select/create server connections
       $  Edit configuration settings         Clear quick-filters
    Press any key to continue


    可以用innotop监控mysql,例如可以看当前正在运行的sql,并查看执行计划,如下:

    进入innotop时,按shift+q进入sql查询列表,

    When   Load  Cxns  QPS   Slow  Se/In/Up/De%  QCacheHit  KCacheHit  BpsIn  BpsOut 
    Now    0.10     2  0.46     0   0/ 0/ 0/ 0       0.00%    100.00%  19.79    1.11k
    Total  0.00   151  0.08     5   2/ 0/ 0/ 0       4.17%    100.00%   3.29  223.67

    Cmd    ID      State         User   Host           DB      Time   Query                              
    Query       1  Sending data  root   localhost      test    03:20  insert into user select * from user
    Query      21  Locked        root   localhost      test    00:04  insert into user select * from user
    Select a thread to analyze: 21

    然后按e并输入thread ID显示执行计划或者按f显示完整sql语句,或者按o显示系统优化过的语句(需要MySQL的版本支持EXPLAIN EXTENDED)


    EXPLAIN PARTITIONS
    select * from user
    ____ Sub-Part 1 _____
    Select Type: SIMPLE  
          Table: user    
     Partitions:         
           Type: ALL     
     Poss. Keys:         
          Index:         
     Key Length:         
      Index Ref:         
      Row Count: 41943040
        Special:        

    [This query has been re-written to be explainable]

    Press e to explain, f for full query, o for optimized query


     innotop是通过information_schema.processlist来获得完整的sql语句,并且根据COMMAND来过滤掉空闲线程的

  • 相关阅读:
    Spring的PropertyPlaceholderConfigurer
    关于解决java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoader问题
    CentOS7.x安装flash
    C#——list列表复制
    C#——dataGridView控件获取当前鼠标所在的行
    C#——button按钮风格(按下改变)
    C#——chart控件坐标轴刻度细分(副刻度)
    C#——USBHID上位机开发(win10、win7)
    C#——自定义控件工具箱图标
    C#——给线程传递参数的三种方式
  • 原文地址:https://www.cnblogs.com/zengkefu/p/5638625.html
Copyright © 2011-2022 走看看