Setting up Consul using Docker
So far in this chapter, we've talked about the need for service discovery and load balancing. We also learned how to use Zookeeper to perform service discovery and load balancing. If you've tried the previous recipes in this chapter, you will have realized it requires some effort to manage your services in Zookeeper. It also requires some code to be written. In the next few recipes, we will learn to do the same thing with Consul. Consul is a service-discovery framework from HashiCorp that is multi-datacenter aware. One very useful feature Consul comes with is distributed key-value storage. This is really useful when you want to store configuration information. In this recipe, we will learn how to orchestrate Consul using Docker.
Getting ready
HashiCorp has released official images of consul and their other products. So this recipe is going to be pretty straightforward.
The easiest way to start Consul is by executing a
docker run
command with the image name.The...