mycat常用后端管理命令
首先通过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;
网友评论