This topic describes how to use a file gateway on the on-premises console.
Prerequisites
An Alibaba Cloud account is created and real-name verification for the account is complete. For more information, see Create an Alibaba Cloud account.
NoteCreate a RAM user and log on to the CSG console as the RAM user.
The Cloud Storage Gateway service is activated. When you log on to the Cloud Storage Gateway console for the first time, follow the on-screen instructions to activate the service.
-
You have deployed the on-premises console for your file gateway.
An OSS Bucket is created.
ImportantA file gateway supports only OSS Buckets of the Standard, Infrequent Access (IA), and Archive storage classes. OSS Buckets with the back-to-source feature enabled are not supported.
Avoid connecting a gateway directly to an Archive OSS Bucket. If files will not be modified for a long time after being written, consider using a Standard or IA bucket. You can then use lifecycle rules to transition the storage class of the objects to Archive or Cold Archive. This approach is more cost-effective and efficient because it avoids unnecessary restore operations.
When a client writes a file to the gateway, the gateway records at least two actions: writing the file and setting the file's modification time. The gateway attempts to merge these actions, but may still initiate multiple operations on the OSS Bucket for a single file. Setting the modification time translates to modifying the object's metadata in the OSS Bucket by using the CopyObject API. For Archive or Cold Archive objects, this requires a time-consuming restore operation, which can slow down uploads and even cause write failures if the cache disk does not have enough space to upload the data in time.
-
You have added a disk.
Add a cache disk
Each shared folder requires a unique cache disk. A cache disk is used to upload data from a shared folder to Alibaba Cloud OSS and to synchronize data from OSS to your on-premises environment.
-
In a web browser, enter
https://<IP address of your file gateway>to access the on-premises console for the file gateway. -
Enter your username and password, and then click OK.
-
On the Cache Settings page, click Create.
-
In the Create Cache dialog box, configure the following parameters.
-
Hard disk: Click Select and choose an available disk.
Disks are available here only after you add a disk on the deployment platform.
-
File system: This is an optional feature. To recover data from a cache disk when you recreate a share, select this option to enable data reuse. This allows you to recover data by recreating the share if it was accidentally deleted.
NoteIf no file system exists on the cache disk (that is, the cache disk is empty or not initialized), selecting this option causes the cache creation to fail.
-
-
Click OK to add the cache disk.
Bind a cloud resource
Create shared resources that use OSS buckets as backend storage. A file gateway supports multiple cloud resources, with each shared resource corresponding to one bucket.
By default, data written to a Cloud Storage Gateway from a client is uploaded to the OSS bucket in real time. You can also configure a sync delay of up to 120 seconds when you create a share.
Depending on your business requirements, you can bind a cloud resource by using the standard method or the custom method.
Standard method
-
On the on-premises console for the file gateway, go to the Cloud Resource Settings page and click Bind.
-
In the Bind Cloud Resource dialog box, configure the following parameters.
Parameter
Description
Resource name
Enter a name for the cloud resource.
cross-region binding
Configure cross-region binding.
-
Yes: Allows the file gateway to access an OSS bucket in a different region.
-
No: Allows the file gateway to access only a bucket in the same region.
NoteTo ensure accurate data synchronization, logging, and operations management, the time zones of the file gateway and the OSS bucket must be identical.
region
Select the region where the bucket is located.
Bucket name
Select the bucket that you want to bind.
Use SSL
If you select Yes, the gateway uses SSL to access the OSS bucket.
-
-
Click OK to bind the cloud resource.
Custom method
-
On the on-premises console for the file gateway, go to the Cloud Resource Settings page and click Bind.
-
In the Bind Cloud Resource dialog box, configure the following parameters.
Parameter
Description
Resource name
Enter a name for the cloud resource.
Use custom region
Select Use Custom Region.
endpoint
The endpoint of the OSS bucket. Example: oss-cn-hangzhou.aliyuncs.com
Bucket name
Enter the name of the OSS bucket that you want to bind.
AccessKey ID
Enter your Access Key ID.
AccessKey Secret
Enter your Access Key Secret.
Use SSL
If you select Yes, the gateway uses SSL to access the OSS bucket.
-
Click OK to bind the cloud resource.
Create a share
On-premises file gateways support NFS shares and SMB shares. Select a share type based on your requirements. This topic uses an NFS share as an example.
-
Return to the on-premises console for the file gateway. On the NFS page, click Create.
-
In the Create NFS Share dialog box, configure the following parameters, and then click OK.
Parameter
Description
Share name
The virtual path for the NFS protocol.
For NFSv4, you can mount the share directly by using this name. For NFSv3, you must run the
showmount -e <gateway IP address>command to obtain the virtual path.Read/write client IPs
The IP addresses or CIDR blocks of clients granted read/write access to the NFS share.
Example: 192.168.10.10 or 192.168.0.0/24. You can enter multiple IP addresses or CIDR blocks.
The IP addresses or CIDR blocks of clients granted read-only access to the NFS share.
Example: 192.168.10.10 or 192.168.0.0/24. You can enter multiple IP addresses or CIDR blocks.
Read-only client IPs
User mapping
Sets the mapping between users on the NFS client and users on the NFS server.
NoteThis parameter is configurable only when the Protocol is set to NFS.
-
none: An NFS client user is not mapped to the nobody user on the NFS server.
-
root_squash: Restricts the root user. When an NFS client accesses the share as the root user, the client is mapped to the nobody user on the NFS server.
-
all_squash: Maps all users from an NFS client to thenobodyuser on the NFS server. -
all_anonymous: Maps all users from an NFS client to the NFS server's anonymous user.
Enable
Enable the NFS share.
To disable the NFS share, select No.
Mode
Includes cache mode and replication mode.
-
Replication mode: All data is saved in two copies: one in the offline cache and the other in OSS.
-
Cache mode: Caches all metadata and frequently accessed user data locally. OSS retains the complete dataset.
Reverse Sync
Synchronizes metadata from OSS back to a local environment. This applies to gateway disaster recovery, data recovery, and data sharing scenarios.
NoteA reverse sync operation scans all objects in a bucket. This process incurs OSS API request fees if the bucket contains a large number of objects.
Bucket Name
Select the created Bucket.
Path prefix
Enter the path prefix in the bucket.
Path prefixes support only English letters and numbers.
NoteStarting from version 1.0.38, you can mount the root directory of a file system to a specific path prefix in an OSS bucket to facilitate access isolation.
The path prefix can be an existing directory or a new directory in the OSS bucket. After the share is created, this path prefix will serve as the root directory, and all subsequent files and directories will be created under it.
Using a metadata disk
Using a metadata disk separates the data disk from the metadata disk. The metadata disk is used to store metadata for shared folders.
-
If you select Yes, you must select the corresponding metadata disk and data disk.
-
If you select No, you must select the corresponding cache disk.
NoteOnly whitelisted users can use this feature.
Ignore Deletion
File deletions are not synchronized to OSS to prevent accidental operations. OSS retains the complete dataset.
NFS v4 optimization
Improves upload efficiency for NFSv4 mounts. After you enable this option, you can no longer mount by using NFSv3.
Synchronization Delay
Set Sync Delay. This setting delays file uploads for a period of time after the files are closed to prevent frequent offline modifications from creating OSS fragments. The default value is 5 s, and the maximum value is 120 s.
Maximum Write Speed
The maximum write speed is 1280 MB/s. The default value is 0, which indicates that the speed is unlimited.
Maximum Upload Speed
The maximum upload speed is 1280 MB/s. The default value is 0, which indicates no speed limit.
NoteWhen speed is limited, the maximum upload speed cannot be less than the maximum write speed.
Fast Cache Reclaim
Real-time cache reclamation is suitable for backup-only cloud scenarios.
-
-
Click Confirm to create the share.
Access the share
After the share is created, use an NFS client to access the NFS shared folder.