Does Consul persist the Key Value store?

13.6k views Asked by At

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?

3

There are 3 answers

0
Pieter On BEST ANSWER

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.

0
v.karbovnichy On

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.

0
Mistriel On

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.