强制断开连接
代码语言:javascript复制mysql> show @@connection;
------------ ------ ----------------- ------ ------------ ------ -------- --------- -------- --------- --------------- ------------- ------------ --------- ------------
| PROCESSOR | ID | HOST | PORT | LOCAL_PORT | USER | SCHEMA | CHARSET | NET_IN | NET_OUT | ALIVE_TIME(S) | RECV_BUFFER | SEND_QUEUE | txlevel | autocommit |
------------ ------ ----------------- ------ ------------ ------ -------- --------- -------- --------- --------------- ------------- ------------ --------- ------------
| Processor1 | 1 | 192.168.100.102 | 9066 | 43190 | cc | NULL | utf8:45 | 1998 | 143920 | 4021 | 40960 | 0 | | |
| Processor1 | 3 | 192.168.100.102 | 8066 | 33145 | cc | cctest | utf8:45 | 603 | 3621 | 1863 | 40960 | 0 | 3 | true |
------------ ------ ----------------- ------ ------------ ------ -------- --------- -------- --------- --------------- ------------- ------------ --------- ------------
2 rows in set (0.00 sec)
mysql> kill @@connection 3;
Query OK, 1 row affected (0.00 sec)
mysql> show @@connection;
------------ ------ ----------------- ------ ------------ ------ -------- --------- -------- --------- --------------- ------------- ------------ --------- ------------
| PROCESSOR | ID | HOST | PORT | LOCAL_PORT | USER | SCHEMA | CHARSET | NET_IN | NET_OUT | ALIVE_TIME(S) | RECV_BUFFER | SEND_QUEUE | txlevel | autocommit |
------------ ------ ----------------- ------ ------------ ------ -------- --------- -------- --------- --------------- ------------- ------------ --------- ------------
| Processor1 | 1 | 192.168.100.102 | 9066 | 43190 | cc | NULL | utf8:45 | 2044 | 144628 | 4046 | 40960 | 0 | | |
------------ ------ ----------------- ------ ------------ ------ -------- --------- -------- --------- --------------- ------------- ------------ --------- ------------
1 row in set (0.01 sec)
mysql>
重载配置
代码语言:javascript复制mysql> reload @@config;
Query OK, 1 row affected (0.15 sec)
Reload config success
mysql>
重载的是 schema.xml 配置
重置SQL统计
代码语言:javascript复制mysql> reload @@user_stat;
Query OK, 1 row affected (0.03 sec)
Reset show @@sql @@sql.sum @@sql.slow success
mysql> show @@sql;
Empty set (0.00 sec)
mysql> show @@sql.sum;
------ ------ ------ ------ ------ ------ -------------- -------------- -----------
| ID | USER | R | W | R% | MAX | TIME_COUNT | TTL_COUNT | LAST_TIME |
------ ------ ------ ------ ------ ------ -------------- -------------- -----------
| 1 | cc | 0 | 0 | 0 | 0 | [0, 0, 0, 0] | [0, 0, 0, 0] | 0 |
------ ------ ------ ------ ------ ------ -------------- -------------- -----------
1 row in set (0.00 sec)
mysql> show @@sql.slow;
Empty set (0.00 sec)
mysql>
关闭SQL统计
代码语言:javascript复制mysql> reload @@sqlstat=close ;
Query OK, 1 row affected (0.00 sec)
Set sql stat module isclosed=close, to succeed by manager.
mysql>
关闭后,@@sql @@sql.sum @@sql.slow
就不会变化
打开SQL统计
代码语言:javascript复制mysql> reload @@sqlstat=open;
Query OK, 1 row affected (0.01 sec)
Set sql stat module isclosed=open, to fail by manager.
mysql>
离线上线
代码语言:javascript复制mysql> offline;
Query OK, 1 row affected (0.00 sec)
mysql> show @@server;
-------------- ------------- -------------- ------------ --------------- --------------- --------- -------- -----------------------
| UPTIME | USED_MEMORY | TOTAL_MEMORY | MAX_MEMORY | RELOAD_TIME | ROLLBACK_TIME | CHARSET | STATUS | AVG_BUFPOOL_ITEM_SIZE |
-------------- ------------- -------------- ------------ --------------- --------------- --------- -------- -----------------------
| 8m 52s 140ms | 26609688 | 129499136 | 477102080 | 1457444457222 | -1 | utf8 | OFF | 575 |
-------------- ------------- -------------- ------------ --------------- --------------- --------- -------- -----------------------
1 row in set (0.00 sec)
mysql> online;
Query OK, 1 row affected (0.00 sec)
mysql> show @@server;
------------- ------------- -------------- ------------ --------------- --------------- --------- -------- -----------------------
| UPTIME | USED_MEMORY | TOTAL_MEMORY | MAX_MEMORY | RELOAD_TIME | ROLLBACK_TIME | CHARSET | STATUS | AVG_BUFPOOL_ITEM_SIZE |
------------- ------------- -------------- ------------ --------------- --------------- --------- -------- -----------------------
| 9m 0s 630ms | 26972784 | 129499136 | 477102080 | 1457444457222 | -1 | utf8 | ON | 572 |
------------- ------------- -------------- ------------ --------------- --------------- --------- -------- -----------------------
1 row in set (0.00 sec)
mysql>
然而我并没变有发现前后操作有什么异常,依旧可以正常连接操作
定向清理慢SQL
代码语言:javascript复制mysql> clear @@slow where schema = cctest;
Query OK, 0 rows affected (0.01 sec)
mysql> clear @@slow where datanode = sd1;
Query OK, 0 rows affected (0.01 sec)
mysql>
代码语言:javascript复制Tip: 还有好多,虽然
show @@help
中有列出,但目前还不支持,也许还没实现(正在开发中) 如
mysql> reload @@route;
ERROR 1003 (HY000): Unsupported statement
mysql> reload @@user;
ERROR 1003 (HY000): Unsupported statement
mysql> rollback @@route ;
ERROR 1003 (HY000): Unsupported statement
mysql> rollback @@user ;
ERROR 1003 (HY000): Unsupported statement
mysql> show @@slow where datanode = sd1;
ERROR 1003 (HY000): Unsupported statement
mysql> show @@slow where schema =cctest;
ERROR 1003 (HY000): Unsupported statement
mysql>
Mycat还是一个成长中的项目,还需要一些时间将这些功能完善,但目前来看,主体功能已经可以满足大部分需求
命令汇总
grep 66 server.xml
netstat -ant | grep 66
mysql -u cc -p -P 9066 -h 192.168.100.102
原文地址