Noob Consul questions

After going through the guide and watching several Consul videos, I’m still unclear on certain aspects of it.

For example, the guide goes over manually registering a service, but it doesn’t give any examples of code that uses service discovery. How does that work? Once a service is registered with Consul, do I just use a normal language HTTP client to make one request to Consul and then another to one of the returned IP addresses? Do I use a special Consul language client instead? If so, should I cache the DNS for some period of time so that I’m not already making multiple HTTP requests all the time?

Hi @cashihorp,

Normally folks configure their operating system to forward DNS queries to Consul. Applications then use normal DNS names to query services in the service catalog. The HTTP interface is available when more advanced queries are needed.

See for examples of registering and querying services.

1 Like