unknown MySQL server host 'mysql.service.dc1.consul'

285 views
Skip to first unread message

Abhishek Bhatnagar

unread,
Jul 6, 2015, 8:02:33 AM7/6/15
to consu...@googlegroups.com
Hi,

I am following this tutorial from youtube. https://www.youtube.com/watch?v=huvBEB3suoo   

However, when i am trying to access data from mysql database, its producing error 

" mysql_connect(): Unknown MySQL server host 'mysql.service.dc1.consul' "

When i am trying to do the same using IPs instead of consul URL, then it works.

Note : I have disabled firewall and db's can be accessed using $telnet <ip-addr of remote mysql db> 3306

Armon Dadgar

unread,
Jul 6, 2015, 12:35:32 PM7/6/15
to consu...@googlegroups.com, Abhishek Bhatnagar
Hey Abhishek,

The process of converting a logical name like “mysql.service.dc1.consul” to an IP address
is done using DNS. Consul by default provides a DNS interface on port 8600. However,
you need to configure your systems to use Consul for DNS so that it can do the name resolution.

This depends on your operating system, but you need to change your default resolver to be
Consul, or setup your DNS server to forward the “.consul” domain to a Consul server.

Best Regards,
Armon Dadgar
--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/hashicorp/consul/issues
IRC: #consul on Freenode
---
You received this message because you are subscribed to the Google Groups "Consul" group.
To unsubscribe from this group and stop receiving emails from it, send an email to consul-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/consul-tool/d03ca767-ed99-465a-86df-4d41f50ffee7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Shawn Cook

unread,
Jul 7, 2015, 7:04:37 AM7/7/15
to consu...@googlegroups.com
Hi Abhishek,

Try the following commands.  If they are working correctly then you know that Consul is setup correctly and your DNS forwarding agent (e.g. dnsmasq) is not configured correctly.

curl localhost:8500/v1/catalog/services
dig @localhost -p 8600 mysql.service.consul

-Shawn
Reply all
Reply to author
Forward
0 new messages