Consul is a tool for discovering and configuring services in your infrastructure. It provides several key features like service discovery, health checking, KV store and multi datacenter support.
Consul is designed to be friendly to both the DevOps community and application developers, making it perfect for modern, elastic infrastructures.
First lets create four servers and install apache on three of them or any other services since we will do a service check in this article.
Let’s say we have the four servers as follow:
consul-01
and has a public IP 111.111.111.111
consul-02
and has a public IP 222.222.222.222
consul-03
and has a public IP 333.333.333.333
consul-04
and has a public IP 444.444.444.444
Now we need to install consul on all these servers:
apt-get update
apt-get install unzip
cd /usr/local/bin
wget https://releases.hashicorp.com/consul/1.0.2/consul_1.0.2_linux_amd64.zip
unzip *.zip
rm *.zip
Feel free to use the appropriate consul version, Here we use 1.0.2
. Also consul use some ports so you need to open these ports or you can configure these ports but this out of the scope of this part right now. For now let’s just open them and later we will talk about why these ports needed and how to configure:
sudo ufw allow 8300
sudo ufw allow 8301
sudo ufw allow 8302
sudo ufw allow 8400
sudo ufw allow 8500
sudo ufw allow 8600
Once you finihed, you can call consul
command and get a help stuff:
$ consul
Usage: consul [--version] [--help] <command> [<args>]
Available commands are:
agent Runs a Consul agent
catalog Interact with the catalog
#linux #microservices #scaling #consul #health-checking #kv-support #microservices #service-discovery