By Johnson Chiang, Solutions Architect
This article will demonstrate a file sharing service solution for file sharing cross region, between on-premise IT environment and public cloud.
The main components of this solution architecture include Cloud Storage Gateway (CSG) and Object Storage Service (OSS) as the backend to offer following considerable benefits:
Such architecture would be especially useful to achieve network resilience when transferring file in- and out- China to international locations. You will also walk through how to implement an example to fulfill the file sharing needs for China region's and international region's consumers.
What You Will Build
For demonstrating the cross-region and hybrid-cloud file sharing scenario, we will build following topology which consists an online CSG file gateway in China side, an on-premises CSG file gateway in overseas side, and an OSS bucket to be the backend storage of both file gateways. For OSS bucket, we choose Hong Kong region which is geographically closest to both China and our data center in Taiwan.
The following steps gives an outline of the overall flow of the implementation:
Let's us now look at the detailed steps of the implementation.
First, create an OSS bucket, with a preferred name like oss-file-sharing
. The OSS bucket will be associated with two File Gateway instances to mount in our file sharing architecture. In this example, we chose Hong Kong
region which would work best for the File Gateway and client in Taiwan IDC.
This section guides you through sample tasks to deploy an online CSG instance and create the File Gateway.
Create a Gateway Cluster (for example, CSG-Cluster-BJ
)
Create a Gateway instance (for example, named CSG-BJ
)
Alibaba Cloud
for online deploymentFile Gateway
VPC-BJ
)VSwitch-BJ
) Create a NFS share by using gateway management console:a
Cache_b
) in Caches tab BackendOSS
) in Cloud Resources tab share1nfs
Yes
BackendOSS
)Cache_b
)192.168.1.131
as shown below in our CSG instance) This section covers the steps of operating an ECS-hosted Linux client to mount the remote NFS mount point shared by the CSG File Gateway. And then we write some files to the mounted directory and verify the newly written files are synchronized to the OSS bucket.
Log on to an ECS server in the same VPC and VSwitch (VPC-BJ
and VSwitch-BJ
) with the CSG instance created in Step 2 (CSG-BJ
).
On the ECS, mount the remote NFS-shared directory (for example, /share1nfs
). And then copy files (for example file1
, file2
, file3
) to the mounted directory.
bj-ecs# showmount -e 192.168.1.131
Export list for 192.168.1.131:
/mnt/36800fa0-d0dd-4a92-bc33-095ee6e535a7/nfsexport1 192.168.1.0/24
bj-ecs# mkdir csg-share
bj-ecs# mount 192.168.1.131:/share1nfs csg-share/
bj-ecs# df -h
Filesystem Size Used Avail Use% Mounted on
... (skipped)
192.168.1.131:/share1nfs 80G 0 80G 0% /home/csg-share
bj-ecs# cp file1 file2 file3 /home/csg-share
bj-ecs# ll /home/csg-share
total 4
drwxrwxrwx 2 root root 0 Jan 11 01:27 ./
drwxr-xr-x 3 root root 4096 Jan 19 14:35 ../
-rw-r--r-- 1 root root 36 Jan 19 14:38 file1
-rw-r--r-- 1 root root 36 Jan 19 14:38 file2
-rw-r--r-- 1 root root 36 Jan 19 14:38 file3
bj-ecs# tail -n +1 file*
==> file1 <==
this is file1 uploaded by ECS in BJ
==> file2 <==
this is file2 uploaded by ECS in BJ
==> file3 <==
this is file3 uploaded by ECS in BJ
Check the OSS console and see that the files have been transferred from the CSG File Gateway in Beijing to the OSS bucket oss-file-sharing in Hong Kong.
Now, deploy an on-premises CSG instance and a File Gateway by following instructions at How to Install Cloud Storage Gateway. Alternatively, you can opt to deploy an online CSG instance in another Alibaba Cloud region by following instructions at Step 2.
You will need to log on to the CSG web console to configure the required settings: Caches, Cloud Resources, and CIFS settings. Following shows the configurations of the CIFS share for example:
Notice that we select Sync Mode
for Data Access Mode and Yes
for Enable Remote Sync.
Above screenshot shows that a SMB User named user2 is added for the SMB Share.
Next, you operate a Windows system, which is in an intranet with the CSG instance created at Step 4., to mount the CIFS share (for example, \\192.168.5.36\share2
) as network drive. You can now see those 3 files under the mounted directory which maps to the backend OSS bucket (namely oss-file-sharing
).
So far, you have completed the architecture where 2 cross-region clients being able to access NAS filesystem, shared by a near-client CSG. Now you can further test to do write and read operations using either client, and the CSG will transparently synchronize and map the its file structure to the one backend OSS bucket.
Featured by CSG file gateway and OSS, we can now implement a simple and effective architecture for sharing and distribution of files. In addition, the NAS-based filesystem reserves the convention usage of file management user interface.
Given the base of cross region and hybrid (online and on-premises) architecture, now you will be able to make tweaks to adapt to variations of scenarios.
To learn more about CSG, refer to https://www.alibabacloud.com/product/sgw.
You can refer to the following documentation for additional information.
2,599 posts | 762 followers
FollowAlibaba Clouder - January 9, 2020
afzaalvirgoboy - December 26, 2019
Alibaba Clouder - March 9, 2021
Alibaba Container Service - April 17, 2024
Alibaba Cloud Storage - March 3, 2021
ray - April 25, 2024
2,599 posts | 762 followers
FollowAn encrypted and secure cloud storage service which stores, processes and accesses massive amounts of data from anywhere in the world
Learn MoreCloud Storage Gateway uses OSS for cloud-based storage at the back end, and supports standard file and block storage protocols in the industry.
Learn MoreSimple, scalable, on-demand and reliable network attached storage for use with ECS instances, HPC and Container Service.
Learn MoreMore Posts by Alibaba Clouder