I have Sphinx installed and have around 40 indexes which connect to external mysql database to pull data. I have cronjobs set up for these indexes and re-index them every 5 minutes. So in other words every 5 minutes my server does 40 connections to an external mysql server.
The problem is that in approximately 10 minutes this stops working and if I ssh to sphinx server and try to connect to mysql database from command line, it returns
ERROR: index '...': sql_connect: Can't connect to MySQL server on '...' (110) (DSN=mysql://...:***@...:3306/...).
If I do the same from my local machine, I can connect so the mysql server itself is perfectly fine. Now if I SSH to the sphinx server and restart iptables, everything starts working again and it can once again connect to external mysql server. I am not very familiar with iptables so if anyone could give me some clues how to debug this or what could be causing this, I'd highly appreciate this!
Not quite a good answer but that's the only solution that I've managed to find: I ended up adding the IP of that mysql server to csf.allow file which holds the list of IPs that should never be blocked. It seems to be working so far. I've also found the IP of the other mysql server there which explains why it has been working without being blocked.