consul/website/pages/commands/snapshot/inspect.mdx

130 lines
3.1 KiB
Plaintext
Raw Normal View History

2020-04-07 18:55:19 +00:00
---
layout: commands
2020-04-07 18:55:19 +00:00
page_title: 'Commands: Snapshot Inspect'
sidebar_title: inspect
2020-04-07 18:55:19 +00:00
---
# 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.
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.
2020-04-07 18:55:19 +00:00
## Usage
Usage: `consul snapshot inspect [options] FILE`
## Examples
To inspect a snapshot from the file "backup.snap":
2020-05-19 18:32:38 +00:00
```shell-session
2020-04-07 18:55:19 +00:00
$ consul snapshot inspect backup.snap
ID 2-13-1603221729747
Size 5141
Index 13
Term 2
Version 1
Type Count Size
---- ---- ----
Register 3 1.7KB
ConnectCA 1 1.2KB
ConnectCAProviderState 1 1.1KB
Index 12 344B
Autopilot 1 199B
ConnectCAConfig 1 197B
FederationState 1 139B
SystemMetadata 1 68B
ChunkingState 1 12B
---- ---- ----
Total 5KB
```
To enhance a snapshot inespection from "backup.snap":
```shell-session
$ consul snapshot inspect -format=json backup.snap
{
"Meta": {
"ID": "2-13-1603221729747",
"Size": 5141,
"Index": 13,
"Term": 2,
"Version": 1
},
"Stats": [
{
"Name": "Register",
"Sum": 1750,
"Count": 3
},
{
"Name": "ConnectCA",
"Sum": 1258,
"Count": 1
},
{
"Name": "ConnectCAProviderState",
"Sum": 1174,
"Count": 1
},
{
"Name": "Index",
"Sum": 344,
"Count": 12
},
{
"Name": "Autopilot",
"Sum": 199,
"Count": 1
},
{
"Name": "ConnectCAConfig",
"Sum": 197,
"Count": 1
},
{
"Name": "FederationState",
"Sum": 139,
"Count": 1
},
{
"Name": "SystemMetadata",
"Sum": 68,
"Count": 1
},
{
"Name": "ChunkingState",
"Sum": 12,
"Count": 1
}
],
"TotalSize": 5141
}
2020-04-07 18:55:19 +00:00
```
2020-04-09 23:46:54 +00:00
Please see the [HTTP API](/api/snapshot) documentation for
more details about snapshot internals.
#### Command Options
- `-format` - Optional, allows from changing the output to JSON. Parameters accepted are "pretty" and "JSON".