RDSを使っているとMulti-AZ DeploymentがYesになっている場合でも、以下のようにMySQLに接続できない時間が存在する。
Database connection "SQLSTATE[HY000] [2003] Can't connect to MySQL server on 'endpoint.zone.amazonaws.com' " is missing, or could not be created.
ユーザーのアクセスごとにconnectが発生するようなシステムの場合、上述の接続できない時間の間に多数のユーザーがアクセスし、クライアントが接続エラーを繰り返す場合がある。その場合、以下のエラーが発生する。
Database connection "SQLSTATE[HY000] [1129] Host 'instance.zone.compute.internal' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'" is missing, or could not be created.
■上限値を増やす
max_connect_errorsを変更することで接続エラーの上限値を変更できる。
■ブロックを解除する
mysqladmin -h endpoint.zone.amazonaws.com -u user --password=password flush-hosts