MYSQL 的异常CRASH事件处理
检查问题的过程
******************************************************************************************
ps -ef|grep mysql
kill -9 pid值
然后才可以正常启动,要不就一直重启不停。
1、 mysql -uroot -pD*********
2、
mysql> show variables like 'log_error';
+---------------+----------------------------------------------+
| Variable_name | Value |
+---------------+----------------------------------------------+
| log_error | /usr/local/db/mysql/data/AY130805143906Z.err |
+---------------+----------------------------------------------+
1 row in set (0.00 sec)
=========================================================================================
错误日志如下:
150420 13:48:48 [ERROR] mysqld got signal 11 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
To report this bug, see http://kb.askmonty.org/en/reporting-bugs
We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed,
something is definitely wrong and this may fail.
Server version: 5.5.39-MariaDB
key_buffer_size=16384
read_buffer_size=262144
max_used_connections=34
max_threads=1002
thread_count=18
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 338517 K bytes of memory
Hope that's ok; if not, decrease some variables in the equation.
******************************************************************************************
尝试的解决办法:
1、怀疑是磁盘空间不足造成: 扩大/usr/local/db/mysql/data的磁盘空间 mount上大数据盘
2、怀疑是参数配置有问题造成:
修改/etc/my.cnf为
#拷贝 my-samll.cnf
\cp /usr/local/mysql/support-files/my-small.cnf /etc/my.cnf
#追加文本行
sed -i -e '/thread_stack = 240K/a\lower_case_table_names=1\ninnodb_file_per_table=1\nskip-grant-tables\nskip-name-resolve\nback_log = 384\nthread_stack = 256K\ntable_cache = 400\nsort_buffer_size=32M\nthread_cache_size=120\njoin_buffer_size = 8M\nmyisam_sort_buffer_size = 64M\nthread_cache_size = 64\nquery_cache_size = 0\nquery_cache_type = 0\ntmp_table_size = 256M\nmax_connections = 214\nmax_connect_errors = 1000\nwait_timeout = 31536000\nthread_concurrency = 8\ninnodb_additional_mem_pool_size=4M\ninnodb_flush_log_at_trx_commit=1\ninnodb_log_buffer_size=2M\ninnodb_thread_concurrency=8\ntmp_table_size=64M\ninteractive_timeout=31536000\nlog = /tmp/mysql.log\n' /etc/my.cnf
#执行替换
sed -i '/^key_buffer_size =/ckey_buffer_size =384M' /etc/my.cnf
#替换
sed -i '/^max_allowed_packet =/cmax_allowed_packet = 4M' /etc/my.cnf
#替换
sed -i '/^sort_buffer_size =/csort_buffer_size = 6M' /etc/my.cnf
#替换
sed -i '/^read_buffer_size =/cread_buffer_size = 4M' /etc/my.cnf
#替换
sed -i '/^read_rnd_buffer_size =/cread_rnd_buffer_size = 16M' /etc/my.cnf
3、将lxyyProduct ,zxpt , hjt,crm 四个项目从tomcat中移除,先进行稳定性测试,如果没问题再想办法处理。
4、
参考阅读:http://www.tuicool.com/articles/AB7Jfu
原来linux内核信号量默认设置太小,压测的时候,造成大量等待,
默认
# cat /proc/sys/kernel/sem
250 32000 32 128
说明:
第一列,表示每个信号集中的最大信号量数目。
第二列,表示系统范围内的最大信号量总数目。
第三列,表示每个信号发生时的最大系统操作数目。
第四列,表示系统范围内的最大信号集总数目。
将第三列调大一点,参考网上的数据
echo "kernel.sem=250 32000 100 128″>>/etc/sysctl.conf
然后sysctl -p
重启mysql
总结:
1、是不是数据库版本问题,尽量升级到最新的数据库;
http://blog.chinaunix.net/uid-10449864-id-2956923.html
2、SQL语句有问题,参考上面的链接。
3、设置的系统打开文件数太少:
http://blog.chinaunix.net/uid-20728886-id-138147.html
4、Query Cache引起的问题,办法是禁用掉:
http://www.xue163.com/exploit/163/1635340.html
http://www.php230.com/weixin1410064192.html
关闭方法很简单,有两种:
1、同时设置选项 query_cache_type = 0 和 query_cache_size = 0;
2、如果用源码编译MySQL的话,编译时增加参数 --without-query-cache 即可;
黄海采用的是方法1。
5、设置记录每条执行过的SQL语句:
#创建一个空文件
touch /usr/local/db/sql_row.log
vi /etc/my.cnf 添加在[mysqld]块中
log=/usr/local/db/sql_row.log
需要手动建立此文件,然后
chmod /usr/local/db/sql_row.log
service mysql restart
MYSQL 的异常CRASH事件处理的更多相关文章
- mysql数据库连接异常问题(总结)
mysql数据库连接异常问题(总结) 1.1 前言 最近项目由1个数据源增加至了3个数据源(连接池使用C3P0),结果各种奇葩的数据库连接问题接踵而至,为防止将来再次遇到同样的问题不犯同样错误,现 ...
- Mysql数据库异常
1. Mysql数据库异常 1.1. 数据库问题之Got error 28 from storage engine 原因首先检查磁盘是否已满,df -h一下 很可能是日志数据过大,查看该目录下文件夹和 ...
- MySQL复制异常大扫盲:快速溯源与排查错误全解
MySQL复制异常大扫盲:快速溯源与排查错误全解https://mp.weixin.qq.com/s/0Ic8BnUokyOj7m1YOrk1tA 作者介绍王松磊,现任职于UCloud,从事MySQL ...
- 诊断:记一次存储异常CRASH致数据库无法正常打开的恢复
数据库存储异常crash,首先控制文件出现问题 ORA-: ????? ???? ORA-: ???? : '/oracledata/oradata/orc11rac/orc11rac/system0 ...
- Linux下Mysql启动异常排查方案
遇到Mysql启动异常问题,可以从以下几个方面依次进行问题排查: (1)如果遇到“Can't connect to local MySQL server through socket '/tmp/my ...
- MySQL 事务 异常 事务隔离的级别
MySQL 事务 异常 事务隔离的级别 事务 在你操作数据库的同时,有可能其他用户还会不断地对数据进行增删改查操作.为了避免并行进行时出现混乱,就产生了"事务".事务就是要保证 ...
- 一则线上MySql连接异常的排查过程
Mysql作为一个常用数据库,在互联网系统应用很多.有些故障是其自身的bug,有些则不是,这里以前段时间遇到的问题举例. 问题 当时遇到的症状是这样的,我们的应用在线上测试环境,JMeter测试过程中 ...
- MySql连接异常解决
这两天遇到一个mysql连接的问题,找人弄了好几天也没弄好,先看一下报错信息: ============================================================ ...
- Dapper MySql DateTime 异常
实体类 字段类型 DateTime? ,MySQL数据库中字段类型 datetime NULL , 使用dapper扩展读取,报异常:Error Parse column: ** - Object. ...
随机推荐
- 【PHP】- Apache设置
Apache配置 1.首先新建一个自己的amp目录(模仿wampserver安装目录),以后的apache,mysql,php都放在此目录下. 2.下载apache 根据自己的系统下载相应的压缩包,我 ...
- Angular 2018 All in One
Angular 2018 https://cli.angular.io/ v7.0.6 https://angular.io/ https://angular.cn/ v7.0.4 $ npm i - ...
- hdu 1853 Cyclic Tour (二分匹配KM最小权值 或 最小费用最大流)
Cyclic Tour Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/65535 K (Java/Others)Total ...
- c# 以多个字符串分隔字符串数据 分组 分隔 split 正则分组
string str="aaa[##]ccc[##]ddd[##]bb" Regex regex=new Regex("[##]");//以 [##] 分割 s ...
- [NOI.AC省选模拟赛3.23] 集合 [数学]
题面 传送门 一句话题意: 给定$n\leq 1e9,k\leq 1e7,T\leq 1e9$ 设全集$U=\lbrace 1,2,3,...n\rbrace $,求$(min_{x\in S}\lb ...
- Noip2016滚粗记QAQ
day1 t1 XBG #include<map> #include<cstdio> #include<string> #include<string.h&g ...
- Seajs的用法
以前经常听到Seajs,但是没深入了解过,不清楚到底是用做哪个方面,后来调组到M站做开发,发现项目用到了Seajs,便去了解下 SeaJS是一个遵循CMD规范的JavaScript模块加载框架,可以实 ...
- SQL SERVER:删除筛选记录中前100条数据
delete from table1 where id in (select top 100 id from table1)
- codeforces 1077F1
题目:https://codeforces.com/contest/1077/problem/F1 题意: 你有n幅画,第i幅画的好看程度为ai,再给你两个数字k,x 表示你要从中选出刚好x幅画,并且 ...
- codeforces 799C Fountains
C. Fountains time limit per test 2 seconds memory limit per test 256 megabytes input standard input ...