讓天下沒有難用的資料庫 » 檢視mysql實時執行sql的工具
該工具為我的同事朱旭開發的一款可以檢視mysql資料庫實時執行的sql狀況的工具,以前苦於通過show processlist/show full processlist抓取sql的同志們現在只要盯一盯螢幕就可以了,非常的方便,點選這裡進行下載,使用方法也很簡單,如下:
[email protected]_admin1a:/root>./orztop –help
==========================================================================================
Info :
Created By [email protected]
Usage :
Command line options :
-help Print Help Info.
-h,–host Hostname/Ip to use for mysql connection.
-u,–user User to use for mysql connection.
-p,–pwd Password to use for mysql connection.
-P,–port Port to use for mysql connection(default 3306).
-S,–socket Socket to use for mysql connection.
-t Time(second) Interval.
我在本地進行執行範例如下:
./orztop -h=127.0.0.1 -P=3009 -u=aurora -p=xxxx -t=1
h代表主機地址(RDS使用者換為例項的連線地址:hzn02.rds.aliyuncs.com)
P代表埠(RDS使用者換位例項連線埠:3306)
u代表執行使用者
p代表密碼
t代表時間重新整理間隔
螢幕打出的資訊中還包括了資料庫的每秒的insert/update/delete/select,邏輯讀,命中率,當前活動執行緒等,可以大致看到資料庫的當前壓力情況,當你的例項出現效能瓶頸時,不妨用該工具看看,抓取一下當前正在跑的慢sql,然後在分析一下sql,很不錯的工具,推薦給大家。