ISSUE #1 : Connection Errors
Once mysql has racked up enough connection errors, the host blocks all IPs until you do one of two things:
$ service mysql restart
mysql> FLUSH HOSTS;
According to MySQL Documentation on FLUSH HOSTS;
HOSTS
empties the host cache tables. You should flush the host tables
if some of your hosts change IP address or if you get the error
message Host 'host_name' is blocked. When more than max_connect_errors
errors occur successively for a given host while connecting to the
MySQL server, MySQL assumes that something is wrong and blocks the
host from further connection requests. Flushing the host tables
enables further connection attempts from the host. See Section
C.5.2.6, “Host 'host_name' is blocked”. You can start mysqld with
--max_connect_errors=999999999 to avoid this error message.
Try bumping up max_connect_errors (default is 10) to some obnoxiously high number, like 999999999 (about 1 billion), in /etc/my.cnf as follows:
[mysqld]
max-connect-errors=999999999
You will then just restar mysql. To put this new setting in place without restarting, just run this command in the mysql client:
mysql> SET GLOBAL max_connect_errors = 999999999;
ISSUE #2 : DNS
If you are connecting to mysql using DNS, this could be one possible source of issues if:
- DNS servers go down
- DNS servers cannot be reached
To alleviate DNS issues, you need to add the following to /etc/my.cnf (mysql restart required):
[mysqld]
skip-host-cache
skip-name-resolve
You also need to look at the host column of mysql.user. If any of the users have a DNS name, replace it with one of the following choices:
- Public IP
- Private IP
- LoadBalacner-managed VIP
- Netblocks (such as 10.1.2.%) of the first three choices
Afterwards, run mysql> FLUSH PRIVILEGES;