Presentation of Consul Service Discovery for use-case in Alice O2 Quality Control and its Information Service. How to use Consul to share states of published data by processes.
8. !8
1. Register Service (once)
QC Information Service
2. Register health check (once)
Agent DAQ, TOF, etc.
3. Publish health status (+ listing)
Objects foo, bar, baz
4. Reading status from Consul
all agents and their objects
Steps for QC
14. !14
ok!
1. Register Service (once)
QC Information Service
2. Register health check (once)
Agent DAQ, TOF, etc.
3. Publish health status (+ listing)
Objects foo, bar, baz
4. Reading status from Consul
all agents and their objects
Steps for QC
15. Checklist O2 requirements
- provide API
- track status of services
- read status of services
- notify on service failure
!15
16. Notify on service failure
with "Consul watches"
Start command and add
notification handlers:
• http handler
POST http://QC.cern.ch
• command handler
/usr/bin/infologger
16
17. 17
consul watch -type=service -service=information-service /bin/cat
Notify on service failure
with "watches"
[...]"Name":"tof-agent","Status":"passing"[...]
[...]"Name":"tof-agent","Status":"critical"[...]
ttl => 6s
POST status
18. !18
Checklist O2 requirements
- provide API
- track status of services
- read status of services
- notify on service failure
19. !19
# names are required
# ids are names by default, must be unique
# list services
curl http://localhost:8500/v1/agent/services
# put one service
curl http://localhost:8500/v1/agent/service/register --request PUT --data '{"name":"information-service"}'
# put check
curl http://localhost:8500/v1/agent/check/register --request PUT --data '{"name":"daq-agent", "ttl": "6s", "serviceid":
"information-service"}'
curl http://localhost:8500/v1/agent/check/register --request PUT --data '{"name":"tof-agent", "ttl": "6s", "serviceid":
"information-service"}'
# update check status
curl http://localhost:8500/v1/agent/check/update/daq-agent --request PUT --data '{"status": "passing", "output": "daq/
_Event/trace,daq/_Event/log"}'
curl http://localhost:8500/v1/agent/check/update/tof-agent --request PUT --data '{"status": "passing", "output": "tof/
_Compute/map,tof/_Compute/reduce"}'
# list checks passing
curl http://localhost:8500/v1/health/state/passing
# watch changes
consul watch -type=service -service=information-service /bin/cat
Memo