I have a web system setup in AWS that we are building up to migrate an existing web app to. I have 2 VPCs: 1 for web and 1 for data. These VPCs are Peered and Security Groups are setup to isolate each VPCs subnet.
At the moment, there is an EC2 Ubuntu 14 + Apache 2 + PHP 5.6 machine that connects to a single MySQL master DB in the data VPC for its writes and calls to an Internal Elastic Load Balancer in the data VPC that is balancing 2 MySQL slave/replicas for its reads. Each DB is an Amazon Linux EC2 running MySQL 5.6.
Everything works fine for a few minutes (10-30'ish), but then the web server isn't able to make connections to the DBs. The loss of connection manifests itself via our PHP + CodeIgniter web application as 'no connection' errors. I've removed the slaves and still get the same issue when only reading/writing from the master.
I can temporarily resolve the issue by running FLUSH HOSTS
via MySQL Workbench that is connected via SSH Tunnel through the web server to the master db. I noticed however that as soon as I do that, the following entry appears in my /var/lib/mysql/{host}.err
[Warning] IP address 'ommitted' could not be resolved: Name or service not known
I'd think, based off that error message, that this is a network issue, but the system works fine for a little while after flushing the hosts from the master. It's also important to note that my SSH Tunnel through that same web server never has a problem, before, during, or after the web app breaking.
I'm a bit stumped on this, considering it works for a little while and then breaks. I'd rather not simply increase my max_connect_errors
without knowing what exactly is causing my connect error if possible, so any and all insight is welcome and appreciated greatly!
max_connect_errors
. i've left an answer here dba.stackexchange.com/a/124024/82898