Consul Snapshot Inspect
Command: consul snapshot inspect
The snapshot inspect
command is used to inspect an atomic, point-in-time
snapshot of the state of the Consul servers which includes key/value entries,
service catalog, prepared queries, sessions, and ACLs. The snapshot is read
from the given file.
Typically this is used with Consul self-contained Snapshot files obtained
using the consul snapshot
command or Snapshot
API. If the file provided is named
state.bin
however, the command will assume it is a raw raft snapshot in a
Consul server data directory and will attempt to read it directly. The
state.bin
file must still be in the same directory as it's associated
meta.json
file. This is useful for debugging data on live servers without
making a complete new snapshot via the CLI or API first.
The following fields are displayed when inspecting a snapshot:
ID
- A unique ID for the snapshot, only used for differentiation purposes.Size
- The size of the snapshot, in bytes.Index
- The Raft index of the latest log entry in the snapshot.Term
- The Raft term of the latest log entry in the snapshot.Version
- The snapshot format version. This only refers to the structure of the snapshot, not the data contained within.Each data type, size, and count within the read snapshot.
Usage
Usage: consul snapshot inspect [options] FILE
Examples
To inspect a snapshot from the file "backup.snap":
To get more details for a snapshot inspection from "backup.snap":
Please see the HTTP API documentation for more details about snapshot internals.
To inspect an internal snapshot directly from a Consul server data directory:
Command Options
-kvdetails
- Optional, provides a space usage breakdown for any KV data stored in Consul.-kvdepth
- Can only be used with-kvdetails
. Used to adjust the grouping level of keys. Defaults to 2.-kvfilter
- Can only be used with-kvdetails
. Used to specify a key prefix that excludes keys that don't match.-format
- Optional, allows from changing the output to JSON. Parameters accepted are "pretty" and "JSON".