Tiered storage (data archiving)
The tiered storage feature of ApsaraDB for MongoDB allows you to archive infrequently accessed collection data from high-performance local storage to Object Storage Service (OSS) to free up local storage space. This feature is in invitation-only preview and is available only for eligible MongoDB 8.0 replica set instances that have been upgraded to a specific minor version.
Feature overview
Tiered storage deeply integrates the WiredTiger storage engine with OSS. At the collection level, tiered storage uploads all data files of a collection from local disks to cold storage in OSS. After a collection is archived, the system releases the local storage space occupied by the collection and retains the collection metadata and index definitions so that the data can be restored when the collection is unarchived.
Tiered storage is suitable for the following scenarios:
-
Log data must be retained at low cost after the active query period ends.
-
Historical orders, transaction records, and other data must be retained for an extended period to meet compliance requirements but are infrequently accessed.
-
Business data continues to grow, resulting in insufficient local disk capacity and a need to free up storage space.
Prerequisites
Before you use tiered storage, make sure that your instance meets the following requirements.
|
Item |
Requirement |
|
Instance type |
Replica set instance. |
|
Storage engine |
WiredTiger. |
|
Major version |
The major version must be MongoDB 8.0. MongoDB 4.x, 5.0, 6.0, and 7.0 do not support tiered storage. Upgrade the instance to MongoDB 8.0 first. For more information, see Upgrade database major version. |
|
Minor version |
The instance must run a specific minor version that supports tiered storage. This feature is in invitation-only preview and is not included in a generally available minor version. Technical support confirms instance eligibility and the target minor version, and then performs the upgrade. For more information, see Apply for tiered storage. |
Apply for tiered storage
Tiered storage requires a specific minor version. Self-service upgrade to this version is not yet available from Minor Version Upgrade in the console. Technical support must confirm instance eligibility and upgrade the target instance.
-
Make sure that the target instance meets the prerequisites.
-
Prepare the ID of the instance for which you want to enable the feature, such as
dds-bp1xxxxxxxxxxxxx. If you want to enable the feature for multiple instances, prepare a list of instance IDs. -
Submit a ticket or contact your technical support representative to apply for the feature, and provide the following information:
-
Instance ID. This field is required. You can provide multiple instance IDs.
-
The region of the instance.
-
The preferred time window for enabling the feature.
-
-
Wait for technical support to grant the instance eligibility for the feature and upgrade the instance to a minor version that supports tiered storage.
ImportantThe upgrade triggers a rolling restart and a switchover between the primary and secondary nodes. Connections may be interrupted for a few seconds. Make sure that your application can automatically reconnect, and ask technical support to schedule the upgrade during off-peak hours.
-
After the feature is enabled, verify that Data Archiving is available for the instance.
For a MongoDB 8.0 instance that has not been upgraded to the required minor version, the Data Archiving page may not appear in the console or the console may indicate that the feature is not supported. This is expected and does not indicate an issue with the instance.
Enable tiered storage
-
Log on to the ApsaraDB for MongoDB console.
-
In the left-side navigation pane, choose Replica Set Instances and find the target instance.
-
Click the ID of the target instance to go to the Basic Information page.
-
In the left-side navigation pane, choose Data Archiving.
-
When you use the feature for the first time, click Enable Tiered Storage.
The system automatically creates an OSS bucket and configures authorization. The feature typically takes 1 to 2 minutes to enable. During this period, the instance continues to provide services as expected and your existing workloads are not affected.
-
Verify that the Configure Tiered Storage and Archived Cold Data tabs appear on the page.
The two tabs display collections in local storage and collections archived to OSS, respectively.
Archive a collection
Archive a local collection to cold storage in OSS to free up local disk space.
After you submit an archiving task, the target collection immediately becomes read-only. All write and DDL operations fail until the task is complete. Before you archive a collection, make sure that the collection no longer receives write traffic.
-
On the Data Archiving page, click the Configure Tiered Storage tab.
-
Select the target collection from the collection list.
NoteYou can archive only one collection at a time.
-
Click Archive, confirm the collection information, and then click OK.
-
View the archiving progress in Task Center.
During archiving, the target collection can be read but not written.
-
After archiving is complete, verify that the collection is moved from the hot data list to the cold data list.
The system releases the local storage space occupied by the collection.
The archiving speed depends on the amount of data in the collection. In most cases, the archiving throughput is approximately 30 MB/s. For example, archiving a 150 GB collection takes approximately 85 minutes. Actual duration may vary.
Unarchive a collection
An archived collection can be read but not written. To insert, update, or delete data in the collection, restore the cold data to local storage so that the collection supports normal read and write operations.
After you submit an unarchiving task, the target collection becomes completely inaccessible. All read and write operations fail until the task is complete. Unarchiving a 150 GB collection takes approximately 5 to 7 hours. Reserve a service downtime window in advance.
-
On the Data Archiving page, click the Archived Cold Data tab.
-
Select the target collection from the list of archived collections.
-
Click Unarchive, confirm the collection information, and then click OK.
-
View the unarchiving progress in Task Center.
During unarchiving, the target collection is inaccessible.
-
After unarchiving is complete, verify that the collection is moved from the cold data list to the hot data list and supports normal read and write operations.
Unarchiving is slower than archiving. In most cases, the unarchiving throughput is approximately 8 to 10 MB/s, and initialization also takes time. For example, unarchiving a 150 GB collection takes approximately 5 to 7 hours. Unarchive collections during off-peak hours and reserve sufficient time. Actual duration may vary.
Collection read and write capabilities
The read and write capabilities of a collection vary based on its state. Before you perform an operation, make sure that your workloads can tolerate the corresponding limits.
|
Collection state |
Read |
Write (insert, update, and delete) |
Description |
|
Hot data (not archived) |
Supported. |
Supported. |
The collection can be read and written as expected. |
|
Being archived |
Supported. |
Not supported. |
After the archiving task starts, the collection immediately becomes read-only until the task is complete. |
|
Cold data (archived) |
Supported. |
Not supported. |
The collection is read-only. Write operations return errors. To restore write access, unarchive the collection first. |
|
Being unarchived |
Not supported. |
Not supported. |
The collection is inaccessible, and all read and write operations fail. |
|
Unarchiving complete (hot data) |
Supported. |
Supported. |
The collection supports normal read and write operations. |
View the archiving status
On the Data Archiving page, use the Configure Tiered Storage and Archived Cold Data tabs to view the distribution status of collections. The page displays information such as database names, collection names, and data sizes. Collections that are being archived or unarchived display task progress.
Limits
|
Limit |
Description |
|
Version |
Only MongoDB 8.0 instances that have been upgraded to a specific minor version are supported. |
|
Archiving granularity |
You can archive only an entire collection. You cannot archive a subset of data based on document-level criteria. |
|
Access after archiving |
Archived collections are read-only. Insert, update, and delete operations are not supported. To modify data, unarchive the collection first. |
|
Access during unarchiving |
During unarchiving, the target collection is inaccessible and does not support read or write operations. |
|
System collections |
Collections in system databases such as |
|
Indexes |
Archiving and unarchiving operations include collection indexes. The system retains index definitions. During unarchiving, the collection and its indexes are inaccessible. |
|
Concurrent operations |
Only one archiving or unarchiving task can run on an instance at a time. |
|
Disk space |
Before you unarchive a collection, make sure that the local disk has enough available space for the collection data to be restored. Insufficient available space may cause the unarchiving task to fail. |
|
Replica set synchronization |
Archiving and unarchiving operations are synchronized to all replica set members, including secondary and hidden nodes. |
|
Backup compatibility |
Regular physical backups do not include archived collections. Therefore, when you restore an instance from a regular physical backup, the restored instance does not include archived collections. Cold data durability and reliability are ensured by the multi-replica mechanism of OSS. To manage cold data in backup and restoration scenarios, submit a ticket or contact technical support. |
Precautions
-
Version upgrade: Upgrading to a minor version that supports tiered storage triggers a rolling restart and a switchover between the primary and secondary nodes. Make sure that your application can automatically reconnect and reserve an upgrade window.
-
Write restrictions after archiving: After an archiving task starts, the target collection immediately becomes read-only. All write operations (insert, update, and delete) and DDL operations such as creating indexes on the collection fail. Before you archive a collection, make sure that the collection no longer receives write traffic. If your workloads are still writing to the collection, redirect or stop the write traffic first.
-
Access restrictions during unarchiving: During unarchiving, the collection is completely inaccessible, and all read and write operations fail. After unarchiving is complete, the collection automatically supports normal read and write operations. No additional operations are required.
-
Unarchiving duration: The bandwidth for downloading data from OSS is lower than the bandwidth for uploading data to OSS. In addition, the restoration process involves rebuilding and verifying WiredTiger data files. Therefore, unarchiving typically takes three to five times as long as archiving. Before you archive a collection, evaluate whether your workloads can tolerate several hours of downtime when the collection is unarchived in the future.
-
Operation window: Archive and unarchive collections during off-peak hours to minimize the impact of tasks on the read and write performance of other collections in the instance.
-
Task exceptions: If an archiving or unarchiving task does not make progress for an extended period or fails, submit a ticket or contact technical support.