Situation is that, we have AWS EC2 medium instance, with Linux on it.
It has Drupal as well. Additionally to that we have few files that access to mysql as well, with same settings as Drupal does.
The problem is that - at one point mysql refuses connections.
It happens when there is low or big load (not related on this), as well once it gets inaccessible, mysqld process is still running, and does not falls.
Restarting of this process does not fixes a problem. Rebooting instance - fixes problem.
When i connect to localhost it gives this:
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
While mysql.sock file is on place and with right permissions.
Restarting mysqld doesn't helps, but restarting instance - solves the problem.
my.cnf looks like that:
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
symbolic-links=0
wait_timeout=28800
interactive_timeout = 28800
max_allowed_packet=32M
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
As well mysqld runs without any errors, and in logs we have this:
120830 9:48:00 [Note] /usr/libexec/mysqld: Shutdown complete
120830 09:48:00 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
120830 09:48:01 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
120830 9:48:01 [Note] Plugin 'FEDERATED' is disabled.
120830 9:48:01 InnoDB: The InnoDB memory heap is disabled
120830 9:48:01 InnoDB: Mutexes and rw_locks use GCC atomic builtins
120830 9:48:01 InnoDB: Compressed tables use zlib 1.2.3
120830 9:48:01 InnoDB: Using Linux native AIO
120830 9:48:01 InnoDB: Initializing buffer pool, size = 128.0M
120830 9:48:01 InnoDB: Completed initialization of buffer pool
120830 9:48:02 InnoDB: highest supported file format is Barracuda.
120830 9:48:02 InnoDB: Waiting for the background threads to start
120830 9:48:03 InnoDB: 1.1.8 started; log sequence number 4191070086
120830 9:48:03 [Note] Event Scheduler: Loaded 0 events
120830 9:48:03 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.5.20' socket: '/var/lib/mysql/mysql.sock -u root' port: 3306 MySQL Community Server (GPL)
When issue occured again, I took logs again, tried to stop httpd then mysqld, then run mysqld and then run httpd, and logs are absolutely the same as in normal conditions logs with same restart sequence.
Changing in php.ini did not saved the situation:
mysql.allow_persistent = Off
Restarting in this order, does not helps (even different orders tried):
service httpd stop
service mysqld stop
service mysqld start
service httpd start
We would like to find out what is problem and how prevent it from falling like that.