The data download feature of Cloud Storage Gateway (CSG) allows you to download data from the bucket associated with a share in replication mode to a local client.
Prerequisites
A file gateway is created, and a cache disk is attached to it. For more information, see Manage file gateways and Attach a cache disk.
An OSS bucket is created. For more information, see Get started by using the OSS console.
ImportantFile gateways support the following storage classes of OSS buckets: Standard, Infrequent Access (IA), and Archive. File gateways do not support OSS buckets for which back-to-origin routing is configured.
We recommend that you do not associate a gateway with an Archive bucket. If files that are written from a file gateway to OSS are infrequently modified, we recommend that you store the files in a Standard or IA bucket first and configure a lifecycle rule that changes the storage class of the files to Archive or Cold Archive. This reduces unnecessary restoration operations and optimizes storage costs and efficiency.
When a client writes a file to a file gateway, the gateway records at least two actions: writing the file and setting the file modification time. The gateway merges the two actions where possible. However, the gateway may still initiate multiple operations on the object to the bucket where the object is stored. The CopyObject operation is called to store the file modification time as a piece of metadata of the object in the bucket. If the object is an Archive or Cold Archive object, this operation requires object restoration, which takes some time to complete. This increases the time required for object uploads and even causes upload failures if not enough time is left to upload data in the cache.
Reverse synchronization or express synchronization is enabled for the file gateway. For more information, see Configure express synchronization.
Background information
By default, a file gateway synchronizes metadata in the associated OSS bucket to the local client by using reverse synchronization or express synchronization. In replication mode, two backups are created. One is stored in the OSS bucket, and the other is stored on the local client. The data download feature allows you to download data within a specific directory or all data in a share to a local client based on the metadata synchronized by using reverse synchronization or express synchronization.
Data transmission over the Internet incurs OSS service fees. You can determine whether to enable this feature based on your actual business requirements. For more information, see Billing.
Enable data download during share creation
On the Gateways page of the CSG console, click the ID of the file gateway. On the tab, click Create.
In the Create Share wizard, complete the Bucket Settings and Basic Information steps. Make sure that you select the Advanced Settings check box in the Basic Information step. For more information, see Create a share.
In the Advanced Settings step, configure the parameters described in the following table and any additional parameters, and click Next.
Parameter
Description
Mode
Select Replication Mode.
Reverse Sync
Select Yes to enable reverse synchronization. Reverse synchronization synchronizes metadata in the associated OSS bucket to the local client. This feature is suitable for gateway disaster recovery, data restoration, and data sharing.
Reverse synchronization is triggered only when you access the specified directories. To ensure that the data in other directories can be downloaded and new data can be downloaded in real time, you can enable the express synchronization feature. For more information, see Configure express synchronization.
NoteDuring a reverse synchronization process, the system scans all objects in the bucket. If the bucket contains a large number of objects, you are charged for calling the OSS API. For more information, see the API Operation Calling Fees section on the OSS pricing page.
If you select the Add to Sync Group check box in the Basic Information step, the Reverse Sync parameter is unavailable.
Reverse Sync Interval
Valid values: 15 to 36000. Unit: seconds.
NoteIf the bucket contains a large number of objects, we recommend that you set the interval to a value greater than 3,600 seconds. Otherwise, repeated scans result in frequent OSS API calls. This causes an increase in fees generated by OSS API calls.
Replication Mode Advanced Settings
Select the Replication Mode Advanced Settings check box.
On the Replication Mode Advanced Settings page, configure the following parameters to enable data download.
Parameter
Description
Configure Directory in Replication Mode
Select the directories to which the replication mode applies.
If you do not select this check box, the replication mode applies to all directories in the share.
If you select the check box, click Add Directory to specify a directory that contains the data to which you want to apply the replication mode. The replication mode is applied to the specified directories. The rest of the data uses the cache mode.
NoteIf you change the mode of a directory from cache to replication, the files in the directory can be synchronized only when the data download feature is also enabled. We recommend that you enable the data download feature if you use the replication mode.
To specify a directory, use its path relative to the mount point of the share. For example, if the directory to which you want to apply the replication mode is /mnt/myshare/mydir/ and the mount point is /mnt/myshare, you can enter /mydir/.
Data Download
If you enable the data download feature, reverse synchronization or express synchronization synchronizes both data and metadata. If you do not enable the data download feature, only metadata is synchronized.
NoteIf you download data in replication mode, the capacity of the cache disk must be greater than 1.1 times the total size of the files that you want to replicate. Plan the cache capacity based on the expected growth of the bucket usage.
When you enable the data download feature for the first time, a full scan is triggered. This process may reduce the performance of the gateway. We recommend that you enable the data download feature during off-peak hours and wait for the system to replicate all the data.
The data download feature allows only one user to write data to the bucket and multiple users to read data from the bucket at the same time. If multiple users access the bucket at the same time (including but not limited to direct access or access through the gateway), only one user can upload files to the bucket, and other users can only download data. Data loss may occur if multiple users write data to and read data from the bucket at the same time.
Download Speed Limit
This parameter is available only if you enable the Data Download feature. The maximum download speed limit is 1,280 MB/s. The value range of the parameter is 0 to 1280. If you set this parameter to 0, the download speed is unlimited.
Reverse Sync Interval
If you enable Data Download, you must configure this parameter. Valid values: 3600 to 36000. Unit: seconds.
NoteIf the bucket contains a large number of objects, we recommend that you set the interval to a value greater than 3,600 seconds. Otherwise, repeated scans result in frequent OSS API calls. This causes an increase in fees generated by OSS API calls.
Reverse synchronization is triggered only when you access the directory. To make sure that the data in other directories can be downloaded and new data can be downloaded in real time, we recommend that you use express synchronization.
Enable data download for an existing share
On the Gateways page, click the ID of the file gateway.
On the Shares tab, find the share and click Advanced Settings in the Actions column.
In the dialog box that appears, configure the parameters described in the following table to enable data download.
Parameter
Description
Mode
Data download is supported only in replication mode.
Reverse Sync
Select Yes to enable reverse synchronization. Reverse synchronization synchronizes metadata in the associated OSS bucket to the local client. This feature is suitable for gateway disaster recovery, data restoration, and data sharing.
Reverse synchronization is triggered only when you access the specified directories. To ensure that the data in other directories can be downloaded and new data can be downloaded in real time, you can enable the express synchronization feature. For more information, see Configure express synchronization.
NoteDuring a reverse synchronization process, the system scans all objects in the bucket. If the bucket contains a large number of objects, you are charged for calling the OSS API. For more information, see the API Operation Calling Fees section on the OSS pricing page.
If you select the Add to Sync Group check box in the Basic Information step, the Reverse Sync parameter is unavailable.
Data Download
If you enable the data download feature, reverse synchronization or express synchronization synchronizes both data and metadata. If you do not enable the data download feature, only metadata is synchronized.
NoteData replication requires the capacity of the cache disk to be greater than 1.1 times the file size to be replicated. Specify the cache capacity based on the expected growth of the bucket usage.
When you enable the data download feature for the first time, a full scan is triggered. This process may reduce the performance of the gateway. We recommend that you enable the data download feature during off-peak hours and wait for the system to replicate all the data.
The data download feature allows only one user to write data to the bucket and multiple users to read data from the bucket at the same time. If multiple users access the bucket at the same time over the gateway or OSS bucket, only one user can upload files to the bucket. Other users can only download data. Data loss may occur if multiple users write data to and read data from the bucket at the same time.
Download Speed Limit
This parameter is available only if you enable the Data Download feature. The maximum download speed limit is 1,280 MB/s. The value range of the parameter is 0 to 1280. If you set this parameter to 0, the download speed is unlimited.