BACKUP
BACKUP
Description
This statement is used to back up the data in specified database. This command is an asynchronous operation. After successful submission, progress can be viewed by SHOW BACKUP command.
Backup of OLAP-type tables is only supported.
BACKUP SNAPSHOT [db_name.]snapshot_name
TO `repository_name`
ON (
`table_name` [PARTITION (`p1`, ...)],
...
)
PROPERTIES ("key"="value", ...);
snapshot_name
: give the snapshot of this backup a name.ON
: specify the table or partition to back up.-
PROPERTIES
: specify some parameterstimeout
: Task timeout period, default to one day, in seconds.
Example
-
Backup the table
example_tbl
underexample_db
to respositoryexample_repo
:BACKUP SNAPSHOT example_db.snapshot_label1 TO example_repo ON (example_tbl);
-
Back up the
p1, p2
partition of tableexample_tbl
underexample_db
, and set the timeout.BACKUP SNAPSHOT example_db.snapshot_label2 TO example_repo ON ( example_tbl PARTITION (p1,p2), example_tbl2 ) PROPERTIES ( "timeout" = "7200" );
Keywords
BACKUP, SNAPSHOT
Best Practices
- Only one backup operation can be performed under the same database.
- The backup operation backs up the underlying tables of the specified table or partition and Materialized View. And only one copy is backed up.
-
Efficiency of backup operation
The efficiency of backup operation depends on the amount of data, the number of Compute Node and the number of files. Every Compute Node where backup data slices are located will participate in the upload stage of backup operation. The more nodes, the higher the efficiency of uploading is.
The amount of file data only involves the number of slices and the number of files in each shard. If there are too many shards, or there are too many small files in the shards, it may increase the backup operation time.