监视mysql上已使用的连接以调试“太多的连接" [英] Monitoring used connections on mysql to debug 'too many connections'

查看:59
本文介绍了监视mysql上已使用的连接以调试“太多的连接"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在LAMP生产服务器上,偶尔会从MYSQL收到连接过多"错误,我想添加监视以查找原因是否是我超出了最大连接限制.

On LAMP production server I get the 'too many connections' error from MYSQL occasionally, I want to add monitoring to find if the reason is that I exceed the max-connections limit.

我的问题:如何从mysql或mysqladmin查询当前使用的连接数? (我注意到显示状态显示的是总连接数,而不是当前使用的连接数.)

My question: How can I query from mysql or from mysqladmin the current number of used connections? (I noticed that show status gives total connections and not the currently used ones.)

推荐答案

innotop是监视MySQL的非常强大的工具.您可以在这里找到它:

A very powerful tool to monitor MySQL is innotop. You can find it here:

https://github.com/innotop/innotop

在Debian Lenny中,它是mysql-client-5.0软件包的一部分,我想它也可用于其他发行版.它在监视InnoDB内部信息方面特别强大,但同时也提供对服务器的常规监视.

In Debian Lenny, it is part of the package mysql-client-5.0 and I guess it is available for other distros as well. It is especially powerful in monitoring InnoDB internals, but provides general monitoring of the server as well.

在变量和状态"模式下,它监视变量"Connections"和"Max_used_Connections"(以及其他).它显示绝对值和增量值-后者可能使您对当前连接有所了解.

In "Variables & Status" mode, it monitors the variables "Connections" and "Max_used_Connections" (among others). It displays absolute and incremental values - the latter might give you an idea about the current connections.

由于innotop提供了非交互模式,因此您可以通过从一些自定义脚本,nagios检查或您拥有的任何系统调用innotop来轻松构建全自动监视.

Since innotop provides a non-interactive mode, you can easily build fully automated monitoring by calling innotop from some customized scripts, nagios checks or whatever system you have.

这篇关于监视mysql上已使用的连接以调试“太多的连接"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆