github.com/lmb/consul@v1.4.1/command/snapshot/snapshot_command.go (about)

     1  package snapshot
     2  
     3  import (
     4  	"github.com/hashicorp/consul/command/flags"
     5  	"github.com/mitchellh/cli"
     6  )
     7  
     8  func New() *cmd {
     9  	return &cmd{}
    10  }
    11  
    12  type cmd struct{}
    13  
    14  func (c *cmd) Run(args []string) int {
    15  	return cli.RunResultHelp
    16  }
    17  
    18  func (c *cmd) Synopsis() string {
    19  	return synopsis
    20  }
    21  
    22  func (c *cmd) Help() string {
    23  	return flags.Usage(help, nil)
    24  }
    25  
    26  const synopsis = "Saves, restores and inspects snapshots of Consul server state"
    27  const help = `
    28  Usage: consul snapshot <subcommand> [options] [args]
    29  
    30    This command has subcommands for saving, restoring, and inspecting the state
    31    of the Consul servers for disaster recovery. These are atomic, point-in-time
    32    snapshots which include key/value entries, service catalog, prepared queries,
    33    sessions, and ACLs.
    34  
    35    If ACLs are enabled, a management token must be supplied in order to perform
    36    snapshot operations.
    37  
    38    Create a snapshot:
    39  
    40        $ consul snapshot save backup.snap
    41  
    42    Restore a snapshot:
    43  
    44        $ consul snapshot restore backup.snap
    45  
    46    Inspect a snapshot:
    47  
    48        $ consul snapshot inspect backup.snap
    49  
    50    Run a daemon process that locally saves a snapshot every hour (available only in
    51    Consul Enterprise) :
    52  
    53        $ consul snapshot agent
    54  
    55    For more examples, ask for subcommand help or view the documentation.
    56  `