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