Purpose
You can use the ALTER SYSTEM SET LOG_ARCHIVE_DEST statement to configure an archive destination for a user tenant. You can configure an archive destination by using the LOCATION, BINDING, and PIECE_SWITCH_INTERVAL parameters.
Limitations and considerations
The backup and restore feature is not supported for the
systenant and meta tenants. Therefore, you do not need to configure an archive 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.
When you configure the
LOCATION,BINDING, andPIECE_SWITCH_INTERVALparameters, separate the parameters with spaces and do not leave spaces before and after the equal sign (=) that is used to join the parameter name and value.After you configure an archive destination, you must specify values for all parameters each time when you execute the
ALTER SYSTEM SET LOG_ARCHIVE_DESTstatement. Otherwise, the default value is used for a parameter for which no value is specified.
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 LOG_ARCHIVE_DEST='LOCATION=archive_path [BINDING=archive_mode] [PIECE_SWITCH_INTERVAL=piece_switch_interval]' [TENANT = tenant_name];
Parameters
Parameter |
Description |
|---|---|
| archive_path | Specify the archive path. Currently, the archiving 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 detailed information about this parameter, see archive_path below. |
| archive_mode | Optional. The prioritizing mode of archiving and business. This parameter has two values: Optional and Mandatory. If you do not specify this parameter, the default value Optional is used.
|
| piece_switch_interval | The interval for generating a new log piece. Value range: [1d, 7d]. If you do not specify this parameter, the default value 1d is used. For more information about pieces, see Overview. |
| tenant_name | The name of the tenant for which the archive destination is configured.
NoticeYou must use the |
archive_path
Used to specify the archive path. The format of archive_path for different types of media is described below.
NFS
ALTER SYSTEM SET LOG_ARCHIVE_DEST='LOCATION=file://your-nfs-server-path/your-archive-path';
Here, file://your-nfs-server-path/your-archive-path is used to specify the NFS server path and archive path.
Object Storage
# Alibaba Cloud OSS
ALTER SYSTEM SET LOG_ARCHIVE_DEST='LOCATION=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 LOG_ARCHIVE_DEST='LOCATION=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 LOG_ARCHIVE_DEST='LOCATION=s3://your-bucket-name/your-archive-path?host=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 an archive medium, the parameters for the object storage path are separated by the & symbol. Ensure that the parameter values you enter only include 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: The access key ID for object storage.access_key: The access key for object storage.delete_mode: Configures the cleanup mode for archive files, 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 archive files that meet the cleanup requirements.After configuring to this mode, when you clean up archive files automatically, the system will directly delete the archive files that meet the cleanup requirements.
tagging: Indicates that the cleanup mode is to set aTagfor the archive files that meet the cleanup requirements, and the archive files will still be retained.After configuring to this mode, when you clean up archive files automatically, the system will tag the files that meet the cleanup requirements. The tag's
keyis"delete_mode", and thevalueis"tagging", so that users can manage the lifecycle of these files on the object storage based on the tags later.
checksum_type: Specifies the checksum algorithm for the archive file, used to verify the integrity of the archive file. 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 the archive file.Attention
MD5 verification is not effective for the
GetObjectinterface.no_checksum: Do not verify the integrity of the archive file. This value is only supported by OSS. For object storage accessed via the S3 protocol, including AWS S3, OBS, GCS, COS, etc., this value is not supported due to limitations of the S3 SDK.crc32: Uses the CRC32 algorithm to verify the integrity of the archive file. 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 archive medium is AWS S3.
Examples
systenantConfigure an archive destination for the
mysql_tenanttenant from thesystenant. Specifically, set the destination path to an NFS path, and specify to prioritize user business and generate a new log piece every other day.obclient [oceanbase]> ALTER SYSTEM SET LOG_ARCHIVE_DEST='LOCATION=file:///data/nfs/backup/archive BINDING=Optional PIECE_SWITCH_INTERVAL=1d' TENANT = mysql_tenant;Configure an archive destination for the
mysql_tenanttenant from thesystenant. Specifically, set the destination path to an OSS path and the archive file cleanup mode todelete, and use the MD5 algorithm to verify the integrity of the archive files.obclient [oceanbase]> ALTER SYSTEM SET LOG_ARCHIVE_DEST='LOCATION=oss://oceanbase-test-bucket/backup/archive?host=xxx.aliyun-inc.com&access_id=xxx&access_key=xxx&delete_mode=delete&checksum_type=md5' TENANT = mysql_tenant;Configure an archive destination for the
mysql_tenanttenant from thesystenant. Specifically, set the destination path to an OSS path and the archive file cleanup mode todelete, without verifying the integrity of the archive files.obclient [oceanbase]> ALTER SYSTEM SET LOG_ARCHIVE_DEST='LOCATION=oss://oceanbase-test-bucket/backup/archive?host=***.aliyun-inc.com&access_id=***&access_key=***&delete_mode=delete&checksum_type=no_checksum' TENANT = mysql_tenant;Configure an archive destination for the
mysql_tenanttenant from thesystenant. Specifically, set the destination path to an AWS S3 path, the archive file cleanup mode todelete, and specify to prioritize user business and generate a new log piece every other day.obclient> ALTER SYSTEM SET LOG_ARCHIVE_DEST='LOCATION=s3://oceanbase-test-bucket/backup/archive?host=s3.<region>.amazonaws.com&access_id=******&access_key=******&s3_region=******&delete_mode=delete BINDING=Optional PIECE_SWITCH_INTERVAL=1d' TENANT = mysql_tenant;Configure an archive destination for the
mysql_tenanttenant from thesystenant. Specifically, set the destination path to an AWS S3 path, the archive file cleanup mode totagging, and use the CRC32 algorithm to verify the integrity of the archive files.obclient [oceanbase]> ALTER SYSTEM SET LOG_ARCHIVE_DEST='LOCATION=s3://oceanbase-test-bucket/backup/archive?host=s3.<region>.amazonaws.com&access_id=***&access_key=***&s3_region=***&delete_mode=tagging&checksum_type=crc32' TENANT = mysql_tenant;Configure an archive destination for the
mysql_tenanttenant from thesystenant. Specifically, set the destination path to an OBS path and access it through the S3 protocol.obclient> ALTER SYSTEM SET LOG_ARCHIVE_DEST='LOCATION=s3://oceanbase-test-bucket/backup/archive?host=obs.****.myhuaweicloud.com&access_id=****&access_key=****' TENANT = mysql_tenant;Configure an archive destination for the
mysql_tenanttenant from thesystenant. Specifically, set the destination path to a GCS path and access it through the S3 protocol.obclient> ALTER SYSTEM SET LOG_ARCHIVE_DEST='LOCATION=s3://oceanbase-test-bucket/backup/archive?host=https://storage.googleapis.com&access_id=****&access_key=****' TENANT = mysql_tenant;Configure an archive destination for the
mysql_tenanttenant from thesystenant. Specifically, set the destination path to a COS path, the archive file cleanup mode todelete, and access it through the S3 protocol.Notice
When you use COS as the archive medium, you must set the cluster-level parameter ob_storage_s3_url_encode_type first. For more information, see Prepare for log archive.
obclient> ALTER SYSTEM SET LOG_ARCHIVE_DEST='LOCATION=s3://oceanbase-test/backup/archive?host=cos.ap-***.myqcloud.com&access_id=***&access_key=***&delete_mode=delete' TENANT = mysql_tenant;
User tenant
Configure an archive destination for the
mysql_tenanttenant from the current tenant. Specifically, set the destination path to an NFS path, and specify to prioritize user business and generate a new log piece every other day.obclient [oceanbase]> ALTER SYSTEM SET LOG_ARCHIVE_DEST='LOCATION=file:///data/nfs/backup/archive BINDING=Optional PIECE_SWITCH_INTERVAL=1d';Configure an archive destination for the
mysql_tenanttenant from the current tenant. Specifically, set the destination path to an OSS path and the archive file cleanup mode totagging, and use the MD5 algorithm to verify the integrity of the archive files.obclient [oceanbase]> ALTER SYSTEM SET LOG_ARCHIVE_DEST='LOCATION=oss://oceanbase-test-bucket/backup/archive?host=xxx.aliyun-inc.com&access_id=xxx&access_key=xxx&delete_mode=tagging&checksum_type=md5';Configure an archive destination for the
mysql_tenanttenant from the current tenant. Specifically, set the destination path to an OSS path and the archive file cleanup mode totagging, without verifying the integrity of the archive files.obclient [oceanbase]> ALTER SYSTEM SET LOG_ARCHIVE_DEST='LOCATION=oss://oceanbase-test-bucket/backup/archive?host=***.aliyun-inc.com&access_id=***&access_key=***&delete_mode=tagging&checksum_type=no_checksum';Configure an archive destination for the
mysql_tenanttenant from the current tenant. Specifically, set the destination path to an AWS S3 path, the archive file cleanup mode todelete, and specify to prioritize user business and generate a new log piece every other day.obclient> ALTER SYSTEM SET LOG_ARCHIVE_DEST='LOCATION=s3://oceanbase-test-bucket/backup/archive?host=s3.<region>.amazonaws.com&access_id=******&access_key=******&s3_region=******&delete_mode=delete BINDING=Optional PIECE_SWITCH_INTERVAL=1d';Configure an archive destination for the
mysql_tenanttenant from the current tenant. Specifically, set the destination path to an AWS S3 path, the archive file cleanup mode totagging, and use the CRC32 algorithm to verify the integrity of the archive files.obclient [oceanbase]> ALTER SYSTEM SET LOG_ARCHIVE_DEST='LOCATION=s3://oceanbase-test-bucket/backup/archive?host=s3.<region>.amazonaws.com&access_id=xxx&access_key=xxx&s3_region=xxx&delete_mode=tagging&checksum_type=crc32';Configure an archive destination for the
mysql_tenanttenant from the current tenant. Specifically, set the destination path to an OBS path and access it through the S3 protocol.obclient> ALTER SYSTEM SET LOG_ARCHIVE_DEST='LOCATION=s3://oceanbase-test-bucket/backup/archive?host=obs.****.myhuaweicloud.com&access_id=****&access_key=****';Configure an archive destination for the
mysql_tenanttenant from the current tenant. Specifically, set the destination path to a GCS path and access it through the S3 protocol.obclient> ALTER SYSTEM SET LOG_ARCHIVE_DEST='LOCATION=s3://oceanbase-test-bucket/backup/archive?host=https://storage.googleapis.com&access_id=****&access_key=****';Configure an archive destination for the
mysql_tenanttenant from the current tenant. Specifically, set the destination path to a COS path, the archive file cleanup mode todelete, and access it through the S3 protocol.Notice
When you use COS as the archive medium, you must set the cluster-level parameter ob_storage_s3_url_encode_type first. For more information, see Prepare for log archive.
obclient> ALTER SYSTEM SET LOG_ARCHIVE_DEST='LOCATION=s3://oceanbase-test/backup/archive?host=cos.ap-***.myqcloud.com&access_id=***&access_key=***&delete_mode=delete';
