I'm experiencing an unusual issue with my production mysql server. Currently I only have two production servers so I had all the server host name entries in
/etc/hosts files on each server. A few days ago I setup a DNS zone in hopes that I can remove the manual entries in the
Due to the fact I only have two production servers, I setup my DNS so that each server had a real hostname, which could be aliased too so that I can control connections by simply updating dns records. For example, server1 hosts httpd and mysql, so in my DNS zone I have server1 with an A record of 184.108.40.206 and store-ro with an alias to server1. Obviously 220.127.116.11 is not my real ip, demonstrative only.
After some configuration, I am able to connect to the local mysql instance via command line, but my application keeps throwing
Unknown MySQL server host 'store-ro' errors. The only way I can fix the issue is if I add the following back to the hosts file:
127.0.0.1 store-ro # or 18.104.22.168 store-ro
(Not sure if it matters, but my app is using Zend_Db to connect to the database.)
So the app can connect to the server if I enter loopback ip or the actual ip, but won't work if removed from the hosts file, so I thought maybe it was a DNS issue, but it appears that the server can resolve the hostname fine:
$ -> nslookup store-ro Server: 22.214.171.124 Address: 126.96.36.199#53 Non-authoritative answer: store-ro.example.com canonical name = server1.example.com. Name: server1.example.com Address: 188.8.131.52
I do have SELinux enabled, and a cursory glance over relevant httpd connection settings appear to be correct:
$ -> getsebool -a | ack httpd httpd_can_network_connect_db --> on httpd_can_network_connect --> on
Plus there are no entries showing up in
My hostname is set correctly:
$ -> hostname server1
MySQL user perms:
mysql> select host, user from user; +-----------+-------------+ | host | user | +-----------+-------------+ | % | ro_user_1 | | % | ro_user_2 |
search example.com nameserver 184.108.40.206 nameserver 220.127.116.11
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 18.104.22.168 server1 server1.example.com # This shouldn't be necessary with DNS setup?
The only thing I can think of is if the alias to the cname may be causing the issue, but I doubt it. Any help is appreciated.
Forgot to add the actual error:
SQLSTATE[HY000]  Unknown MySQL server host 'store-ro'
Per request here is the full row from the mysql table:
mysql> select * from user where user like '%core%'\G *************************** 1. row *************************** Host: % User: ro_ml_core Password: *2B5FEA45B69826783FD6F8601A9AFB1CFE916D52 Select_priv: N Insert_priv: N Update_priv: N Delete_priv: N Create_priv: N Drop_priv: N Reload_priv: N Shutdown_priv: N Process_priv: N File_priv: N Grant_priv: N References_priv: N Index_priv: N Alter_priv: N Show_db_priv: N Super_priv: N Create_tmp_table_priv: N Lock_tables_priv: N Execute_priv: N Repl_slave_priv: N Repl_client_priv: N Create_view_priv: N Show_view_priv: N Create_routine_priv: N Alter_routine_priv: N Create_user_priv: N Event_priv: N Trigger_priv: N Create_tablespace_priv: N ssl_type: ssl_cipher: x509_issuer: x509_subject: max_questions: 0 max_updates: 0 max_connections: 0 max_user_connections: 0 plugin: authentication_string: NULL