首先通過show @@helap; 就可以大致的了解Mycat? 管理端口的常用命令(dbserver.xml配置)!
mysql> show @@help;
+------------------------------------------+--------------------------------------------+
| STATEMENT ?| DESCRIPTION |
+------------------------------------------+--------------------------------------------+
| show @@time.current | Report current timestamp |
| show @@time.startup | Report startup timestamp |
| show @@version | Report Mycat Server version ?|
| show @@server ?| Report server status |
| show @@threadpool ?| Report threadPool status |
| show @@database | Report databases |
| show @@datanode | Report dataNodes |
| show @@datanode where schema = ? | ReportdataNodes |
| show @@datasource ?| Report dataSources ? |
| show @@datasource where dataNode = ? | Report dataSources ? |
| show @@datasource.synstatus ?|Report datasource data synchronous |
| show @@datasource.syndetail where name=? | Report datasource data synchronousdetail ?|
| show @@datasource.cluster ?| Report datasource galary cluster variables |
| show @@processor ? | Report processor status ?|
| show @@command | Report commands status ? |
| show @@connection ?| Report connection status |
| show @@cache ? | Report system cache usage |
| show @@backend | Report backend connection status |
| show @@session | Report front session details |
| show @@connection.sql ?| Report connection sql |
| show @@sql.execute | Report execute status |
| show @@sql.detail where id = | Reportexecute detail status ? |
| show @@sql | Report SQL list |
| show @@sql.high | Report Hight Frequency SQL ? |
| show @@sql.slow | Report slow SQL ?|
| show @@sql.resultset ? | Report BIG RESULTSET SQL |
| show @@sql.sum | Report ?User RW Stat |
| show @@sql.sum.user | Report ?User RW Stat |
| show @@sql.sum.table ? | Report ?Table RW Stat |
| show @@parser ?| Report parser status |
| show @@router ?| Report router status |
| show @@heartbeat ? | Report heartbeat status ?|
| show @@heartbeat.detail where name= ? | Report heartbeat currentdetail |
| show @@slow where schema = ? |Report schema slow sql ? |
| show @@slow where datanode = | Reportdatanode slow sql |
| show @@sysparam | Report system param ?|
| show @@syslog limit= | Report system mycat.log ?|
| show @@white ? | show mycat white host |
| show @@white.set=?, | set mycat white host,[ip,user] ? |
| show @@directmemory=1 or 2 ? |show mycat direct memory usage |
| switch @@datasource name:index ? | SwitchdataSource |
| kill @@connection id1,id2,... | Killthe specified connections |
| stop @@heartbeat name:time ? |Pause dataNode heartbeat |
| reload @@config | Reload basic config from file |
| reload @@config_all | Reload all config from file ?|
| reload @@route | Reload route config from file |
| reload @@user ?| Reload user config from file |
| reload @@sqlslow= ?| Set Slow SQL Time(ms) |
| reload @@user_stat | Reset show @@sql ?@@sql.sum @@sql.slow ? |
| rollback @@config ?| Rollback all config from memory ?|
| rollback @@route ? | Rollback route config from memory |
| rollback @@user | Rollback user config from memory |
| reload @@sqlstat=open ?| Open real-time sql stat analyzer |
| reload @@sqlstat=close | Close real-time sql stat analyzer |
| offline | Change MyCat status to OFF |
| online | Change MyCat status to ON ?|
| clear @@slow where schema = ?|Clear slow sql by schema |
| clear @@slow where datanode = | Clearslow sql by datanode |
+------------------------------------------+--------------------------------------------+
58 rows in set (0.00 sec)
1、連接mycat 9066管理端口
命令:mysql -uusername -ppasswd -P9066 -hIP
-u:用戶名
-p:密碼
-P:端口
-h:ip地址例:linux路徑切換到mycat安裝路徑的bin目錄中:輸入命令
顯示如此則登錄成功。
2、顯示後端物理庫連接信息,包括當前連接數,端口等信息。
命令:Show?@@backend
3、顯示當前前端客戶端連接情況
命令:Show?@@connection
4、當前線程池的執行情況,是否有積壓(active_count)以及task_queue_size,後者為積壓的待處理的SQL,若積壓數目壹直保值,
? 則說明後端物理連接可能不夠或者SQL執行比較緩慢
命令:show @@threadpool;
5、當前後端物理庫的心跳檢測情況,RS_CODE為1表示心跳正常
命令:show @@heartbeat;
6、顯示數據節點的訪問情況,包括每個數據節點當前活動連接數(active),空閑連接數(idle)以及最大連接數(maxCon)?size,EXECUTE參數表示從該節點獲取連接的次數,
? 次數越多,說明訪問該節點越多
命令:show @@datanode;
6、顯示當前processors的處理情況,包括每個processor的IO吞吐量(NET_IN/NET_OUT)、IO隊列的積壓情況(R_QUEY/W_QUEUE),Socket?Buffer?Pool的使用情況
?BU_PERCENT為已使用的百分比、BU_WARNS為Socket?Buffer?Pool不夠時,臨時創建的新的BUFFER的次數,若百分比經常超過90%並且BU_WARNS>0,則表明BUFFER
? 不夠,需要增大,參見性能調優手冊。
命令:show @@processor;
7、顯示緩存的使用情況,對於性能監控和調優很有價值
命令:show @@cache;
MAX為緩存的最大值(記錄個數),CUR為當前已經在緩存中的數量,ACESS為緩存讀次數,HIT為緩存命中次數,PUT?為寫緩存次數,LAST_XX為最後操作時間戳,比較重要的幾個參數:CUR:若CUR接近MAX,而PUT大於MAX很多,則表明MAX需要增大,HIT/ACCESS為緩存命中率,這個值越高越好。
8、殺掉客戶端的連接,參數為連接的ID值,通過show?@@connection,可以展示當前連接到MyCAT的所有客戶端進程,若某個進程異常,則可以通過該命令殺掉連接,如?KILL?@@CONNECTION26907;
9、重新加載配置文件schema.xml
如果我們在原有的schema.xml中進行了修改,需要重新加載該文件使其生效。
命令:reload @@config;