I have setup a multiserver cluster (version below 3.1), where the database is running on a different server. All Servers are listed under /etc/hosts, but when I try to connect from php (FPM) and I have entered the hostname which is in this file, it can not resolve the ip address. How do I connect to DB Server without using IP Adresses and public DNS entries?
What happens testing mysql connection by hostname from the command line? Putting the hostnames/addrs in /etc/hosts is the right thing to do there, so either the entries aren't correct (misspelled or wrong syntax?), or they're not being used. If your php-fpm daemon is running in chroot environment, you'd need to edit the /etc/hosts file inside that chroot environment as well. If that's not it, maybe check /etc/nsswitch.conf and make sure you have 'files' listed first for hosts resolution.
From the console it is running pings etc. without any problems, when I log in into an chrooted ssh account and display the /etc/hosts file, everything seems to be correct...