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 | The archive path. OceanBase Database allows you to use NFS, Alibaba Cloud OSS, Tencent COS, and Amazon S3 as the archive media. For examples of setting the archive_path parameter for different archive media, see the following sections. When you use OSS, COS, or S3 as the archive media, you can set the delete_mode parameter to configure the cleanup mode for archive files. Append the delete_mode parameter to the archive path by using an ampersand (&). Valid values of delete_mode:
|
| 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 |
Parameter examples
Example of archive_path setting when NFS is used as the archive media
ALTER SYSTEM SET LOG_ARCHIVE_DEST='LOCATION=nfs://your-nfs-server-path/your-archive-path [BINDING=your-binding-mode] [PIECE_SWITCH_INTERVAL=your-interval]' [TENANT = your-tenant-name];
The archive_path setting is as follows:
LOCATION=nfs://your-nfs-server-path/your-archive-path: the path of the NFS server and the archive path.
Example of archive_path setting when OSS is used as the archive media
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 [BINDING=your-binding-mode] [PIECE_SWITCH_INTERVAL=your-interval]' [TENANT = your-tenant-name];
The archive_path setting is as follows:
LOCATION=oss://your-bucket-name/your-archive-path: the name of the OSS bucket and the archive path.host=oss-your-region.aliyuncs.com: the domain name used to access OSS.your-regionmust be replaced with the actual OSS region code.access_id=your-access-idandaccess_key=your-access-key: the AccessKey ID and AccessKey secret used for authentication.
Example of archive_path setting when COS is used as the archive media
ALTER SYSTEM SET LOG_ARCHIVE_DEST='LOCATION=cos://your-bucket-name/your-archive-path?host=cos.your-region.myqcloud.com&access_id=your-access-id&access_key=your-access-key&appid=your-appid [BINDING=your-binding-mode] [PIECE_SWITCH_INTERVAL=your-interval]' [TENANT = your-tenant-name];
The archive_path setting is as follows:
LOCATION=cos://your-bucket-name/your-archive-path: the name of the COS bucket and the archive path.host=cos.your-region.myqcloud.com: the domain name used to access COS.your-regionmust be replaced with the actual COS region code.access_id=your-access-idandaccess_key=your-access-key: the AccessKey ID and AccessKey secret used for authentication.appid=your-appid: the AppID of your Tencent Cloud account.
Example of archive_path for S3 archiving
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 [BINDING=your-binding-mode] [PIECE_SWITCH_INTERVAL=your-interval]' [TENANT = your-tenant-name];
The archive_path setting is as follows:
LOCATION=s3://your-bucket-name/your-archive-path: the name of the S3 bucket and the archive path.host=s3.your-region.amazonaws.com: the domain name used to access S3.your-regionmust be replaced with the actual AWS region code.access_id=your-access-idandaccess_key=your-access-key: the AccessKey ID and AccessKey secret for AWS.s3_region=your-s3-region: the region where the S3 bucket is deployed.
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 totagging.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' TENANT = mysql_tenant;Configure an archive destination for the
mysql_tenanttenant from thesystenant. Specifically, set the destination path to a COS path and the archive file cleanup mode todelete, and specify to prioritize archiving and generate a new log piece every other two days.obclient [oceanbase]> ALTER SYSTEM SET LOG_ARCHIVE_DEST = 'LOCATION=cos://oceanbase-test-bucket/archive?host=cos.ap-xxx.myqcloud.com&access_id=xxx&access_key=xxx&appid=xxx&delete_mode=delete BINDING=Mandatory PIECE_SWITCH_INTERVAL=2d' TENANT = mysql_tenant;Here,
appidindicates the AppID of your Tencent Cloud account.Configure an archive destination for the
mysql_tenanttenant from thesystenant. Specifically, set the destination path to an S3 path and the archive file cleanup mode totagging.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' TENANT = mysql_tenant;Here,
s3_regionindicates the region where the S3 bucket is deployed.
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.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';Configure an archive destination for the
mysql_tenanttenant from the current tenant. Specifically, set the destination path to a COS path and the archive file cleanup mode todelete, and specify to prioritize archiving and generate a new log piece every other two days.obclient [oceanbase]> ALTER SYSTEM SET LOG_ARCHIVE_DEST = 'LOCATION=cos://oceanbase-test-bucket/archive?host=cos.ap-xxx.myqcloud.com&access_id=xxx&access_key=xxx&appid=xxx&delete_mode=delete BINDING=Mandatory PIECE_SWITCH_INTERVAL=2d';Here,
appidindicates the AppID of your Tencent Cloud account.Configure an archive destination for the
mysql_tenanttenant from the current tenant. Specifically, set the destination path to an S3 path and the archive file cleanup mode totagging.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';Here,
s3_regionindicates the region where the S3 bucket is deployed.