BACKUP
This statement is used to back up the data under the specified database. This command is an asynchronous operation. After the submission is successful, you need to check the progress through the SHOW BACKUP command. Only backing up tables of type OLAP is supported.
grammar:
BACKUP SNAPSHOT [db_name].{snapshot_name} TO `repository_name` [ON|EXCLUDE] ( `table_name` [PARTITION (`p1`, ...)], ... ) PROPERTIES ("key"="value", ...);
illustrate:
BACKUP SNAPSHOT example_db.snapshot_label1 TO example_repo ON (example_tbl) PROPERTIES ("type" = "full");
BACKUP SNAPSHOT example_db.snapshot_label2 TO example_repo ON ( example_tbl PARTITION (p1,p2), example_tbl2 );
BACKUP SNAPSHOT example_db.snapshot_label3 TO example_repo EXCLUDE (example_tbl);
CREATE REPOSITORY `s3_repo`
WITH S3
ON LOCATION "s3://s3-repo"
PROPERTIES
(
"AWS_ENDPOINT" = "http://s3-REGION.amazonaws.com",
"AWS_ACCESS_KEY" = "AWS_ACCESS_KEY",
"AWS_SECRET_KEY"="AWS_SECRET_KEY",
"AWS_REGION" = "REGION"
);
CREATE REPOSITORY `hdfs_repo`
WITH hdfs
ON LOCATION "hdfs://hadoop-name-node:54310/path/to/repo/"
PROPERTIES
(
"fs.defaultFS"="hdfs://hadoop-name-node:54310",
"hadoop.username"="user"
);
CREATE REPOSITORY `minio_repo`
WITH S3
ON LOCATION "s3://minio_repo"
PROPERTIES
(
"AWS_ENDPOINT" = "http://minio.com",
"AWS_ACCESS_KEY" = "MINIO_USER",
"AWS_SECRET_KEY"="MINIO_PASSWORD",
"AWS_REGION" = "REGION",
"use_path_style" = "true"
);
BACKUP
Only one backup operation can be performed under the same database.
The backup operation will back up the underlying table and materialized view of the specified table or partition, and only one copy will be backed up.
Efficiency of backup operations
The efficiency of backup operations depends on the amount of data, the number of Compute Nodes, and the number of files. Each Compute Node where the backup data shard is located will participate in the upload phase of the backup operation. The greater the number of nodes, the higher the upload efficiency.
The amount of file data refers only to the number of shards, and the number of files in each shard. If there are many shards, or there are many small files in the shards, the backup operation time may be increased.