---
metadata:
  - name: generator
    content: Diplodoc Platform v5.50.6
alternate:
  - https://ydb.tech/docs/en/devops/backup-and-recovery.md?version=main
  - https://ydb.tech/docs/ru/devops/backup-and-recovery.md?version=main
sourcePath: en/core/devops/backup-and-recovery/index.md
---
> **Documentation Index:** Fetch the complete configuration index at https://ydb.tech/docs/en/llms.txt

# Backup and recovery

YDB is initially designed for data safety in case of hardware failures: redundancy options are available for different numbers of availability zones, racks, hosts, disks, and other components (see [cluster operating modes](https://ydb.tech/docs/en/concepts/topology.md?version=main#cluster-config)). This reduces the risk of data loss due to hardware failures.

However, data can be lost or corrupted **logically**: errors or malicious actions can lead to mass deletion/corruption of data by operations legitimate for the DBMS. In such cases, cluster fault tolerance does not replace a **separate copy** of data outside the cluster.

Backup is used to protect against such scenarios and allows restoring data from a backup. It is recommended to store copies on a separate medium or in cloud object storage (for example, via [export to files](#files) or [export to S3](#s3)).

YDB provides several solutions for performing backup and recovery. For conceptual information and comparison of backup methods, see [backup concepts](https://ydb.tech/docs/en/concepts/backup.md?version=main).

<!-- source: en/devops/_includes/backup_and_recovery/options_overlay.md -->
* Backup to files and recovery using the YDB CLI.
* Backup to S3-compatible storage and recovery using the YDB CLI.
* Backup of system tablets to the local file system of cluster hosts.
<!-- endsource: en/devops/_includes/backup_and_recovery/options_overlay.md -->

## YDB CLI {#cli}

### Files {#files}

The following commands are used for backup to files:

- `ydb admin cluster dump` — for backing up cluster metadata
- `ydb admin database dump` — for backing up the database
- `ydb tools dump` — for backing up individual schema objects or directories

Learn more about these commands in [Exporting data to the file system](https://ydb.tech/docs/en/reference/ydb-cli/export-import/tools-dump.md?version=main).

The following commands are used for restoration from a file backup:

- `ydb admin cluster restore` — for restoring cluster metadata from a backup
- `ydb admin database restore` — for restoring the database from a backup
- `ydb tools restore` — for restoring individual schema objects or directories from a backup

Learn more about these commands in [Importing data from the file system](https://ydb.tech/docs/en/reference/ydb-cli/export-import/tools-restore.md?version=main).

### S3-compatible storage {#s3}

To perform backup to an S3-compatible storage (for example, [AWS S3](https://docs.aws.amazon.com/AmazonS3/latest/dev/Introduction.html)), the `ydb export s3` command is used. Follow [the link](https://ydb.tech/docs/en/reference/ydb-cli/export-import/export-s3.md?version=main) to the YDB CLI reference for information about this command.

To perform restoration from a backup created in an S3-compatible storage, the `ydb import s3` command is used. Follow [the link](https://ydb.tech/docs/en/reference/ydb-cli/export-import/import-s3.md?version=main) to the YDB CLI reference for information about this command.

### NFS {#nfs}

To perform backup to [NFS](https://en.wikipedia.org/wiki/Network_File_System) on hosts where YDB is running, the `ydb export nfs` command is used. Follow [the link](https://ydb.tech/docs/en/reference/ydb-cli/export-import/export-nfs.md?version=main) to the YDB CLI reference for information about this command.

To perform restoration from a backup created in [NFS](https://en.wikipedia.org/wiki/Network_File_System) on hosts where YDB is running, the `ydb import nfs` command is used. Follow [the link](https://ydb.tech/docs/en/reference/ydb-cli/export-import/import-nfs.md?version=main) to the YDB CLI reference for information about this command.

For more details on configuring NFS for backup and recovery, see the recipe [Backup and recovery via NFS](https://ydb.tech/docs/en/recipes/nfs-backup/nfs-backup.md?version=main).

{% note info %}

The speed of backup and restore operations to/from S3-compatible storage or NFS is tuned to minimize the impact on user load. To control the operation speed, configure limits for the corresponding queue of the [resource broker](https://ydb.tech/docs/en/reference/configuration/resource_broker_config.md?version=main#resource-broker-config).

{% endnote %}

{% note info %}

When performing an export, a directory named `export_*` is created in the root directory of the database, where `*` is the numeric part of the export identifier. This directory contains tables that hold a consistent snapshot of the exported data at the time the export started. After the backup operation completes successfully, the `export_*` directory along with its contents is deleted.

{% endnote %}

## Backup collections {#backup-collections}

Backup collections provide incremental backup and point-in-time recovery for production workloads. For conceptual information and architecture details, see [Backup collections](https://ydb.tech/docs/en/concepts/datamodel/backup-collection.md?version=main).

Backup collections are recommended for production environments with a regular backup schedule and large datasets where incremental changes are significantly smaller than the total volume. For simpler scenarios (one-time migrations, development environments, small databases), consider using [export/import](#s3) or [dump/restore](#files).

For step-by-step instructions on configuring and using backup collections, see:

- [Backup collections](https://ydb.tech/docs/en/concepts/datamodel/backup-collection.md?version=main) — architecture, concepts, and limitations
- [Recipes for backup collections](https://ydb.tech/docs/en/recipes/backup-collections/index.md?version=main) — typical scenarios and examples





## Backup of system tablets {#system-tablet-backup}

The system tablet backup mechanism provides incremental copying of cluster metadata to the local file system of the cluster hosts.

For conceptual information and how it works, see [Backup concepts](https://ydb.tech/docs/en/concepts/backup.md?version=main#comparison).

For step-by-step instructions on enabling and restoring, see [Recipes for system tablet backup](https://ydb.tech/docs/en/recipes/system-tablet-backup/index.md?version=main).
