Skip to main content
In this guide, you’ll learn how to back up and restore your Consul service state using snapshot commands. We’ll cover:
  • Creating a snapshot file
  • Inspecting snapshot metadata
  • Restoring a cluster from a snapshot
These steps are critical for disaster recovery and cluster portability.

Prerequisites

  • A running Consul server (open source) cluster
  • Consul CLI installed and in your $PATH
  • Permissions to read/write snapshot files
Ensure you have sufficient disk space in your working directory before creating large snapshots.

1. Taking a Snapshot

  1. SSH into one of your Consul server nodes.
  2. Change to a writable directory (e.g., /tmp):
  3. Run the save subcommand to generate a snapshot file:
  4. Confirm the operation:
  5. Verify the file exists:

2. Inspecting a Snapshot

To view metadata about an existing snapshot file, use the inspect subcommand:
Sample output:
  • The Version field refers to the snapshot format, not the Consul binary version.
  • Index and Term reflect the Raft state at snapshot creation.

3. Restoring a Snapshot

When recovering a failed cluster or migrating state, restore from your snapshot:
After the restore completes:
  1. Restart all Consul agents or services to load the restored data.
  2. Check cluster status:
Do not restore a snapshot into an active cluster without first stopping agents—this can lead to data corruption.

Snapshot Commands Reference



By following these steps, you can efficiently manage Consul snapshots, ensuring reliable backups and quick recovery for your service cluster.

Watch Video