Difficulty: Beginner
Estimated Time: 10 minutes

This scenario explains what is Hashicorp's Consul and covers the basics of its main functionalities:

  • service registration and discovery
  • health check
  • key-value store

Consul is distributed system where agent nodes communicate with server nodes:

  • Servers are responsible to maintain the cluster' state

  • An agent is responsible to perform health checks of the node it's running on and also of the services running on that node

A typical production setup is composed of an odd number of servers (3, 5, ...) to ensure the cluster is still running in case a node fails.

In this scenario, we will use a development configuration to quickly setup a Consul cluster.

Don’t stop now! The next scenario will only take about 10 minutes to complete.

Hashicorp Consul

Step 1 of 6

Step 1 - Running Consul in development mode

Consul is a static binary written in Go. Once downloaded, it just need to be run with a couple of options.

To keep it simple, we will run Consul in development mode, this allows to have a cluster quickly. This mode must not be used for production though.

consul agent -dev -client=0.0.0.0

In the development mode, the ui option is provided and allows to get Consul's UI at the following location:

http://[[HOST_SUBDOMAIN]]-8500-[[KATACODA_HOST]].environments.katacoda.com/ui

By default, only the Consul service is listed here, we will add an additional service in the following steps.