DEV Community

Alex Spinov
Alex Spinov

Posted on

Consul Has a Free Service Discovery and Mesh Platform for Any Infrastructure

HashiCorp Consul provides service discovery, configuration, and segmentation for any runtime platform and cloud.

What You Get for Free

  • Service discovery — DNS and HTTP API
  • Health checking — automatic service monitoring
  • KV store — distributed configuration
  • Service mesh — mTLS between services via Connect
  • Multi-datacenter — WAN federation
  • ACLs — fine-grained access control

Quick Start

consul agent -dev
Enter fullscreen mode Exit fullscreen mode

UI at http://localhost:8500.

Register a Service

{
  "service": {
    "name": "web",
    "port": 8080,
    "check": {
      "http": "http://localhost:8080/health",
      "interval": "10s"
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Discover Services

dig @127.0.0.1 -p 8600 web.service.consul
curl http://localhost:8500/v1/catalog/service/web
Enter fullscreen mode Exit fullscreen mode

Consul vs etcd

Feature Consul etcd
Service discovery Built-in Manual
Health checks Built-in External
UI Built-in No
Service mesh Yes (Connect) No

Need service discovery setup? Check my work on GitHub or email spinov001@gmail.com for consulting.

Top comments (0)