curl http://localhost:8500/v1/catalog/service/rabbitmq | python -m json.tool
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 337 100 337 0 0 57128 0 --:--:-- --:--:-- --:--:-- 67400
[
{
"Address": "10.100.1.68",
"CreateIndex": 9,
"ID": "0434e5f3-9e3a-3cc2-97ac-46b0c312a783",
"ModifyIndex": 9,
"Node": "mac",
"NodeMeta": {},
"ServiceAddress": "mac",
"ServiceEnableTagOverride": false,
"ServiceID": "rabbitmq:mac",
"ServiceName": "rabbitmq",
"ServicePort": 5672,
"ServiceTags": [],
"TaggedAddresses": {
"lan": "10.100.1.68",
"wan": "10.100.1.68"
}
}
]
stop the node, after ~ 30s you will see:
2017/03/16 13:45:39 [WARN] agent: Check 'service:rabbitmq:mac' missed TTL, is now critical
2017/03/16 13:45:39 [INFO] agent: Synced check 'service:rabbitmq:mac'
and after ~60 seconds you will see:
2017/03/16 13:47:01 [INFO] agent: Check "service:rabbitmq:mac" for service "rabbitmq:mac" has been critical for too long; deregistered service
2017/03/16 13:47:01 [INFO] agent: Deregistered check 'service:rabbitmq:mac'
Fixes https://github.com/aweber/rabbitmq-autocluster/issues/136
consul_deregister_after
is a wrapper for the consul commandderegister_critical_service_after
Param values:
consul_deregister_after
( config file )CONSUL_DEREGISTER_AFTER
( Environment variable )Default value: "" =
undefined
How to test it: 1.
2. Check the RabbitMQ registration on Consul:
and after ~60 seconds you will see:
and the service is removed from consul
Note: I put this log because (for my side) does not make sense to enable the
deregister_critical_service_after
param withoutTTL