docker-consul icon indicating copy to clipboard operation
docker-consul copied to clipboard

Can we have a persistent storage for the key-value store?

Open ashish235 opened this issue 9 years ago • 3 comments

I know that with consul we have fault tolerance, but there maybe a possibility where all my consul servers are going down together. Then in that scenario, I will loose all the configuration I have stored in the K/V store.

Does the -v /mnt:/data also gives persistence to the data in my K/V store?

ashish235 avatar Jul 16 '15 07:07 ashish235

Is there any update for this question.

mpresh avatar Sep 19 '16 02:09 mpresh

Mounting a host volume in as the /data directory will persist the data when consul is restarted in a rolling fashion. The key-value data is persisted in this directory; the details are mentioned in https://groups.google.com/forum/#!msg/consul-tool/QHA_t9DR5LQ/gPitNrlvIwAJ

As you know, consul can get into a broken state when servers are not restarted in a rolling fashion. This is the behavior of consul itself, and not particular to this image, so in performing outage recovery, consult the guide at https://www.consul.io/docs/guides/outage.html

The google groups thread I linked above includes some comments/recommendations on the topic of backing up the K/V store, and when this is relevant/recommended.

In any case, the immediate answer is: yes, your K/V data is persisted in the data directory, so if you would like it to be persistent across several containers, use a shared volume of some sort.

ianmcorvidae avatar Oct 10 '16 21:10 ianmcorvidae

Can this /data volume info be added to a README.md somewhere?

ghost avatar Jul 21 '17 00:07 ghost