Methods of discovery – no lawyers required
Whenever I hear the term discovery, I can't help but think about all of the lawyer shows and movies that reference the process. Thankfully, we don't require lawyers as part of the discovery process, but there are several methods available to discover what services our catalog offers. Let's see some of them in the following sections.
DNS
The easiest way for any application to discover the location of services is the same way they've been doing it for years, utilizing DNS. By default, Consul offers DNS on port 8600
on every agent within the Consul cluster. Every node and service can be queried utilizing a Consul domain. For example, if we want to find the address(es) for the nodes hosting the httpd
service, we can execute the following command (using the IP address of a Consul node, of course):
$ dig @192.168.100.20 -p 8600 httpd.service.consul
Focusing on the answer section of the query, we can validate...