-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cli: unhide advanced operator raft debugging commands (#11682)
The `nomad operator raft` and `nomad operator snapshot state` subcommands for inspecting on-disk raft state were hidden and undocumented. Expose and document these so that advanced operators have support for these tools.
- Loading branch information
Showing
13 changed files
with
218 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:improvement | ||
cli: Made the `operator raft info`, `operator raft logs`, `operator raft state`, and `operator snapshot state` commands visible to command line help. | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
layout: docs | ||
page_title: 'Commands: operator raft info' | ||
description: | | ||
Display Raft server state. | ||
--- | ||
|
||
# Command: operator raft info | ||
|
||
The `raft info` command is used to display summary information about the | ||
raft logs persisted in the Nomad [data directory]. | ||
|
||
This command requires file system permissions to access the data | ||
directory on disk. The Nomad server locks access to the data | ||
directory, so this command cannot be run on a data directory that is | ||
being used by a running Nomad server. | ||
|
||
~> **Warning:** This is a low-level debugging tool and not subject to | ||
Nomad's usual backward compatibility guarantees. | ||
|
||
## Usage | ||
|
||
```plaintext | ||
nomad operator raft info <path to data dir> | ||
``` | ||
|
||
## Examples | ||
|
||
An example output is as follows: | ||
|
||
```shell-session | ||
$ sudo nomad operator raft info /var/nomad/data | ||
path: /var/nomad/data/server/raft/raft.db | ||
length: 10 | ||
first index: 1 | ||
last index: 10 | ||
``` | ||
|
||
[data directory]: /docs/configuration#data_dir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- | ||
layout: docs | ||
page_title: 'Commands: operator raft logs' | ||
description: | | ||
Display Raft server state. | ||
--- | ||
|
||
# Command: operator raft logs | ||
|
||
The `raft logs` command is used to display the log entries persisted in | ||
the Nomad [data directory] in JSON format. | ||
|
||
This command requires file system permissions to access the data | ||
directory on disk. The Nomad server locks access to the data | ||
directory, so this command cannot be run on a data directory that is | ||
being used by a running Nomad server. | ||
|
||
~> **Warning:** This is a low-level debugging tool and not subject to | ||
Nomad's usual backward compatibility guarantees. | ||
|
||
## Usage | ||
|
||
```plaintext | ||
nomad operator raft logs [options] <path to data dir> | ||
``` | ||
|
||
## Examples | ||
|
||
The output of this command can be very large, so it's recommended that | ||
you redirect the output to a file for later examination with other | ||
tools. | ||
|
||
```shell-session | ||
$ sudo nomad operator raft logs /var/nomad/data > ~/raft-logs.json | ||
$ jq . < ~/raft-logs.json | ||
``` | ||
|
||
[data directory]: /docs/configuration#data_dir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
--- | ||
layout: docs | ||
page_title: 'Commands: operator raft state' | ||
description: | | ||
Display Raft server state. | ||
--- | ||
|
||
# Command: operator raft state | ||
|
||
The `raft state` command is used to display the server state obtained by | ||
replaying raft log entries persisted in the Nomad [data directory] in | ||
JSON format. | ||
|
||
This command requires file system permissions to access the data | ||
directory on disk. The Nomad server locks access to the data | ||
directory, so this command cannot be run on a data directory that is | ||
being used by a running Nomad server. | ||
|
||
~> **Warning:** This is a low-level debugging tool and not subject to | ||
Nomad's usual backward compatibility guarantees. | ||
|
||
## Usage | ||
|
||
```plaintext | ||
nomad operator raft state [options] <path to data dir> | ||
``` | ||
|
||
## Raft State Options | ||
|
||
- `-last-index=<last_index>`: Set the last log index to be applied, to | ||
drop spurious log entries not properly committed. If the | ||
`last_index` option is zero or negative, it's treated as an offset | ||
from the last index seen in raft. | ||
|
||
## Examples | ||
|
||
The output of this command can be very large, so it's recommended that | ||
you redirect the output to a file for later examination with other | ||
tools. | ||
|
||
```shell-session | ||
$ sudo nomad operator raft state /var/nomad/data > ~/raft-state.json | ||
$ jq . < ~/raft-state.json | ||
``` | ||
|
||
[data directory]: /docs/configuration#data_dir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- | ||
layout: docs | ||
page_title: 'Commands: operator snapshot state' | ||
description: | | ||
Displays a JSON representation of a Raft snapshot. | ||
--- | ||
|
||
# Command: operator snapshot state | ||
|
||
Displays a JSON representation of state in a raft snapshot on disk. | ||
|
||
~> **Warning:** This is a low-level debugging tool and not subject to | ||
Nomad's usual backward compatibility guarantees. | ||
|
||
## Usage | ||
|
||
```plaintext | ||
nomad operator snapshot state <file> | ||
``` | ||
|
||
## Examples | ||
|
||
The output of this command can be very large, so it's recommended that | ||
you redirect the output to a file for later examination with other | ||
tools. | ||
|
||
```shell-session | ||
$ nomad operator snapshot state backup.snap > ~/raft-state.json | ||
$ jq . < ~/raft-state.json | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters