HashiCorp/Consul

From Ever changing code
Jump to navigation Jump to search

Install

wget https://releases.hashicorp.com/consul/1.4.3/consul_1.4.3_linux_amd64.zip
unzip consul_1.4.3_linux_amd64.zip
sudo mv consul /usr/bin

Run consul

You need run at least one consul server 3-5 are recommended. All other agents do run in a client mode, it's very light weight process that :

  • register services
  • check healthchecks
  • forward queries to servers
  • agent needs to run on every node that is a part of a cluster

Run consul in dev mode where single server is also acting as a client:

consul agent -dev -node <consul_srv_name>
# -node is optional as by default hostname is used, but for OSX with period in it will case problems with dns queries


Consult will start listenig on following ports
Netid   State  Local Address:Port  
udp     UNCONN     127.0.0.1:8301  
udp     UNCONN     127.0.0.1:8302  
udp     UNCONN     127.0.0.1:8600  
tcp     LISTEN     127.0.0.1:8300  
tcp     LISTEN     127.0.0.1:8301  
tcp     LISTEN     127.0.0.1:8302  
tcp     LISTEN     127.0.0.1:8500  
tcp     LISTEN     127.0.0.1:8600


consul members
Node      Address         Status  Type    Build  Protocol  DC   Segment
u18gui-1  127.0.0.1:8301  alive   server  1.4.3  2         dc1  <all>

References