Prepare for log archiving

2025-11-13 06:13:17  Updated

This topic describes the preparations before you archive logs.

Configure the concurrency of log archiving (optional)

Before you enable the archiving mode, you can configure the concurrency of log archiving to improve the log archiving speed of the tenant.

  1. Log in to the database as the sys tenant user or the tenant administrator of the user tenant.

  2. Execute the appropriate statement to set the log_archive_concurrency parameter.

    The log_archive_concurrency parameter of a user tenant specifies the total number of worker threads for log archiving. This parameter takes effect immediately and does not require a restart of the OBServer node. The value range is [0, 100]. The default value is 0, which indicates that the database adapts the log archiving concurrency. We recommend that you use the default value.

    Notice

    For small tenants (with less than or equal to 4 CPU cores), we recommend that you use the default value and do not modify the value of this parameter.

    The following methods are supported for setting the parameter:

    • Adjust the log archiving concurrency for a specified tenant as the sys tenant user.

      ALTER SYSTEM SET log_archive_concurrency = 10 TENANT = mysql_tenant;
      
    • Adjust the log archiving concurrency for all tenants as the sys tenant user.

      ALTER SYSTEM SET log_archive_concurrency = 10 TENANT = all_user;
      

      or

      ALTER SYSTEM SET log_archive_concurrency = 10 TENANT = all;
      

      Note

      Starting from V4.2.1, OceanBase Database considers TENANT = all_user and TENANT = all to be semantically equivalent. When you need to take effect in all user tenants, it is recommended to use TENANT = all_user. TENANT = all will be deprecated.

    • Adjust the log archiving concurrency for the current tenant as a user tenant.

      ALTER SYSTEM SET log_archive_concurrency = 10;
      

    For more information about the log_archive_concurrency parameter, see log_archive_concurrency.

Configure the destination for archiving logs

Before you start a log archiving task, you must execute the ALTER SYSTEM command to set the LOG_ARCHIVE_DEST parameter. The system tenant does not contain user data and is a tenant used for cluster management. Backup and restore are not supported for the sys tenant. Therefore, you do not need to configure an archive destination for this tenant.

The operation of configuring an archive destination mainly involves setting the LOCATION, BINDING, and PIECE_SWITCH_INTERVAL parameters.

Considerations

When you configure the destination for archiving, make sure that the archiving path for each tenant is an independent empty directory, and that the archiving paths for different tenants are different.

Procedure

  1. Log in to the database as the tenant administrator of the sys tenant or a user tenant.

    Note

    In MySQL-compatible mode, the administrator user is the root user, and in Oracle-compatible mode, the administrator user is the SYS user.

  2. Configure the archive destination.

    • Configure the archive destination for the specified tenant in the sys tenant

      ALTER SYSTEM SET LOG_ARCHIVE_DEST='LOCATION=archive_path [BINDING=archive_mode] [PIECE_SWITCH_INTERVAL=piece_switch_interval]' TENANT = tenant_name;
      
    • Configure the archive destination for the current tenant

      ALTER SYSTEM SET LOG_ARCHIVE_DEST='LOCATION=archive_path [BINDING=archive_mode] [PIECE_SWITCH_INTERVAL=piece_switch_interval]';
      

    Notice

    For an upgrade from OceanBase Database V4.0.x to V4.1.0, the archiving path must be changed after the upgrade. For an upgrade from OceanBase Database V4.1.x to V4.2.x, the archiving path does not need to be changed. In addition, for an upgrade from OceanBase Database V4.1.x to V4.2.x, log archiving can be performed during the upgrade.

    The following table describes the parameters.

    • LOCATION (required)

      The LOCATION attribute is used to specify the archiving path. Currently, OceanBase Database supports the following archive media: NFS, Alibaba Cloud OSS, Azure Blob Storage (For OceanBase Database V4.3.5, supported starting from V4.3.5 BP3), AWS S3, and S3-compatible object storage such as Huawei OBS, Google GCS, and Tencent Cloud COS. Some archive media may need to meet certain basic requirements before they can be used. For more information about the requirements for each archive media, see the Backup media requirements section in Overview of physical backup and restore.

      OSS
      NFS
      S3
      Object storage services that comply with the S3 protocol

      When OSS is used as the archive media, in addition to specifying the archiving path, host, access_key, and access_id, you can also configure the delete_mode parameter to specify the mode for deleting archive files. The delete_mode parameter supports the delete and tagging modes. If you do not explicitly specify the delete_mode parameter, the delete mode is used by default.

      In addition, you can specify the checksum_type parameter to indicate the checksum algorithm for verifying the integrity of archive files. The supported values are md5 and no_checksum. If you do not explicitly specify the checksum_type parameter, the default value is md5.

      Starting from V4.3.5 BP2, OceanBase Database supports using Alibaba Cloud OSS Buckets with configured compliance retention policies as archiving paths. When configuring the archiving path, you can use the enable_worm parameter to specify whether OceanBase Database should follow the bucket’s retention policy (WORM policy) for write and delete operations on the path. The parameter supports values of true and false. If the enable_worm parameter is not explicitly configured, it defaults to false. When setting enable_worm=true, it is required to explicitly configure checksum_type=md5. Once the enable_worm parameter is set, it cannot be changed.

      Notice

      OceanBase Database will not replace or override your configured compliance retention policies. Ensure that the OSS Bucket’s retention policy (WORM policy) is correctly configured and locked before setting the archiving path.

      For detailed descriptions of each parameter, refer to SET LOG_ARCHIVE_DEST.

      Notice

      When an object storage service is used as the archive media, separate the parameters for the object storage path with the & character. Make sure that the values of the parameters contain only uppercase and lowercase letters, numbers, and the characters /-_$+= and the wildcard character. If you enter characters other than the preceding ones, the setting may fail.

      Here are some examples:

      • When using OSS as the archive media, set the archiving path for the tenant mysql_tenant in the sys tenant, configure the delete mode for deleting archive files, and specify the md5 algorithm for verifying the integrity of archive files.

        obclient> 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=md5' TENANT = mysql_tenant;
        

        If you do not want to verify the integrity of archive files, you can set the checksum_type parameter to no_checksum. Here is an example:

        obclient> 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;
        
      • When using OSS as the archive medium, the system tenant sets the archiving path for the specified tenant mysql_tenant, configures the cleanup mode as delete, specifies writing and deleting objects in a WORM-compliant manner, and sets the checksum algorithm to md5.

        Notice

        • OceanBase Database will not override the compliance retention policy you set. Before configuring the archive path, please make sure that the OSS bucket has been properly set up with a retention policy (WORM policy) and is locked.
        • When using a bucket with a WORM policy as the archive path, it is recommended to use the tagging cleanup mode.
        obclient> 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=md5&enable_worm=true' TENANT = mysql_tenant;
        
      • When using OSS as the archive medium, the user tenant sets the archiving path for its own tenant, configures the cleanup mode as delete, and specifies the checksum algorithm as md5.

        obclient> 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=md5';
        

      In this example, oss:// indicates that an OSS bucket is used as the archive media. The bucket name is oceanbase-test-bucket and the path in the bucket is /backup/archive. The parameters are separated from the path by using ?, and the parameters are separated by using &. The host parameter specifies the host address of the bucket. The access_id and access_key parameters specify the access keys of the OSS service. The delete_mode parameter is set to delete, and the md5 algorithm is used to verify the integrity of archive files. The enable_worm parameter is set to true, which indicates that write and delete operations on objects must comply with the WORM specification. Note that OceanBase Database does not replace the compliance-based retention policy that you set. Before you set the archiving path, make sure that the OSS bucket has a correctly configured retention policy (WORM policy) and the policy is locked.

      Notice

      When you use NFS as the archive media, note the following items:

      • The value of the LOCATION parameter cannot contain a question mark (?).
      • The value of the LOCATION parameter must be an absolute path, and the OBServer node must have read and write permissions on the path.
      • All OBServer nodes must mount the same NFS server. To ensure successful log archiving, use the parameters recommended in this topic to mount the NFS server. For more information about how to mount the NFS server, see Deploy an NFS client.

      Here is an example of setting the archiving path when you use NFS as the archive media in the sys tenant:

      obclient> ALTER SYSTEM SET LOG_ARCHIVE_DEST='LOCATION=file:///data/nfs/backup/archive' TENANT = mysql_tenant;
      

      Here is an example of setting the archiving path when you use NFS as the archive media in the current tenant:

      obclient> ALTER SYSTEM SET LOG_ARCHIVE_DEST='LOCATION=file:///data/nfs/backup/archive';
      

      In these examples, file:// indicates that NFS is used as the archive media, and the archiving path is /data/nfs/backup/archive.

      Like OSS, you can specify the delete_mode parameter to configure the mode for deleting archive files when you use Amazon Simple Storage Service (S3) as the archive media. The supported values are the same as those for OSS. In addition, you can specify the checksum_type parameter to indicate the checksum algorithm for verifying the integrity of archive files. The supported values are md5 and crc32. If you do not explicitly specify the checksum_type parameter, the default value is md5.

      For more information about the delete_mode parameter and the checksum_type parameter, see SET LOG_ARCHIVE_DEST.

      Notice

      When an object storage service is used as the archive media, separate the parameters for the object storage path with the & character. Make sure that the values of the parameters contain only uppercase and lowercase letters, numbers, and the characters /-_$+= and the wildcard character. If you enter characters other than the preceding ones, the setting may fail.

      Here are some examples of using S3 as the archive media:

      • When using S3 as the archive media, set the archiving path for the tenant mysql_tenant in the sys tenant, configure the delete mode for deleting archive files, and specify the crc32 algorithm for verifying the integrity of archive files.

        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&checksum_type=crc32' TENANT = mysql_tenant;
        
      • When using S3 as the archive media, set the archiving path for the current tenant, configure the delete mode for deleting archive files, and specify the crc32 algorithm for verifying the integrity of archive files.

        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&checksum_type=crc32';
        

      In these examples, s3:// indicates that an S3 bucket is used as the archive media. The bucket name is oceanbase-test-bucket and the path in the bucket is /backup/archive. The parameters are separated from the path by using ?, and the parameters are separated by using &. The host parameter specifies the domain name of the Amazon S3 service. The access_id and access_key parameters specify the access keys of the Amazon S3 service. The s3_region parameter is required when S3 is used as the archive media. It specifies the region where the S3 bucket is located. The delete_mode parameter is set to delete, and the crc32 algorithm is used to verify the integrity of archive files.

      For more information about the AWS S3 path format, see Appendix: AWS S3 path format.

      Most object storage services comply with the Simple Storage Service (S3) protocol. Therefore, object storage services that comply with the S3 protocol and meet the requirements of OceanBase Database can be used as the archive media for OceanBase Database. You can access such object storage services in the same way as you access S3. For example, Object Storage Service (OBS), Google Cloud Storage (GCS), and Tencent Cloud Object Storage (COS) can be accessed through the S3 protocol.

      You can also specify the checksum_type parameter to indicate the checksum algorithm for verifying the integrity of archive files when you use OBS, GCS, or COS through the S3 protocol as the archive media. The supported value is md5. If you do not explicitly specify the checksum_type parameter, the default value is md5. For more information about the checksum_type parameter, see SET LOG_ARCHIVE_DEST.

      Notice

      • When using object storage as the archive medium, the parameters for the object storage path are separated by the & symbol. Please ensure that the values you enter contain only uppercase and lowercase English letters, numbers, /-_$+=, and wildcards. If you enter any other characters, the configuration may fail.
      • For some object storage services compatible with the S3 protocol, the default URL encoding method of the AWS S3 SDK may not be supported. When accessing via the s3:// protocol, if you encounter object storage-related error codes such as 9129 or 9026, it is recommended to set the cluster-level parameter ob_storage_s3_url_encode_type to specify the URL encoding method used by AWS S3 requests to be compatible with the Rfc3986 standard. For detailed configuration steps, please refer to Operation steps and examples for using COS as the archive medium below.

      Here is an example of using OBS as the archive media:

      • When using OBS as the archive media, set the archiving path for the tenant mysql_tenant in the sys tenant.

        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;
        
      • When using OBS as the archive media, set the archiving path for the current tenant.

        obclient> ALTER SYSTEM SET LOG_ARCHIVE_DEST='LOCATION=s3://oceanbase-test-bucket/backup/archive?host=obs.****.myhuaweicloud.com&access_id=****&access_key=****';
        

      In these examples, s3:// indicates that the object storage path is accessed through the S3 protocol. The bucket name is oceanbase-test-bucket and the path in the bucket is /backup/archive. The parameters are separated from the path by using ?, and the parameters are separated by using &. The host parameter specifies the domain name of the OBS service. The access_id and access_key parameters specify the access keys of the OBS service.

      Here is an example of using GCS as the archive media:

      • When using GCS as the archive media, set the archiving path for the tenant mysql_tenant in the sys tenant.

        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;
        
      • When using GCS as the archive media, set the archiving path for the current tenant.

        obclient> ALTER SYSTEM SET LOG_ARCHIVE_DEST='LOCATION=s3://oceanbase-test-bucket/backup/archive?host=https://storage.googleapis.com&access_id=****&access_key=****';
        

      In these examples, s3:// indicates that the object storage path is accessed through the S3 protocol. The bucket name is oceanbase-test-bucket and the path in the bucket is /backup/archive. The parameters are separated from the path by using ?, and the parameters are separated by using &. The host parameter specifies the domain name of the GCS service. The access_id and access_key parameters specify the access keys of the GCS service.

      Here is an example of using COS as the archive media:

      1. View the value of the cluster-level parameter ob_storage_s3_url_encode_type.

        obclient> SHOW PARAMETERS LIKE '%ob_storage_s3_url_encode_type%';
        

        The result is as follows:

        +-------+----------+----------------+----------+-------------------------------+-----------+---------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------+---------+---------+-------------------+
        | zone  | svr_type | svr_ip         | svr_port | name                          | data_type | value   | info                                                                                                                                                                                        | section  | scope   | source  | edit_level        |
        +-------+----------+----------------+----------+-------------------------------+-----------+---------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------+---------+---------+-------------------+
        | zone1 | observer | 172.xx.xxx.xxx |     2882 | ob_storage_s3_url_encode_type | NULL      | default | Determines the URL encoding method for S3 requests."default": Uses the S3 standard URL encoding method."compliantRfc3986Encoding": Uses URL encoding that adheres to the RFC 3986 standard. | OBSERVER | CLUSTER | DEFAULT | DYNAMIC_EFFECTIVE |
        +-------+----------+----------------+----------+-------------------------------+-----------+---------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------+---------+---------+-------------------+
        1 row in set
        
      2. If the value is default, change it to compliantRfc3986Encoding.

        obclient> ALTER SYSTEM SET ob_storage_s3_url_encode_type='compliantRfc3986Encoding';
        

        For more information about this parameter, see ob_storage_s3_url_encode_type.

      3. Set the archiving path and specify the mode for deleting archive files by using the delete_mode parameter.

        Use COS as the archive media. Set the archiving path for the tenant mysql_tenant in the sys tenant and configure the delete mode for deleting archive files:

        obclient> ALTER SYSTEM SET LOG_ARCHIVE_DEST='LOCATION=s3://oceanbase-test/backup/archive?host=cos.ap-xxxx.myqcloud.com&access_id=***&access_key=***&delete_mode=delete' TENANT = mysql_tenant;
        

        Use COS as the archive media. Set the archiving path for the current tenant and configure the delete mode for deleting archive files:

        obclient> ALTER SYSTEM SET LOG_ARCHIVE_DEST='LOCATION=s3://oceanbase-test/backup/archive?host=cos.ap-xxxx.myqcloud.com&access_id=***&access_key=***&delete_mode=delete';
        

        In these examples, s3:// indicates that the object storage path is accessed through the S3 protocol. The bucket name is oceanbase-test and the path in the bucket is /backup/archive. The parameters are separated from the path by using ?, and the parameters are separated by using &. The host parameter specifies the endpoint of COS without the bucket name. The access_id and access_key parameters specify the access keys of the COS service. The delete_mode parameter is set to delete.

        Notice

        The archive access protocol cannot be changed during archiving. For example, archiving cannot be changed from S3 to OSS, or from OSS to S3.

      tab Azure Blob Storage

      In V4.3.5, Azure Blob Storage is supported as the archive media starting from V4.3.5 BP3.

      Like Alibaba Cloud OSS, Azure Blob Storage supports the delete_mode and checksum_type parameters. The delete_mode parameter specifies the cleanup mode for the archive files. If you do not explicitly configure the delete_mode parameter, the delete mode is used by default. The checksum_type parameter specifies the verification algorithm for verifying the integrity of the archive files. The supported values are md5 and no_checksum. If you do not explicitly configure the checksum_type parameter, the default value is md5.

      For more information about the parameters, see SET LOG_ARCHIVE_DEST.

      Here are some examples:

      Notice

      • When you use an object storage service as the archive media, the parameters of the object storage path are separated by &. Make sure that the parameter values contain only uppercase and lowercase English letters, numbers, /-_$+=, and wildcard characters. If you enter other characters, the configuration may fail.
      • When you use Azure Blob Storage as the archive media, the prefix of the host parameter must be specified as http:// or https://. By default, Azure Blob Storage enables secure transfer. Therefore, it is accessed by using https://. If you want to access it by using http://, you must disable secure transfer for Azure Blob Storage. For more information, see Azure Blob Storage documentation on the Microsoft website.
      • When you use Azure Blob Storage as the archive media, set the archive path for the mysql_tenant tenant in the system tenant. The cleanup mode is delete, and the verification algorithm is md5.

        obclient> ALTER SYSTEM SET LOG_ARCHIVE_DEST='LOCATION=azblob://oceanbase-test-bucket/backup/archive?host=http://****.blob.core.windows.net&access_id=****&access_key=****&delete_mode=delete&checksum_type=md5' TENANT = mysql_tenant;
        
      • When you use Azure Blob Storage as the archive media, set the archive path for the current tenant in the user tenant. The cleanup mode is delete, and the verification algorithm is md5.

        obclient> ALTER SYSTEM SET LOG_ARCHIVE_DEST='LOCATION=azblob://oceanbase-test-bucket/backup/archive?host=http://****.blob.core.windows.net&access_id=****&access_key=****&delete_mode=delete&checksum_type=md5';
        

      In the preceding examples, azblob:// indicates that Azure Blob Storage is used as the archive media. The bucket name is oceanbase-test-bucket, and the path in the bucket is /backup/archive. The path and parameters are separated by ?, and the parameters are separated by &. host specifies the host address of the bucket, which can be obtained by concatenating the container attribute or connection string of the storage account. access_id specifies the name of the storage account. access_key specifies the access key of Azure Blob Storage. The cleanup mode is delete, and the integrity of the archive files is verified by using the MD5 algorithm.

    • Configure the BINDING attribute (optional)

      The BINDING attribute specifies the priority mode between archiving and business. The attribute supports the Optional and Mandatory modes. If you do not configure the attribute, the default value Optional takes effect.

      • The Optional mode indicates that business takes priority. In this mode, if the archiving speed falls behind the log generation speed, logs may be recycled before they are archived, causing a log stream interruption.

      • The Mandatory mode indicates that archiving takes priority. In this mode, if archiving falls behind the data write speed, data write may fail.

      Here is an example of configuring the BINDING attribute when you use NFS as the archive media in the sys tenant:

      obclient> ALTER SYSTEM SET LOG_ARCHIVE_DEST='LOCATION=file:///data/nfs/backup/archive BINDING=Optional' TENANT = mysql_tenant;
      

      Here is an example of configuring the BINDING attribute when you use NFS as the archive media in the current tenant:

      obclient> ALTER SYSTEM SET LOG_ARCHIVE_DEST='LOCATION=file:///data/nfs/backup/archive BINDING=Optional';
      
    • Configure the PIECE_SWITCH_INTERVAL attribute (optional)

      The PIECE_SWITCH_INTERVAL attribute specifies the interval for switching piece. The value range is [1d, 7d]. If you do not configure the attribute, the default value 1d takes effect.

      Here is an example of configuring the PIECE_SWITCH_INTERVAL attribute when you use NFS as the archive media in the sys tenant:

      obclient> ALTER SYSTEM SET LOG_ARCHIVE_DEST='LOCATION=file:///data/nfs/backup/archive BINDING=Optional PIECE_SWITCH_INTERVAL=1d' TENANT = mysql_tenant;
      

      Here is an example of configuring the PIECE_SWITCH_INTERVAL attribute when you use NFS as the archive media in the current tenant:

      obclient> ALTER SYSTEM SET LOG_ARCHIVE_DEST='LOCATION=file:///data/nfs/backup/archive BINDING=Optional PIECE_SWITCH_INTERVAL=1d';
      
  3. After the configuration is completed, you can query the parameter settings in views.

    The sys tenant can query the parameter settings in the CDB_OB_ARCHIVE_DEST view, and a user tenant can query the parameter settings in the DBA_OB_ARCHIVE_DEST view. For more information about how to query the parameter settings, see Query archive parameters.

Considerations and descriptions after the configuration is completed

  1. After the LOG_ARCHIVE_DEST parameter is successfully configured, the system creates a format file in the directory where the specified backup destination is located. The format file is used to verify the validity of the backup destination and ensure the integrity of data in the destination. Therefore, note the following considerations when you configure a backup destination:

    • If the format file does not exist, the specified directory must be empty. Otherwise, an error -9080 is returned, indicating that the file does not exist.

    • If the format file already exists, its content must pass the verification for the specified parameter to take effect. Otherwise, an error -9081 is returned, indicating that the file does not match. The content verification of the format file mainly checks whether the cluster, tenant, and backup destination type specified in the file are consistent with those in the current operation.

    • If the format file does not exist or its content fails the verification during backup task execution, the task will fail.

  2. After the destination for incremental backup is successfully configured, the destination for subsequent full backup cannot be changed. For example, if the BINDING attribute of the archival path /data/nfs/backup/archive under the NFS system is set to Mandatory and the PIECE_SWITCH_INTERVAL attribute is set to 1d, to change the PIECE_SWITCH_INTERVAL to 2d while retaining the BINDING attribute setting of Mandatory, you still need to specify the value of the other attribute in the command. Otherwise, the attribute without a specified value will use the default value.

    You need to execute the following statements again for the modification.

    • Modification of a user under the system tenant

      obclient> ALTER SYSTEM SET LOG_ARCHIVE_DEST = 'LOCATION=file:///data/nfs/backup/archive BINDING=Mandatory PIECE_SWITCH_INTERVAL=2d' TENANT = mysql_tenant;
      
    • Modification of a user under a user tenant

      obclient> ALTER SYSTEM SET LOG_ARCHIVE_DEST = 'LOCATION=file:///data/nfs/backup/archive BINDING=Mandatory PIECE_SWITCH_INTERVAL=2d';
      
  3. After the archiving destination is set successfully, if the user changes the key information of the object storage due to security or other reasons, it is necessary to update the access_id and access_key information for the configured archiving path. For specific operations, refer to Change the access_id and access_key Information for the Backup Path or Archiving Path.

(Optional) Configure archive lag

OceanBase Database uses the tenant-level parameter archive_lag_target to control the latency of log archiving for the tenant. This parameter supports units of ms, s, m, and h. The default value is 2m, which specifies the maximum interval between two consecutive archive I/O operations and ensures that online logs can be archived in a timely manner, thereby reducing the risk of data loss.

OceanBase Database archives logs by log stream. If a log stream has logs written to it and the time since its last archive exceeds the value specified by the archive_lag_target parameter, the system triggers an archive operation for that log stream to archive all unarchived logs in the log stream.

For example, if the archive_lag_target parameter is set to 120s (2 minutes), each log stream will attempt to trigger an archive operation every 2 minutes (unless other conditions are met, such as the archive buffer being full), ensuring that the interval between two consecutive archive I/O operations for this log stream is less than 2 minutes. If the archive_lag_target parameter is set to 0, the system achieves real-time archiving.

For more information about the archive_lag_target parameter, see archive_lag_target.

Prerequisites

Before you modify the value of the archive_lag_target parameter, make sure that the archive destination has been configured. If the archive destination is not configured, the system will return an error message indicating that the archive destination has not been set when you try to modify the value of the archive_lag_target parameter.

Considerations

  • If the archive media is OSS, NFS, or COS, you can set the archive_lag_target parameter to any value within its valid range. If the archive media is an object storage service (OBS) or other object storage services compatible with the S3 protocol, the value of the archive_lag_target parameter must be greater than or equal to 60s. If you set the value to be less than 60s, the system will return an error.

  • We recommend that you set the archive_lag_target parameter to a reasonable value to avoid frequent I/O operations that may affect system performance, especially when object storage is used. A high value may fail to meet the timeliness requirement for data recovery. Therefore, you need to strike a balance between the RPO and the performance of the archive media based on your business needs.

Procedure

  1. Log in to the database as the tenant administrator of the sys tenant or a user tenant.

  2. Based on your needs, execute the appropriate statement to configure the archive lag.

    Here are some examples:

    • Configure the archive lag for a specified tenant when you are in the sys tenant.

      obclient> ALTER SYSTEM SET archive_lag_target = '120s' TENANT = mysql_tenant;
      

      Notice

      When you configure the archive_lag_target parameter, you cannot use TENANT = all_user to specify all user tenants in the sys tenant.

    • Configure the archive lag for the current tenant when you are in a user tenant.

      obclient> ALTER SYSTEM SET archive_lag_target = '120s';
      

References

Contact Us