# Nodetool backup

**backup** - Copy SSTables from a specified keyspace’s snapshot to a designated bucket in object storage

Note that status of backup can be checked for `user_task_ttl` seconds after the operation is done.
You can set the ttl using [nodetool tasks user-ttl](https://docs.scylladb.com/manual/master/operating-scylla/nodetool-commands/tasks/user-ttl.md).
If `--nowait` flag is not set, the command relies on `user_task_ttl` internally.

## Syntax

```console
nodetool [(-h <host> | --host <host>)] [(-p <port> | --port <port>)] backup
            --keyspace <keyspace> --table <table>
            [--snapshot <snapshot>]
            --endpoint <endpoint> --bucket <bucket> --prefix <prefix>
            [--nowait]
            [--move-files]
```

## Example

```console
nodetool backup --endpoint s3.us-east-2.amazonaws.com  --bucket bucket-foo --prefix foo/bar/baz --keyspace ks --table table --snapshot ss --move-files
```

## Options

* `-h <host>` or `--host <host>` - Node hostname or IP address.
* `--keyspace` - Name of a keyspace to copy SSTables from
* `--table` - Name of a table to copy SSTables from
* `--snapshot` - Name of a snapshot to copy sstables from
* `--endpoint` - Name of the configured object storage endpoint to copy SSTables to.
  This should be configured as per [the object storage configuration instructions](https://docs.scylladb.com/manual/master/operating-scylla/admin.md#object-storage-configuration).
* `--bucket` - Name of the bucket to backup SSTables to
* `--prefix` - Prefix to backup SSTables to
* `--nowait` - Don’t wait on the backup process
* `--move-files` - Move files instead of copying them. This will delete the files from the local disk after they are uploaded to the object storage.

# Nodetool cluster backup

**cluster backup** - Copy SSTables from a specified snapshot to a designated bucket in object storage

Note that status of backup can be checked for `user_task_ttl` seconds after the operation is done.
You can set the ttl using [nodetool tasks user-ttl](https://docs.scylladb.com/manual/master/operating-scylla/nodetool-commands/tasks/user-ttl.md).
If `--nowait` flag is not set, the command relies on `user_task_ttl` internally.

## Syntax

```console
nodetool [(-h <host> | --host <host>)] [(-p <port> | --port <port>)] cluster backup
            [--keyspace <keyspace>] --table <table>
            [--snapshot <snapshot>]
            --location <dc>,<endpoint>,<bucket>(,<prefix>)
            [--location <dc2>,<endpoint2>,<bucket2>(,<prefix2>)]...
            [--nowait]
            [--move-files]
            [... keyspaces ...]
```

## Example

```console
nodetool cluster backup --locations mydc,s3.us-east-2.amazonaws.com,bucket-foo,foo/bar/baz --keyspace ks --table table --snapshot ss --move-files
```

## Options

* `-h <host>` or `--host <host>` - Node hostname or IP address.
* `--keyspace` - Name of a keyspace to copy SSTables from
* `--table` - Name of a table to copy SSTables from
* `--snapshot` - Name of a snapshot to copy sstables from
* `--locations` - Tuple of <dc>,<endpoint>,<bucket> and optional <prefix> which to write the backup. This is set per DC
  Endpoints should be configured as per [the object storage configuration instructions](https://docs.scylladb.com/manual/master/operating-scylla/admin.md#object-storage-configuration).
* `--nowait` - Don’t wait on the backup process
* `--move-files` - Move files instead of copying them. This will delete the files from the local disk after they are uploaded to the object storage.

See also

[Nodetool restore](https://docs.scylladb.com/manual/master/operating-scylla/nodetool-commands/restore.md)

[Nodetool Reference](https://docs.scylladb.com/manual/master/operating-scylla/nodetool.md)
