20

I'm evaluating a few distributed key-value stores, and etcd and Consul looks both very promising. I am interested in service discovery, health monitoring and config services.

I like the extra features that Consul gives, but I cannot determine whether it persists the Key-Value store when the service goes down? It seems that etcd offers persistence. Any advice?

Pieter
  • 2,143
  • 3
  • 14
  • 13

3 Answers3

19

Consul agents (cilent & server) persist data into data-dir.

The only case where agent doesn't persist data is where its started in "-dev" mode.

Mistriel
  • 459
  • 4
  • 9
10

I ended up running the progrium/docker-consul image on Docker and adding some key-value pairs. After shutting it down with Ctrl-C, the values were still there when I restarted the container. I also killed Consul from the command line via docker exec, and the data was also persisted.

The progrium/docker-consul image persisted all the data in the /data directory.

Pieter
  • 2,143
  • 3
  • 14
  • 13
2

From one of core Consul developers message on github:

Any API-registered services and checks also get their configuration written into data-dir for persistence between agent restarts, so their configuration would be lost if this directory was lost between Consul restarts. This doesn't apply to services/checks created in the static configuration JSON files of course.

So, in case of graceful cluster node shutdown, key-value store saved to data directory.

In case of unexpected node shutdown (halt) I didn't find whether it persists KV store to data dir.

v.karbovnichy
  • 3,183
  • 2
  • 36
  • 47