localhost.localdomain is blocked : mysql

Discussion in 'Server Operation' started by KenKnight, Oct 8, 2006.

  1. KenKnight

    KenKnight Member

    Hi all,

    I've got a client with one of the debian sarge setup and after a few hours when you try to login to ispconfig you get the following error;

    Host 'localhost.localdomain' is blocked because of many connection errors. Unblock with 'mysqladmin flush-hosts'

    it is referencing a php file below /home/admispconfig

    Once I issue the flush-hosts everything works fine for a while. Another note is it doesn't seem to affect other php/mysql applications.

    Any suggestions. I'm not finding any logs that have any meaningful entires.

    Cheers!
    Ken
     
  2. falko

    falko Super Moderator Howtoforge Staff

    What's the exact error message?

    ISPConfig uses its own Apache and PHP, that's why it doesn't affect other PHP applications.

    You can check the logs in /root/ispconfig/httpd/logs.
     
  3. KenKnight

    KenKnight Member

    Hi Falko,

    Here's a copy of the error in the browser;

    Warning: mysql_connect() [function.mysql-connect]: Host 'localhost.localdomain' is blocked because of many connection errors. Unblock with 'mysqladmin flush-hosts' in /home/admispconfig/ispconfig/lib/classes/ispconfig_db_mysql.lib.php on line 77

    As soon as I do the flush-hosts command everything will work fine.

    Also, the ispconfig_access_log is showing nothing but stand http GET commands on various files of the site.

    Cheers!
    Ken
     
  4. falko

    falko Super Moderator Howtoforge Staff

  5. Ovidiu

    Ovidiu Active Member

    I have a somewhat similar problem, today a clients website showed this error:

    when he was trying to access his gallery. after a flush-hosts all is fine...

    my munit and hotsanic tools do not show any big traffic, neither mysql accesses...

    any clues how to avoid this?
     
  6. falko

    falko Super Moderator Howtoforge Staff

    Are there any errors in your logs?
    Did you have a power failure, or was the system reset?
     
  7. pdoes

    pdoes New Member

    When you get this error message it means that mysqld has gotten a lot (max_connect_errors) of connect requests from the host 'hostname' that have been interrupted in the middle. After max_connect_errors failed requests, mysqld assumes that something is wrong (like an attack from a cracker), and blocks the site from further connections until someone executes the command mysqladmin flush-hosts.

    By default, mysqld blocks a host after 10 connection errors. You can easily adjust this by starting the server like this:

    shell> safe_mysqld -O max_connect_errors=10000 &

    Note that if you get this error message for a given host, you should first check that there isn't anything wrong with TCP/IP connections from that host. If your TCP/IP connections aren't working, it won't do you any good to increase the value of the max_connect_errors variable!

    Hope this helps
    Peter
     
  8. Ovidiu

    Ovidiu Active Member

    well I have not enabled logging for mysql, I'll do that next thing in the morning. no other relevant logs.

    regarding max connection errrors: the databases are only accesse from localhost... so connections are ok ;-)
     
  9. pdoes

    pdoes New Member

    The fact that the database is accessed locally doesn't mean it doesn't use TCP connections which means you can't assume they are OK, cause your error message states something is wrong.

    I'm not saying the connection itself is faulty, like a faulty switch somewhere, but you could get aborted connections because people are tired of waiting and shut down their browser, or people keep hitting the refresh button on the browser, which opens a new connection to MySQL and so overflowing the connections.

    If the site is visited a lot the default of 10 errors is reached easily especially if it's a shared databases by more then one program, Like Gallery and Php-nuke together.

    Peter
     
  10. Ovidiu

    Ovidiu Active Member

    forgive my ignorance, I modified the max connect errors to 100 - I'll see how this works out.
     
  11. Ovidiu

    Ovidiu Active Member

    can someone tell me how to enable logging for mysql and how to control what is being logged? I wopuld be very interested in seeing which client/application is generating all these connection errors...
     
  12. martinfst

    martinfst Member Moderator

    phpMyAdmin has a default option to look at the bin logfiles (which is default nowadays). There are ways to have MySQL generate plain text log files, but those tend to grow fast......
     
  13. Ovidiu

    Ovidiu Active Member

    ok I foudn that feature in phpmyadmin, I see all that has been going on in the db, but I do not see anythign suspicious.... no errors whatsoever...

    is that normal? could it just have been an issues with this max connect error being set to low?

    ###edit###

    the logs viewed from phpmyadmin do not show timestamps, so I cannot verify what happened at the time I got too many errors and the whole thing stopped.
     
    Last edited: Jan 11, 2007
  14. falko

    falko Super Moderator Howtoforge Staff

    At least it's possible.
    What's the output of
    Code:
    uptime
    ?
     
  15. Ovidiu

    Ovidiu Active Member

    thats when I first had this error => I restarted because I had some problems executing certain commands via putty from my mobile phone. During the last 6 days, this server has been running I had this problem again and was able to succesfully run the flush command.

    before I did the restart thing, the server had been running for 3 weeks.
     
  16. falko

    falko Super Moderator Howtoforge Staff

    Ok, no power failure then... I'd play around with the max connect errors setting then.

    That's very interesting. Have you thought about writing a tutorial about how you set this up? Or is your mobile phone some kind of Windows PDA where you simply installed PuTTY?
     
  17. Ovidiu

    Ovidiu Active Member

    :D

    no big deal about the putty via phone, all you need is a mobile phone with symbian or maybe with windows ce or windows mobile, I don't know that much about it.

    I have been using putty for the last 3 years from my mobile phone, I had a Nokia 6600 which was running symbian 6.0. The only drawback was that I couldn opt enter the commands character by character, I had to select: send command, then put in my command line, then push send.

    NOW I have a Nokia E70 specially selected for this task, as it has a full keyboard and I can use putty exactly like I use it from my pc (the only drawback I have found so far is that it seems to have no "TAB" key, so I cannot autocomplete commands and paths although I guess I could have a look, maybe one could remap the TAB key to another key - who knows.)

    And now to the most important part, where to get putty free for your mobile phone: http://s2putty.sourceforge.net/ and here is a putty guide: http://s2putty.sourceforge.net/putty_users_guide.pdf

    To be honest I am not sure if this is the version I am using as there is no version information on my putty but I think this is it.

    Now have fun with it :)
     
    Last edited: Jan 12, 2007
  18. falko

    falko Super Moderator Howtoforge Staff

    That sounds like the first real reason to me for owning a cell phone. :D
     
  19. Ovidiu

    Ovidiu Active Member

    its the major reason I signed up for GPRS traffic and now for 3G - I pay around 5$ for 15MB of traffic, speed is amazing, although I just use it to check mails, putty and messenger - I bought a copy of Agile MEssener, cost me 25€ but I can be sonstantly online with gtalk, msn, yahoo and icq at the same time AND the traffic of 4h of being online with the messengers is max. 200-300 kb
     

Share This Page