Linux

Where Does Consul Store Data and Config?

Consul cluster state files and agent HCL config folders on Linux for service discovery and KV store use.

Last updated

Consul keeps cluster state in a data directory. Package installs default to /var/lib/consul with Raft and serf snapshots inside. Agent configs live in /etc/consul.d as HCL or JSON files.

Those config files set data_dir, encryption, and join addresses. Snapshots bundle KV and catalog for moves. Back up the data folder with configs and regular snapshots. Restoring clusters needs matching encryption keys. Health checks gate traffic to sick nodes. Connect mode adds mutual TLS between services. DNS answers service lookups.

Where Consul stores this, by platform

Linux
/var/lib/consul

Raft state and serf snapshots for the agent. Stop the agent before copying for consistency. Snapshots complement raw folder copies.

Linux
/etc/consul.d

Agent HCL configs with data_dir and join settings. Restrict read access since gossip keys live here. Keep with data backups.

Frequently asked questions

what do i back up for a Consul agent move

Copy /var/lib/consul with /etc/consul.d for single node restores. The data folder holds Raft state. Configs hold join and encryption settings. Clustered restores need quorum care.

how do i snapshot Consul without stopping it

Take snapshots with consul snapshot save to a file anywhere. Snapshots capture KV and catalog state. The data folder holds the live copy. Snapshots travel best for migrations.

Notice an outdated path? Let us know.