Backup Concepts
YDB ensures data durability against hardware failures through replication and fault tolerance. However, replication does not protect against logical errors: an accidental DROP TABLE, an erroneous bulk UPDATE, or DELETE will be replicated to all copies. To protect against such scenarios, you need backups — separate copies of data that you can restore from.
Full backups
A full backup is a snapshot of table data at a specific point in time. YDB provides several ways to create full backups, from simple to more feature-rich.
Copying tables within the cluster
The simplest approach is to create a copy of one or more tables within the same cluster using ydb tools copy. The copy is created atomically from a consistent snapshot using a copy-on-write mechanism, making the operation fast.
Suitable for:
- creating a quick safety copy before a risky operation
- cloning data for testing
Warning
The copy is stored in the same cluster as the source data. It protects against logical errors but not against cluster loss.
Dump to filesystem
The ydb tools dump and ydb tools restore commands allow you to export data to the local filesystem and restore it back.
Suitable for:
- local development and testing
- small databases
- creating a copy on a separate storage medium
Export to S3-compatible storage
The ydb export s3 and ydb import s3 commands allow you to export and import data to external S3-compatible storage.
Suitable for:
- disaster recovery (data is stored outside the cluster)
- data migration between clusters
- long-term archival
Incremental backups
For large tables, repeatedly creating full backups can be too expensive. Incremental backups solve this: after an initial full backup, each subsequent increment captures only the changes (inserts, updates, deletes) that occurred since the previous backup.
Incremental backups are organized into a chain:
Full backup → Increment₁ → Increment₂ → ... → Incrementₙ
Restoration requires the entire chain: the full backup is applied first, then all increments in sequence. Recovery restores data to the state at the time of the last increment in the chain.
Incremental backups are implemented using backup collections.
Note
Currently only row-oriented tables are supported.
Backup collections
For details on backup collections, see Backup collections.
Comparison
|
Method |
Storage location |
Incremental |
Use cases |
|
In cluster |
No |
Quick copy before a risky operation |
|
|
Filesystem |
No |
Development, testing, small databases |
|
|
S3-compatible storage |
No |
Disaster recovery, migration, archival |
|
|
In cluster (exportable to S3 or filesystem) |
Yes |
Regular backups of large production databases |
See Also
- Backup collections — architecture and limitations
- Backup and Recovery — practical operations guide
- Export/import reference — CLI commands
- YQL reference: