Project

General

Profile

Actions

Consul » History » Revision 2

« Previous | Revision 2/7 (diff) | Next »
Peter Amstutz, 10/26/2016 12:49 AM


Consul

  1. Service packages have dependency on consul.
  2. Consul package runs automatically from systemd unit.
  3. Consul updates /etc/resolve.conf to use consul as DNS resolver (?)
  4. Packages provide /etc/consul.d/package.json (e.g. /etc/consul.d/keepproxy.json)

Each service must have a unique id, but may have a common name, for example:

{
  "service": {
    "id": "zzzzz-bi6l4-ydim6qekt9ut47f",
    "name": "keep",
    "port": 80
  }
}
{
  "service": {
    "id": "zzzzz-bi6l4-9e7boja2v94hfj5",
    "name": "keep",
    "port": 80
  }
}

A query on the "keep" service returns multiple nodes:

$ curl http://localhost:8500/v1/catalog/service/keep | jq .
[
  {
    "Node": "debian",
    "Address": "127.0.0.1",
    "TaggedAddresses": {
      "lan": "127.0.0.1",
      "wan": "127.0.0.1" 
    },
    "ServiceID": "zzzzz-bi6l4-9e7boja2v94hfj5",
    "ServiceName": "keep",
    "ServiceTags": [],
    "ServiceAddress": "",
    "ServicePort": 443,
    "ServiceEnableTagOverride": false,
    "CreateIndex": 7,
    "ModifyIndex": 7
  },
  {
    "Node": "debian",
    "Address": "127.0.0.1",
    "TaggedAddresses": {
      "lan": "127.0.0.1",
      "wan": "127.0.0.1" 
    },
    "ServiceID": "zzzzz-bi6l4-ydim6qekt9ut47f",
    "ServiceName": "keep",
    "ServiceTags": [],
    "ServiceAddress": "",
    "ServicePort": 80,
    "ServiceEnableTagOverride": false,
    "CreateIndex": 6,
    "ModifyIndex": 6
  }
]

Updated by Peter Amstutz over 7 years ago · 2 revisions