github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/website/content/api-docs/operator/snapshot.mdx (about) 1 --- 2 layout: api 3 page_title: Snapshot - Operator - HTTP API 4 description: |- 5 The /operator/snapshot endpoints save and restore Nomad's server state for disaster recovery. 6 --- 7 8 # Snapshot Operator HTTP API 9 10 ## Generate Snapshot 11 12 This endpoint generates and returns an atomic, point-in-time snapshot of the 13 Nomad server state for disaster recovery. Snapshots include all state managed by Nomad's 14 Raft [consensus protocol](/docs/concepts/consensus). 15 16 Snapshots are exposed as gzipped tar archives which internally contain the Raft 17 metadata required to restore, as well as a binary serialized version of the 18 Nomad server state. The contents are covered internally by SHA-256 hashes. 19 These hashes are verified during snapshot restore operations. The structure of 20 the archive is internal to Nomad and not intended to be used other than for 21 restore operations. The archives are not designed to be modified before a 22 restore. 23 24 | Method | Path | Produces | 25 | :----- | :---------------------- | ------------------------ | 26 | `GET` | `/v1/operator/snapshot` | `200 application/x-gzip` | 27 28 The table below shows this endpoint's support for 29 [blocking queries](/api-docs#blocking-queries) and 30 [required ACLs](/api-docs#acls). 31 32 | Blocking Queries | ACL Required | 33 | ---------------- | ------------ | 34 | `NO` | `management` | 35 36 ### Parameters 37 38 - `stale` - Specifies if the cluster should respond without an active leader. 39 This is specified as a query string parameter. 40 41 ### Sample Request 42 43 ```shell-session 44 $ curl \ 45 -o snapshot.tgz \ 46 http://127.0.0.1:4646/v1/operator/snapshot 47 ``` 48 49 The above example results in a tarball named `snapshot.tgz` in the current working directory. 50 51 ## Restore Snapshot 52 53 This endpoint restores a point-in-time snapshot of the Nomad server state. 54 55 Restores involve a potentially dangerous low-level Raft operation that is not 56 designed to handle server failures during a restore. This operation is primarily 57 intended to be used when recovering from a disaster, restoring into a fresh 58 cluster of Nomad servers. 59 60 The body of the request should be a snapshot archive returned from a previous 61 call to the `GET` method. 62 63 | Method | Path | Produces | 64 | :----- | :---------------------- | ----------------------------- | 65 | `PUT` | `/v1/operator/snapshot` | `200 text/plain (empty body)` | 66 67 The table below shows this endpoint's support for 68 [blocking queries](/api-docs#blocking-queries) and 69 [required ACLs](/api-docs#acls). 70 71 | Blocking Queries | ACL Required | 72 | ---------------- | ------------ | 73 | `NO` | `management` | 74 75 ### Sample Request 76 77 ```shell-session 78 $ curl \ 79 --request PUT \ 80 --data-binary @snapshot.tgz \ 81 http://127.0.0.1:4646/v1/operator/snapshot 82 ``` 83 84 ~> Some tools default to www/encoded uploads. Nomad expects the snapshot to be 85 in pure binary form.