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
Command Options
-kvdetails
- Provides information about space usage for KV data stored in Consul.-kvdepth
- Adjusts the grouping levels of keys. Can only be used with-kvdetails
. Default is2
.-kvfilter
- Only keys that match the specified key prefix are included in the response. Can only be used with-kvdetails
.-format
- Specifies an output format for the response. Specifypretty
(default) to format the response in a human-readable form as shown in the examples below, or specifyJSON
to format the response as JSON.
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: