»Snapshot Operator HTTP API

»Generate Snapshot

This endpoint generates and returns an atomic, point-in-time snapshot of the Nomad server state for disaster recovery. Snapshots include all state managed by Nomad's Raft consensus protocol.

Snapshots are exposed as gzipped tar archives which internally contain the Raft metadata required to restore, as well as a binary serialized version of the Nomad server state. The contents are covered internally by SHA-256 hashes. These hashes are verified during snapshot restore operations. The structure of the archive is internal to Nomad and not intended to be used other than for restore operations. The archives are not designed to be modified before a restore.

MethodPathProduces
GET/v1/operator/snapshot200 application/x-gzip

The table below shows this endpoint's support for blocking queries and required ACLs.

Blocking QueriesACL Required
NOmanagement

»Parameters

  • stale - Specifies if the cluster should respond without an active leader. This is specified as a query string parameter.

»Sample Request

$ curl \
    -o snapshot.tgz \
    http://127.0.0.1:4646/v1/operator/snapshot
$ curl \    -o snapshot.tgz \    http://127.0.0.1:4646/v1/operator/snapshot

The above example results in a tarball named snapshot.tgz in the current working directory.

»Restore Snapshot

This endpoint restores a point-in-time snapshot of the Nomad server state.

Restores involve a potentially dangerous low-level Raft operation that is not designed to handle server failures during a restore. This operation is primarily intended to be used when recovering from a disaster, restoring into a fresh cluster of Nomad servers.

The body of the request should be a snapshot archive returned from a previous call to the GET method.

MethodPathProduces
PUT/v1/operator/snapshot200 text/plain (empty body)

The table below shows this endpoint's support for blocking queries and required ACLs.

Blocking QueriesACL Required
NOmanagement

»Sample Request

$ curl \
    --request PUT \
    --data-binary @snapshot.tgz \
    http://127.0.0.1:4646/v1/operator/snapshot
$ curl \    --request PUT \    --data-binary @snapshot.tgz \    http://127.0.0.1:4646/v1/operator/snapshot