mysql max connections errors #29

Open
bwellsnc opened this Issue Mar 15, 2012 · 2 comments

3 participants

@bwellsnc

I have the proxy working now, but I have a new issue. I created a simple test proxy to an internal mysql server I have. It worked fine for the first couple of connections, then I received this error:

'hostname' is blocked because of many connection errors. Unblock with 'mysqladmin flush-hosts'

By default mysql is set to 10 max connection errors. In order to compensate, I increased the max_connection_errors variable in mysql to 5000. I really didn't want to make many changes on the MySQL side. Below is what I have in nginx:

check interval=3000 rise=2 fall=5 timeout=1000 type=mysql;

This is the default with the type of mysql added. I would like to know how I can fix this in nginx vs making changes in mysql configuration. If it can't be fixed in nginx, then I will just stick to the changes in mysql for now. Thanks!

@yaoweibin
Owner
@tak-aryelle

I encountered the same problem. After running well for hours suddenly I got:

 {Doctrine_Connection_Exception} PDO Connection Error: SQLSTATE[HY000] [1129] Host '10.0.0.2' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'

Here is my nginx conf:

tcp {

  upstream databases {
      server 10.0.0.2:3306;
      server 10.0.0.3:3306;
      server 10.0.0.1:3306 backup;
      check interval=3000 rise=2 fall=5 timeout=1000 type=mysql;
  }

  server {
      listen 3306;
      proxy_pass databases;
  }

}

Limiting with max_busy wouldn't help, because it isn't a “Too many connections” error. I suspect the tcp connections aren't closed well. Are there any options I could set to solve that?

Thanks in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment