hashicorp / consul

Consul is a distributed, highly available, and data center aware solution to connect and configure applications across dynamic, distributed infrastructure.
https://www.consul.io
Other
28.4k stars 4.43k forks source link

services can't be restored by snapshot #4212

Closed jackyhome0801 closed 6 years ago

jackyhome0801 commented 6 years ago

first, i register some services via /v1/agent/service/register API and put some key/values data in then i take "consul snapshot save backup.snap" command to get a snapshot file next, i stop consul agent and delete consul data directory to remove all consul data lastly, i start consul agent again and take "consul snapshot restore backup.snap" to restore data back

i found that key/values data can be restored, but unfortunately, services can't be restored when i query services via /v1/agent/services i also noticed that i can get services via /v1/catalog/services, but only last for seconds, soon or later, a deregister will be triggered and services will disappear for ever

MagnumOpus21 commented 6 years ago

Hi @jackyhome0801 . What you're seeing is the expected behavior of Consul. Anti-Entropy is responsible for this. An agent is the ultimate source of truth with respect to services, for a system. So, you'd have to re-register the service/s on that agent to register them to the catalogue, once again.