Description
The ALTER SYSTEM SET LOG_ARCHIVE_DEST statement is used to configure an archive destination for a user tenant. The configuration of an archive destination includes parameters such as LOCATION, BINDING, and PIECE_SWITCH_INTERVAL.
Limitations and considerations
The sys tenant and the meta tenant do not support backup and restore. Therefore, there is no need to configure an archive destination for these tenants.
At present, OceanBase Database supports backup to NFS, Alibaba Cloud OSS, Tencent Cloud COS, AWS S3, and object storage services compatible with the S3 protocol, such as Huawei Cloud OBS and Google Cloud Storage. Some backup media may have basic requirements. For more information, see the Backup media requirements section in Overview of physical backup and restore.
When you configure the
LOCATION,BINDING, andPIECE_SWITCH_INTERVALparameters, separate them with spaces, and do not add spaces between the equal sign (=) and the parameter values.After an archive destination is configured, incremental configuration is not supported. Namely, you must specify all parameter values in the
ALTER SYSTEM SET LOG_ARCHIVE_DESTstatement each time you execute it. Otherwise, the unspecified parameters will use default values.
Privilege requirements
You must perform this operation either as the root user of the sys tenant (root@sys) or as the administrator of the tenant. By default:
- 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 path where archives are stored. Currently, OceanBase Database supports NFS, Alibaba Cloud OSS, Tencent Cloud COS, and AWS S3 as archive media. For more information, see the archive_path examples below. When OSS, COS, or S3 is used as the archive media, you can specify the delete_mode parameter after the archive path to configure the deletion mode of the archives. The delete_mode parameter is connected to the archive path with the & symbol. The current values of the delete_mode parameter are as follows:
|
| archive_mode | The priority mode for configuring archives and business. It is an optional parameter. Currently, Optional and Mandatory are supported. If not specified, the Optional mode is used.
|
| piece_switch_interval | The cycle period for switching pieces. It is an optional parameter, with a value range of [1d, 7d]. If not specified, the default value 1d is used. For more information about pieces, see Overview of log archive. |
| tenant_name | The name of the tenant to which the specified system tenant wants to configure log archiving as the destination.
NoticeOnly the system tenant needs to use the |
Examples
archive_path example for NFS
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 parameter is explained as follows:
LOCATION=nfs://your-nfs-server-path/your-archive-path: the NFS server path and the archive path.
archive_path example for 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 [BINDING=your-binding-mode] [PIECE_SWITCH_INTERVAL=your-interval]' [TENANT = your-tenant-name];
The archive_path parameter is explained as follows:
Notice
When object storage is used as the archive medium, the parameters in the object storage path are separated by &. Please make sure that the parameter values contain only uppercase and lowercase English letters, numbers, /-_$+=, and wildcard characters. If your parameter values contain other characters, the setting may fail.
LOCATION=oss://your-bucket-name/your-archive-path: the Alibaba Cloud OSS bucket and the archive path.host=oss-your-region.aliyuncs.com: the access domain name of the Alibaba Cloud OSS service. Replaceyour-regionwith the actual region code of OSS.access_id=your-access-idandaccess_key=your-access-key: the access key ID and access key for authentication.
archive_path example for Tencent Cloud COS
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 parameter is explained as follows:
Notice
When object storage is used as the archive medium, the parameters in the object storage path are separated by &. Please make sure that the parameter values contain only uppercase and lowercase English letters, numbers, /-_$+=, and wildcard characters. If your parameter values contain other characters, the setting may fail.
LOCATION=cos://your-bucket-name/your-archive-path: the Tencent Cloud COS bucket and the archive path.host=cos.your-region.myqcloud.com: the access domain name of the Tencent Cloud COS service. Replaceyour-regionwith the actual region code.access_id=your-access-idandaccess_key=your-access-key: the access ID and access key for authentication.appid=your-appid: the AppID of the Tencent Cloud account.
archive_path example for Amazon 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 [BINDING=your-binding-mode] [PIECE_SWITCH_INTERVAL=your-interval]' [TENANT = your-tenant-name];
The archive_path parameter is explained as follows:
Notice
When object storage is used as the archive medium, the parameters in the object storage path are separated by &. Please make sure that the parameter values contain only uppercase and lowercase English letters, numbers, /-_$+=, and wildcard characters. If your parameter values contain other characters, the setting may fail.
LOCATION=s3://your-bucket-name/your-archive-path: the Amazon S3 bucket and the archive path.host=s3.your-region.amazonaws.com: the domain name of the Amazon S3 service. Replaceyour-regionwith the actual region code of AWS.access_id=your-access-idandaccess_key=your-access-key: the access key ID and access key for authentication.s3_region=your-s3-region: the region where the Amazon S3 bucket is located.
Examples
System tenant
The system tenant configures an archive destination for the
mysql_tenanttenant. The archive medium is NFS. The user business priority mode is adopted. An archive piece is generated 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;The system tenant configures an archive destination for the
mysql_tenanttenant. The archive medium is OSS. The archive file deletion mode istagging.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;The system tenant configures an archive destination for the
mysql_tenanttenant. The archive medium is COS. The archive file deletion mode isdelete. The archive priority mode is adopted. An archive piece is generated every other day.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;appidindicates the AppID of the Tencent Cloud account. You need to replace it with the actual AppID.
The system tenant configures an archive destination for the
mysql_tenanttenant. The archive medium is S3. Here is an example of how to set the archive destination and configure thetaggingdeletion mode: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;s3_regionindicates the region where the S3 bucket is located.
User tenant
The
mysql_tenanttenant configures an archive destination for the current tenant. The archive medium is NFS. The user business priority mode is adopted. An archive piece is generated every other day.obclient [oceanbase]> ALTER SYSTEM SET LOG_ARCHIVE_DEST='LOCATION=file:///data/nfs/backup/archive BINDING=Optional PIECE_SWITCH_INTERVAL=1d';The
mysql_tenanttenant configures an archive destination for the current tenant. The archive medium is OSS. The archive file deletion mode istagging.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';The
mysql_tenanttenant configures an archive destination for the current tenant. The archive medium is COS. The archive file deletion mode isdelete. The archive priority mode is adopted. An archive piece is generated every other day.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';appidindicates the AppID of the Tencent Cloud account. You need to replace it with the actual AppID.
The
mysql_tenanttenant configures an archive destination for the current tenant. The archive medium is S3. Here is an example of how to set the archive destination and configure thetaggingdeletion mode: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';s3_regionindicates the region where the S3 bucket is located.