Skip to content

Commit

Permalink
NET 1594 - Snapshot Agent Filename Should Include Consul Version / Da…
Browse files Browse the repository at this point in the history
…tacenter (#18625)

* init

* tests added and few fixes

* revert arg message

* changelog added

* removed var declaration

* fix CI

* fix test

* added node name and status

* updated save.mdx

* added example

* fix tense

* fix description
  • Loading branch information
absolutelightning committed Sep 4, 2023
1 parent a5bafa7 commit 819b2fb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 2 additions & 2 deletions command/snapshot/save/snapshot_save.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ type cmd struct {

func (c *cmd) getAppendFileNameFlag() *flag.FlagSet {
fs := flag.NewFlagSet("", flag.ContinueOnError)
fs.Var(&c.appendFileNameFlag, "append-filename", "Append filename flag takes two possible values. "+
"1. version, 2. dc. 3. node 5. status. It appends consul version and datacenter to filename given in command")
fs.Var(&c.appendFileNameFlag, "append-filename", "Append filename flag supports the following "+
"comma-separated arguments. 1. version, 2. dc. 3. node 4. status. It appends these values to the filename provided in the command")
return fs
}

Expand Down
11 changes: 11 additions & 0 deletions website/content/commands/snapshot/save.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,17 @@ $ consul snapshot save -stale backup.snap
# ...
```

To create snapshot file with consul version, datacenter, node name and leader/follower info,
run

```shell-session
$ consul snapshot save -append-filename node,status,version,dc backup.snap
#...
```

File name created will be like backup-%CONSUL_VERSION%-%DC_NAME%-%NODE_NAME%-%STATUS.snap
example - backup-1.17.0-dc1-local-machine-leader.tgz

This is useful for situations where a cluster is in a degraded state and no
leader is available. To target a specific server for a snapshot, you can run
the `consul snapshot save` command on that specific server.
Expand Down

0 comments on commit 819b2fb

Please sign in to comment.