INNOTOP是一個通過文本模式顯示MySQL和 InnoDB的監測工具。它有很多特點,快速的配置的,易於使用等。它吸取了MYTOP的精華這使它變得更加強大。INNOTOP是用PERL語言寫成 的,這是它能更加靈活的使用在各種操作平臺之上,它能詳細的的監控出當前MYSQL和INNODB運行的狀態,以便維護人員根據結果合理的優化 MYSQL,讓MYSQL更穩定更高效的運行。
安裝INNOTOP工具非常的簡單,既然是由PERL寫的,當然需要PERL環境和相關的工具包。
1、下載innotop的源碼包,可以從
http://code.google.com/p/innotop/downloads/list
http://internap.dl.sourceforge.net/sourceforge/innotop 下載 源碼包,下載之後可以解壓
tar-zxvf innotop-1.8.0\ \(1\).tar.gz
cd innotop-1.8.0 進入目錄之後可以查看文件,可以查看 INSTALL 文件查看安裝步驟。
perl Makefile.PL
如果innotop 需要的perl 模塊沒有安裝全就會報錯,然後通過
cpan -i modulename 安裝需要模塊之後,重新執行perl Makefile.PL
如果沒有報錯 然後 使用make install 安裝 innotop。
安裝之後系統就會多出一個命令,innotop
#innotop –help 就會看到
[root@test innotop-1.8.0]# innotop –help
Usage: innotop <options> <innodb-status-file>
–[no]color -C Use terminal coloring (default)
–config -c Config file to read
–count Number of updates before exiting
–delay -d Delay between updates in seconds
–help Show this help message
–host -h Connect to host
–[no]inc -i Measure incremental differences
–mode -m Operating mode to start in
–nonint -n Non-interactive, output tab-separated fields
–password -p Password to use for connection
–port -P Port number to use for connection
–skipcentral -s Skip reading the central configuration file
–socket -S MySQL socket to use for connection
–timestamp -t Print timestamp in -n mode (1: per iter; 2: per line)
–user -u User for login if not current user
–version Output version information and exit
–write -w Write running configuration into home directory if no config files were loaded
加上需要的參數就可以監控mysql 。
如# innotop -uuser -ppassword -S sock路徑
就會看到
[RO] Query List (? for help) localhost, 3+22:33:35.004, 0.74 QPS, 3/1/19 con/run/cac thds, 5.1.50-log
When Load QPS Slow Se/In/Up/De% QCacheHit KCacheHit BpsIn BpsOut
Total 0.00 0.74 0 58/ 0/14/ 0 57.71% 99.75% 45.60 454.74
Cmd ID State User Host DB Time Query
然後輸入? 幫助
Switch to a different mode:
B InnoDB Buffers L Locks R InnoDB Row Ops
C Command Summary M Replication Status S Variables & Status
D InnoDB Deadlocks O Open Tables T InnoDB Txns
F InnoDB FK Err Q Query List U User Statistics
I InnoDB I/O Info
Actions:
a Toggle the innotop process k Kill a query’s connection
c Choose visible columns n Switch to the next connection
d Change refresh interval p Pause innotop
e Explain a thread’s query q Quit innotop
f Show a thread’s full query r Reverse sort order
h Toggle the header on and off s Change the display’s sort column
i Toggle idle processes 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
根據上面的提示查看mysql 的各種狀態。希望你能找到影響性能的瓶頸。