今天上午不断的接到开发同学的反馈,测试环境的一台mysql(5.1.48),对应的应用总是不断的报连接数拿不到。登陆到机器后发现mysql -uroot连接不上,而netstat -nal |grep 3306|wc -l也只有1200个,而这台机器设置的max_connections=5000,max_user_connections=0,innodb_open_files=60000。
因为这台机器上100+个schema,2w+个表,只是部分应用有反馈,大部分应用还处于可用状态,因此没有做任何处理,采取了kill session的方式(这一次刚好有同学在出问题之前用mysql -uroot连上了),kill后,过了一段时间恢复了,mysql -uroot可以连接了。想当然的认为是某个应用把连接拿完了导致的,还以为解决了。
但是到下午又有同学反馈同样的问题,这次ssh之后mysql -uroot依然连不上,ps发现mysqld是刚刚起的。怀疑mysqld异常重启,看了一下alert日志,发现有大量下面的信息:
121203 16:06:54 InnoDB: MySQL and InnoDB data dictionaries are out of sync.
InnoDB: Unable to find the AUTOINC column template_id in the InnoDB table test/tc_steppay_templa
te.
InnoDB: We set the next AUTOINC column value to 0,
InnoDB: in effect disabling the AUTOINC next value generation