描述
对于kill [connection] proceselist_id
语句:
- 可以kill指定proceselist_id的session。
- 普通用户默认只能kill当前用户下所有session, 其他租户下session对其不可见,相同租户下其他用户的session的kill与否根据其当前租户权限确定。
- observer的系统租户SYS可以kill本租户内任意一个session,proxy的超级管理员
root@proxysys
可以kill所有cluster、tenant下的session。
示例
OceanBase (root@oceanbase)> show processlist;
+-------+--------+-------+----------------------+-----------+-------------+-------------------+-------------------+------+------+
| Id | Tenant | User | Host | db | trans_count | svr_session_count | state | tid | pid |
+-------+--------+-------+----------------------+-----------+-------------+-------------------+-------------------+------+------+
| 10004 | sys | root | 100.69.111.180:56777 | oceanbase | 68 | 1 | MCS_ACTIVE_READER | 2900 | 2891 |
| 10006 | sys | admin | 10.125.111.4:33747 | oceanbase | 66 | 1 | MCS_KEEP_ALIVE | 2891 | 2891 |
+-------+--------+-------+----------------------+-----------+-------------+-------------------+-------------------+------+------+
2 rows in set (0.01 sec)
OceanBase (admin@oceanbase)> show processlist;
+-------+--------+-------+--------------------+-----------+-------------+-------------------+-------------------+------+------+
| Id | Tenant | User | Host | db | trans_count | svr_session_count | state | tid | pid |
+-------+--------+-------+--------------------+-----------+-------------+-------------------+-------------------+------+------+
| 10006 | sys | admin | 10.125.111.4:33747 | oceanbase | 67 | 1 | MCS_ACTIVE_READER | 2891 | 2891 |
+-------+--------+-------+--------------------+-----------+-------------+-------------------+-------------------+------+------+
1 row in set (0.01 sec)
OceanBase (admin@oceanbase)> kill 10004;
ERROR 1095 (HY000): You are not owner of thread 10004
OceanBase (admin@oceanbase)> kill 1000;
ERROR 1094 (HY000): Unknown thread id: 1000
OceanBase (admin@oceanbase)> kill connection 1000;
ERROR 1094 (HY000): Unknown thread id: 1000
OceanBase (admin@oceanbase)> kill connection 10006;
ERROR 1317 (70100): Query execution was interrupted
OceanBase (admin@oceanbase)> show processlist;
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id: 10007
Current database: oceanbase
+-------+--------+-------+--------------------+-----------+-------------+-------------------+-------------------+------+------+
| Id | Tenant | User | Host | db | trans_count | svr_session_count | state | tid | pid |
+-------+--------+-------+--------------------+-----------+-------------+-------------------+-------------------+------+------+
| 10007 | sys | admin | 10.125.111.4:33864 | oceanbase | 65 | 1 | MCS_ACTIVE_READER | 2891 | 2891 |
+-------+--------+-------+--------------------+-----------+-------------+-------------------+-------------------+------+------+
1 row in set (0.25 sec)
OceanBase (test@proxysys@oceanbase)> show processlist;
+-------+------------+-------+----------------------+-----------+-------------+-------------------+-------------------+------+------+
| Id | Tenant | User | Host | db | trans_count | svr_session_count | state | tid | pid |
+-------+------------+-------+----------------------+-----------+-------------+-------------------+-------------------+------+------+
| 10008 | proxysys | root | 100.69.111.180:56822 | NULL | 8 | 0 | MCS_ACTIVE_READER | 2900 | 2891 |
| 10009 | sys | admin | 10.125.111.4:33980 | oceanbase | 65 | 1 | MCS_KEEP_ALIVE | 2891 | 2891 |
+-------+------------+-------+----------------------+-----------+-------------+-------------------+-------------------+------+------+
2 rows in set (0.01 sec)
OceanBase (admin@oceanbase)> show processlist;
+-------+--------+-------+--------------------+-----------+-------------+-------------------+-------------------+------+------+
| Id | Tenant | User | Host | db | trans_count | svr_session_count | state | tid | pid |
+-------+--------+-------+--------------------+-----------+-------------+-------------------+-------------------+------+------+
| 10009 | sys | admin | 10.125.111.4:33980 | oceanbase | 66 | 1 | MCS_ACTIVE_READER | 2891 | 2891 |
+-------+--------+-------+--------------------+-----------+-------------+-------------------+-------------------+------+------+
1 row in set (0.01 sec)
OceanBase (admin@oceanbase)> kill 10008;
ERROR 1094 (HY000): Unknown thread id: 10008