SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
- by Barkat Ullah
Server details:
RAM: 16GB
HDD: 1000GB
OS: Linux 2.6.32-220.7.1.el6.x86_64
Processor: 6 Core
Please see the link below for my # top preview:
I can often see the error mentioned in title in my plesk panel and my /etc/my.cnf configuration are as below:
bind-address=127.0.0.1
local-infile=0
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
max_connections=20000
max_user_connections=20000
key_buffer_size=512M
join_buffer_size=4M
read_buffer_size=4M
read_rnd_buffer_size=512M
sort_buffer_size=8M
wait_timeout=300
interactive_timeout=300
connect_timeout=300
tmp_table_size=8M
thread_concurrency=12
concurrent_insert=2
query_cache_limit=64M
query_cache_size=128M
query_cache_type=2
transaction_alloc_block_size=8192
max_allowed_packet=512M
[mysqldump]
quick
max_allowed_packet=512M
[myisamchk]
key_buffer_size=128M
sort_buffer_size=128M
read_buffer_size=32M
write_buffer_size=32M
[mysqlhotcopy]
interactive-timeout
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
open_files_limit=8192
As my server httpd conf is set to /etc/httpd/conf.d/swtune.conf and the configuration is as below: at prefork.c:
<IfModule prefork.c>
StartServers 8
MinSpareServers 10
MaxSpareServers 20
ServerLimit 1536
MaxClients 1536
MaxRequestsPerChild 4000
</IfModule>
If I run grep -i maxclient /var/log/httpd/error_log then I can see everyday this error:
[root@u16170254 ~]# grep -i maxclient /var/log/httpd/error_log
[Sun Apr 15 07:26:03 2012] [error] server reached MaxClients setting, consider raising the MaxClients setting
[Mon Apr 16 06:09:22 2012] [error] server reached MaxClients setting, consider raising the MaxClients setting
I tried to explain everything that I changed to keep my server okay, but maximum time my server is down. Please help me which parameter can I change to keep my server okay and my sites can load fast. It is taking too much time to load my sites.