Chinaunix首页 | 论坛 | 博客
  • 博客访问: 736784
  • 博文数量: 38
  • 博客积分: 587
  • 博客等级: 中士
  • 技术积分: 579
  • 用 户 组: 普通用户
  • 注册时间: 2011-10-17 14:32
文章存档

2013年(15)

2012年(23)

分类: Mysql/postgreSQL

2013-04-15 14:09:49

【问题背景】
     在主站某MySQL集群使用mysqltuner对MySQL状态值做了个汇总,其中[!!] Connections aborted: 28%的比例相当高。
 $mycalc{'pct_aborted_connections'} = int(($mystat{'Aborted_connects'}/$mystat{'Connections'}) * 100);
可见:这个比例是由Aborted_connects/Connections

711387/2477018=0.2872

【问题分析】

1、这个比例是MySQL启动以来Abort_connets量的很大,查看zabbix的MySQL Connection监控图

从图片分析:状态值Aborted_connects的量比较大。
Aborted_connects: 表示client连接MySQL Server不成功的次数。
If a client is unable even to connect, the server increments the Aborted_connects status variable. Unsuccessful connect attempts
can occur for the following reasons:
1)  A client does not have privileges to connect to a database.
2)  A client uses an incorrect password.
3)  connection packet does not contain the right information.
4) It takes more than connect_timeout seconds to get a connect packet.
说明在这此段时间内,clinent在大量尝试连接MySQL server,出现大量的连接未成功。

2、根据监控图出现时间段,在当天此时间段做现象抓取,最终调查到有一个MySQL用户的连接数已经达到max_user_connections,
但还应用程序还有大量连接进来,以至于server不断拒绝此用户的连接,这样abort_connects大量出现。
 

3、使用netstat查看数据库port的tcp/ip连接情况,果然出现在量连接处于TIME_WAIT状态。

最终找到应用的负责人调查,因为这种错误,应用程序肯定一直处于报警状态,果然访问程序的web页面就出错,由于是很老的应用,处于下线状态了,无人管理。
正常设置:应用程序连接池上限和< max_user_connections。 最终调整了max_user_connctions.


 总结:
        由于某类事故,DBA不能很好的发现,比如上类问题,可以通过mysqltuner对整体status做一个评估,然后可以定位到一些问题。

阅读(3070) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~