Spinning up a microservice discovery client
In a microservices architecture where multiple services are deployed, the service discovery client helps the application to find out the services they are dependent on, which can be either through DNS or HTTP. When we talk about service discovery clients one of the most common and famous is Consul
by HashiCorp, which we will be spinning up in this recipe.
Getting ready…
Verify whether Consul
is installed by executing the following command:
$ consul version Consul v0.8.5 Protocol 2 spoken by default, understands 2 to 3 (agent will automatically use protocol >2 when speaking to compatible agents)
How to do it…
Start consul agent
in server mode by executing the following command:
$ consul agent -dev
How it works…
Once the command has executed successfully the Consul agent starts running in server mode, giving us the following output:

We can also list the members of the Consul cluster by executing the following command:
$ consul members
This will give us...