mysql connection是什么_记一次MySQL出现too many connection
今天中午的時候突然接到報警,MySQL連接數(shù)暴增..本來設置的max_conntion=6000, 這個數(shù)值連接已經(jīng)夠用.接到報警速度連接服務器連接mysql總是報如下錯誤:
[mysql@localhost ~]$ mysql -u xxxxx -pxxxxxxxx
ERROR 1040 (HY000): Too many connections
本來打算kill殺掉重啟搞定解決..但是生產庫最好不要輕易重啟.這里演示一種在線解決連接數(shù)滿的方式..還記的神器gdb嗎?沒錯就是它 ^_^
查看mysql后臺進程
[mysql@localhost ~]$ ps -ef | grep mysql
root ? ? ?1549 ?1281 ?0 16:21 ? ? ? ? ?00:00:00 sshd: mysql [priv]
mysql ? ? 1551 ?1549 ?0 16:21 ? ? ? ? ?00:00:00 sshd: mysql@pts/0
mysql ? ? 1552 ?1551 ?0 16:21 pts/0 ? ?00:00:00 -bash
mysql ? ? 1571 ?1552 ?0 16:21 pts/0 ? ?00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe
mysql ? ? 1985 ?1571 ?0 16:21 pts/0 ? ?00:00:01 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --log-error=/mysql/mysqld.log --pid-file=/mysql/mysqld.pid --socket=/tmp/mysql.sock
使用gdb修改內存中的max_connections值
[mysql@localhost ~]$ gdb -p 1985 -ex "set max_connections=10240" -batch
[New LWP 2190]
[New LWP 2094]
[New LWP 2070]
[New LWP 2039]
[New LWP 2009]
[New LWP 2007]
[New LWP 2006]
[New LWP 2005]
[New LWP 2004]
[New LWP 2003]
[New LWP 2002]
[New LWP 2001]
[New LWP 2000]
[New LWP 1999]
[New LWP 1998]
[New LWP 1996]
[New LWP 1995]
[New LWP 1994]
[New LWP 1993]
[New LWP 1992]
[New LWP 1991]
[New LWP 1990]
[New LWP 1989]
[New LWP 1988]
[New LWP 1987]
[Thread debugging using libthread_db enabled]
0x00007f5e26613343 in poll () from /lib64/libc.so.6
[mysql@localhost ~]$
現(xiàn)在嘗試進mysql,查看max_connections值
[mysql@localhost ~]$ mysql -u xxxxx -pxxxxxxx
Welcome to the MySQL monitor. ?Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.6.15-log Source distribution
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show variables like '%max_connections%';
+-----------------+-------+
| Variable_name ? | Value |
+-----------------+-------+
| max_connections | 10240 |
+-----------------+-------+
1 row in set (0.00 sec)
OK.^_^終于能進去了.終于恢復正常了..迅速批量殺掉sleep進程..一般情況下報too many connection應該是程序那邊出問題了.暫時解決方案擴大max_connections解決.原因等開發(fā)回來一起查吧.(壞的真不是時候,我的中午飯啊.......-_-可憐)
閱讀(5488) | 評論(0) | 轉發(fā)(2) |
總結
以上是生活随笔為你收集整理的mysql connection是什么_记一次MySQL出现too many connection的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 错误: 元素值必须为常量表达式_C语言编
- 下一篇: 从Tom说JSP原理