Purpose
You can use the ALTER SYSTEM SET DATA_BACKUP_DEST statement to configure a backup destination, namely, a data backup path, for a user tenant.
Limitations and considerations
The backup and restore feature is not supported for the
systenant and meta tenants. Therefore, you do not need to configure a backup destination for them.OceanBase Database allows you to use Network File System (NFS), Alibaba Cloud Object Storage Service (OSS), Tencent Cloud Object Storage (COS), Amazon Simple Storage Service (S3), and other object storage services that are compatible with the S3 protocol, such as Huawei Object Storage Service (OBS) and Google Cloud Storage (GCS), as the backup media. Some backup media can be used only after certain basic requirements are met. For more information about backup media, see Introduction to physical backup and restore.
Required privileges
You must execute this statement as the root user of the sys tenant (namely, root@sys) or as the administrator of a user tenant.
- In MySQL mode, the default administrator is the
rootuser. - In Oracle mode, the default administrator is the
SYSuser.
Syntax
ALTER SYSTEM SET DATA_BACKUP_DEST = 'data_backup_path' [TENANT = tenant_name];
Parameters
Parameter |
Description |
|---|---|
| data_backup_path | Specifies the backup path for data backup. Currently, the backup media supported by OceanBase Database are NFS, Alibaba Cloud OSS, AWS S3, and object storage compatible with the S3 protocol, such as Huawei OBS, Google GCS, and Tencent Cloud COS. For more details about this parameter, see data_backup_path below. |
| tenant_name | The name of the tenant for which a backup destination is to be configured from the sys tenant.
NoticeYou must use the |
data_backup_path
Used to specify the backup path for data backup. The format of data_backup_path for different types of media is described below.
NFS
ALTER SYSTEM SET DATA_BACKUP_DEST = 'file://your-nfs-server/your-backup-path';
Here, file://your-nfs-server/your-backup-path is used to specify the path of the NFS server that the OceanBase database can access for storing data backups.
Object Storage
# Alibaba Cloud OSS
ALTER SYSTEM SET DATA_BACKUP_DEST = 'oss://your-bucket-name/your-archive-path?host=oss-your-region.aliyuncs.com&access_id=your-access-id&access_key=your-access-key[&delete_mode={delete | tagging}][&checksum_type={md5 | no_checksum}]';
# AWS S3
ALTER SYSTEM SET DATA_BACKUP_DEST = 's3://your-bucket-name/your-archive-path?host=s3.your-region.amazonaws.com&access_id=your-access-id&access_key=your-access-key&s3_region=your-s3-region[&delete_mode={delete | tagging}][&checksum_type={md5 | crc32}]';
Object storage compatible with the S3 protocol
ALTER SYSTEM SET DATA_BACKUP_DEST = 's3://your-bucket-name/your-archive-path?host=your-service.com&access_id=your-access-id&access_key=your-access-key[&checksum_type=md5]';
The relevant parameter descriptions are as follows:
Attention
When using object storage as a backup medium, the parameters for the object storage path are separated by the & symbol. Ensure that the parameter values you enter only contain uppercase and lowercase English letters, numbers, /-_$+=, and wildcards. If you enter any characters other than those mentioned above, it may cause the configuration to fail.
host: The access domain name of the object storage service.access_id=your-access-id: The access key ID for object storage.access_key=your-access-key: The access key for object storage.delete_mode: Configures the cleanup mode for backup files after the backup path, an optional parameter for OSS, S3, and COS, connected to other parameters via the&symbol. This parameter currently supports the following two values:delete: Indicates that the cleanup mode is to directly delete backup files that meet the cleanup requirements.After configuring to this mode, when you clean up backup files automatically, the system will delete the backup files that meet the cleanup requirements directly.
tagging: Indicates that the cleanup mode is to set aTagfor backup files that meet the cleanup requirements, and the backup files will still be retained.After configuring to this mode, when you clean up backup files automatically, the system will tag the files that meet the cleanup requirements. The tag's
keyis"delete_mode", and thevalueis"tagging", allowing users to manage the lifecycle of these files on object storage based on the assigned tags.
checksum_type: Specifies the checksum algorithm used to verify the integrity of backup data. If not explicitly specified, all object storage services default to using the MD5 checksum algorithm. The supported values for this parameter vary depending on the object storage service as follows:md5: Use the MD5 algorithm to verify the integrity of backup data.Attention
MD5 verification is not effective for the
GetObjectinterface.no_checksum: The integrity of backup data is not verified. Only OSS supports this value. For object storage connected via the S3 protocol, including AWS S3, OBS, GCS, COS, etc., this value is not supported due to limitations of the S3 SDK.crc32: Use the CRC32 algorithm to verify the integrity of backup data. This value is only supported by AWS S3.
s3_region: The region where the Amazon S3 bucket is located. This parameter must be specified when the backup medium is AWS S3.
Examples
systenantThe system tenant configures the backup path for the tenant
mysql_tenant, and the backup medium is NFS.obclient [oceanbase]> ALTER SYSTEM SET DATA_BACKUP_DEST = 'file:///data/nfs/backup/data' TENANT = mysql_tenant;The system tenant configures the backup path for the tenant
mysql_tenant, with the backup medium being OSS. The cleanup mode for the backup files isdelete, and the MD5 algorithm is used to verify the integrity of the backup data.obclient [oceanbase]> ALTER SYSTEM SET DATA_BACKUP_DEST = 'oss://oceanbase-test-bucket/backup/?host=xxx.aliyun-inc.com&access_id=xxx&access_key=xxx&delete_mode=delete&checksum_type=md5' TENANT = mysql_tenant;The system tenant configures the backup path for the tenant
mysql_tenant, with the backup medium being OSS. The cleanup mode for the backup files isdelete, and the integrity of the backup data is not verified.obclient [oceanbase]> ALTER SYSTEM SET DATA_BACKUP_DEST = 'oss://oceanbase-test-bucket/backup/?host=xxx.aliyun-inc.com&access_id=xxx&access_key=xxx&delete_mode=delete&checksum_type=no_checksum' TENANT = mysql_tenant;The system tenant configures the backup path for the tenant
mysql_tenant, with the backup medium being AWS S3. The cleanup mode for the backup files istagging, and the CRC32 algorithm is used to verify the integrity of the backup data.obclient [oceanbase]> ALTER SYSTEM SET DATA_BACKUP_DEST='s3://oceanbase-test-bucket/backup/data?host=s3.<region>.amazonaws.com&access_id=xxx&access_key=xxx&s3_region=xxx&delete_mode=tagging&checksum_type=crc32' TENANT = mysql_tenant;The system tenant configures the backup path for the tenant
mysql_tenant, with the backup medium being OBS, accessed via the S3 protocol.obclient> ALTER SYSTEM SET DATA_BACKUP_DEST='s3://oceanbase-test-bucket/backup/data?host=obs.****.myhuaweicloud.com&access_id=****&access_key=****' TENANT = mysql_tenant;
The system tenant configures the backup path for the tenant
mysql_tenant, with the backup medium being GCS, accessed via the S3 protocol.obclient> ALTER SYSTEM SET DATA_BACKUP_DEST='s3://oceanbase-test-bucket/backup/data?host=https://storage.googleapis.com&access_id=****&access_key=****' TENANT = mysql_tenant;The system tenant configures the backup path for the tenant
mysql_tenant, with the backup medium being COS. The cleanup mode for archive files isdelete, and access is via the S3 protocol.Attention
When using COS as a backup medium, you need to first set the cluster-level configuration item ob_storage_s3_url_encode_type. For detailed operations, refer to Preparation Before Data Backup.
obclient> ALTER SYSTEM SET DATA_BACKUP_DEST='s3://oceanbase-test/backup/data?host=cos.ap-xxxx.myqcloud.com&access_id=***&access_key=***&delete_mode=delete' TENANT = mysql_tenant;User tenant
The tenant
mysql_tenantconfigures the backup path for this tenant, and the backup medium is NFS.obclient [oceanbase]> ALTER SYSTEM SET DATA_BACKUP_DEST = 'file:///data/nfs/backup/data';
The tenant
mysql_tenantconfigures the backup path for this tenant, with the backup medium being OSS. The cleanup mode for backup files isdelete, and the MD5 algorithm is used to verify the integrity of the backup data.obclient [oceanbase]> ALTER SYSTEM SET DATA_BACKUP_DEST = 'oss://oceanbase-test-bucket/backup/?host=xxx.aliyun-inc.com&access_id=xxx&access_key=xxx&delete_mode=delete&checksum_type=md5';The tenant
mysql_tenantconfigures the backup path for this tenant, with the backup medium being OSS. The cleanup mode for backup files isdelete, and the integrity of the backup data is not verified.obclient [oceanbase]> ALTER SYSTEM SET DATA_BACKUP_DEST = 'oss://oceanbase-test-bucket/backup/?host=xxx.aliyun-inc.com&access_id=xxx&access_key=xxx&delete_mode=delete&checksum_type=no_checksum';The tenant
mysql_tenantconfigures the backup destination for this tenant, with the backup medium being AWS S3. The cleanup mode for backup files istagging, and the CRC32 algorithm is used to verify the integrity of the backup data.obclient [oceanbase]> ALTER SYSTEM SET DATA_BACKUP_DEST='s3://oceanbase-test-bucket/backup/data?host=s3.<region>.amazonaws.com&access_id=xxx&access_key=xxx&s3_region=xxx&delete_mode=tagging&checksum_type=crc32';The tenant
mysql_tenantconfigures the backup path for this tenant, with the backup medium being OBS, accessed via the S3 protocol.obclient> ALTER SYSTEM SET DATA_BACKUP_DEST='s3://oceanbase-test-bucket/backup/data?host=obs.****.myhuaweicloud.com&access_id=****&access_key=****';The tenant
mysql_tenantconfigures the backup path for this tenant, with the backup medium being GCS, accessed via the S3 protocol.obclient> ALTER SYSTEM SET DATA_BACKUP_DEST='s3://oceanbase-test-bucket/backup/data?host=https://storage.googleapis.com&access_id=****&access_key=****';
The tenant
mysql_tenantconfigures the backup path for this tenant, with the backup medium being COS. The cleanup mode for backup files isdelete, and access is via the S3 protocol.Attention
When using COS as a backup medium, you need to first set the cluster-level configuration item ob_storage_s3_url_encode_type. For detailed operations, see Preparation Before Data Backup.
obclient> ALTER SYSTEM SET DATA_BACKUP_DEST='s3://oceanbase-test/backup/data?host=cos.ap-xxxx.myqcloud.com&access_id=***&access_key=***&delete_mode=delete';
