Blog HCP Consul on Azure goes GA, plus more Consul news from HashiConf EU Read more
  • Overview
    • Consul on Kubernetes
    • Control access with Consul API Gateway
    • Discover Services with Consul
    • Enforce Zero Trust Networking with Consul
    • Load Balancing with Consul
    • Manage Traffic with Consul
    • Multi-Platform Service Mesh with Consul
    • Network Infrastructure Automation with Consul
    • Observability with Consul
  • Enterprise
  • Tutorials
  • Docs
  • API
  • CLI
  • Community
GitHub
Download
Try HCP Consul
    • v1.13.x (latest)
    • v1.12.x
    • v1.11.x
    • v1.10.x
    • v1.9.x
    • v1.8.x
  • Commands (CLI)
    • Overview
      • Overview
      • create
      • delete
      • list
      • read
      • update
      • Overview
      • create
      • delete
      • list
      • read
      • update
    • bootstrap
      • Overview
      • create
      • delete
      • list
      • read
      • update
      • Overview
      • create
      • delete
      • list
      • read
      • update
    • set-agent-token
      • Overview
      • clone
      • create
      • delete
      • list
      • read
      • update
    • translate-rules
  • agent
    • Overview
    • datacenters
    • nodes
    • services
    • Overview
    • delete
    • list
    • read
    • write
    • Overview
    • ca
    • proxy
    • envoy
    • expose
    • redirect-traffic
  • debug
  • event
  • exec
  • force-leave
  • info
    • Overview
    • check
    • create
    • delete
    • get
    • list
    • match
  • join
  • keygen
  • keyring
    • Overview
    • delete
    • export
    • get
    • import
    • put
  • leave
  • license
  • lock
  • login
  • logout
  • maint
  • members
  • monitor
    • Overview
    • create
    • delete
    • list
    • read
    • update
    • write
    • Overview
    • area
    • autopilot
    • raft
  • partition
  • reload
  • rtt
    • Overview
    • register
    • deregister
    • Overview
    • agent
    • inspect
    • restore
    • save
    • Overview
    • ca
    • cert
  • validate
  • version
  • watch
Type '/' to Search

»Consul Snapshot

Command: consul snapshot

The snapshot command has subcommands for saving, restoring, and inspecting the state of the Consul servers for disaster recovery. These are atomic, point-in-time snapshots which include key/value entries, service catalog, prepared queries, sessions, and ACLs. This command is available in Consul 0.7.1 and later.

Snapshots are also accessible via the HTTP API.

»Usage

Usage: consul snapshot <subcommand>

For the exact documentation for your Consul version, run consul snapshot -h to view the complete list of subcommands.

Usage: consul snapshot <subcommand> [options] [args]

  # ...

Subcommands:

    agent      Periodically saves snapshots of Consul server state
    inspect    Displays information about a Consul snapshot file
    restore    Restores snapshot of Consul server state
    save       Saves snapshot of Consul server state
Usage: consul snapshot <subcommand> [options] [args]

  # ...

Subcommands:

    agent      Periodically saves snapshots of Consul server state
    inspect    Displays information about a Consul snapshot file
    restore    Restores snapshot of Consul server state
    save       Saves snapshot of Consul server state

For more information, examples, and usage about a subcommand, click on the name of the subcommand in the sidebar or one of the links below:

  • agent
    Enterprise
  • inspect
  • restore
  • save

»Basic Examples

To create a snapshot and save it as a file called "backup.snap":

$ consul snapshot save backup.snap
Saved and verified snapshot to index 8419
$ consul snapshot save backup.snap
Saved and verified snapshot to index 8419

To restore a snapshot from a file called "backup.snap":

$ consul snapshot restore backup.snap
Restored snapshot
$ consul snapshot restore backup.snap
Restored snapshot

To inspect a snapshot from the file "backup.snap":

$ consul snapshot inspect backup.snap
ID           2-5-1477944140022
Size         667
Index        5
Term         2
Version      1
$ consul snapshot inspect backup.snap
ID           2-5-1477944140022
Size         667
Index        5
Term         2
Version      1

To run a daemon process that periodically saves snapshots

Enterprise

$ consul snapshot agent
$ consul snapshot agent

For more examples, ask for subcommand help or view the subcommand documentation by clicking on one of the links in the sidebar.

github logoEdit this page
IntroGuidesDocsCommunityPrivacySecurityBrandConsent Manager