特性描述
在实例连接数过多等运维场景下,我们需要查看连接并删除连接。TDSQL-H LibraDB 支持查看和删除连接。
查看当前节点连接:
show connections
或访问 system.connections
表。删除当前节点连接:
kill connection where ... (sync);
查看全局连接:
show connections global
或访问 system.connections_all
表。删除全局连接:
kill connection where ... (sync) global;
使用限制
如果需要清除连接,登录账号需具有 KILL QUERY 权限。
使用说明
查看当前节点连接
show connections
n示例:n![](https://qcloudimg.tencent-cloud.cn/image/document/ede6cc11e7ed13e6c5985ba9e76f7e77.png)
访问
system.connections
表SELECT * FROM system.connections ...;
示例:n![](https://qcloudimg.tencent-cloud.cn/image/document/1bf7751c81de26fc8460f2d566522b71.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/1bf7751c81de26fc8460f2d566522b71.png)
删除当前节点连接
同步删除
kill connection where connection_id='' sync;
示例:n![](https://qcloudimg.tencent-cloud.cn/image/document/8c00c810233b1b16da06f075aa431f58.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/8c00c810233b1b16da06f075aa431f58.png)
异步删除
kill connection where connection_id='';
示例:n![](https://qcloudimg.tencent-cloud.cn/image/document/8683336e43bed479e0d6adfae16c469c.png)
n查看连接已删除成功。n![](https://qcloudimg.tencent-cloud.cn/image/document/809016fb65936607be8ddb7358f7c070.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/8683336e43bed479e0d6adfae16c469c.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/809016fb65936607be8ddb7358f7c070.png)
查看全局连接
show connections global
n示例:n![](https://qcloudimg.tencent-cloud.cn/image/document/3309768e988b5e1fe7b844e6613c2ef0.png)
访问
system.connections_all
表SELECT * FROM system.connections_all;
示例:n![](https://qcloudimg.tencent-cloud.cn/image/document/db11869f43289301da481176afb2386a.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/db11869f43289301da481176afb2386a.png)
删除全局连接
同步删除
kill connection where connection_id='' sync global;
示例:n![](https://qcloudimg.tencent-cloud.cn/image/document/b34e0fa998c37144e9196a1580eb6b43.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/b34e0fa998c37144e9196a1580eb6b43.png)
异步删除
kill connection where connection_id='' global;
示例:n![](https://qcloudimg.tencent-cloud.cn/image/document/3ee70152e89a7ccc81112c12e44b945e.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/3ee70152e89a7ccc81112c12e44b945e.png)