Alibaba Cloud OSS cloud storage service can help individual and enterprise users save resources. Compared to using your own server for storage, it offers higher stability, faster speed, greater efficiency, and lower cost, making it very suitable for websites that need to provide downloads or display a large number of files. Besides normal cloud storage usage, we can also use OSS for website backups or temporary resource forwarding. Today, while migrating a client's server, Naiba used this service and took the opportunity to document how to use the ossutil tool to upload files to OSS and then download files from OSS on the new server.
Usage scenario:- Server A, configuration: 1 core, 1GB RAM, 5Mbps bandwidth
- Server B, configuration: 2 cores, 8GB RAM, 6Mbps bandwidth
- The compressed website data on Server A is 4GB in size, with a maximum download speed of 600kb/s. Moving data from A to B would be very slow.
Therefore, Naiba adopted OSS as an intermediate network drive to temporarily store data. (A and B are not in the same region, or perhaps the firewall rules are not open. The client did not provide the Alibaba Cloud backend account, so internal network transfer is not possible.)
Solution:Purchase an
Alibaba Cloud OSS service(discount package: 6 RMB for 6 months), then use the ossutil tool on both servers A and B to upload and download website backup data.
ossutil tutorial
Create a RAM account
Open the
RAM Access Controlpage, User, Create User, then assign permissions to the account to obtain the
accessKeyID和
accessKeySecret。

Save the obtained accessKeyID and accessKeySecret values securely.
Install and configure ossutil
1. Download ossutil on the server
wget http://gosspublic.alicdn.com/ossutil/1.6.10/ossutil64 2. Modify file permissions
chmod 755 ossutil643. Configure ossutil
./ossutil64 config
请输入配置文件名,文件名可以带路径(默认为:/home/user/.ossutilconfig,回车将使用默认路径。如果用户设置为其它路径,在使用命令时需要将--config-file选项设置为该路径):
未输入配置文件路径,将使用默认配置文件:/home/user/.ossutilconfig。
对于下述配置,回车将跳过相关配置项的设置,配置项的具体含义,请使用"help config"命令查看。
请输入endpoint:
请输入accessKeyID:yourAccessKeyID
请输入accessKeySecret:yourAccessKeySecret
请输入stsToken:
4. Copy the OSS endpoint address

5. Fill in the endpoint, accessKeyID, and accessKeySecret into the configuration information respectively.
Use ossutil to upload and download files
The command to upload a single file is as follows:
./ossutil64 cp 要上传的文件名 oss://路径The command to download a single file is as follows:
./ossutil64 cp oss://路径/文件名 /服务器路径That's it, you can quickly transfer large files between the two hosts via OSS. Official documentation: https://help.aliyun.com/document_detail/50452.html?spm=a2c4g.11174283.6.1275.24747da2SQFT45
Comments are closed
The comment function for this article is closed. If you have any questions, please feel free to contact us through other channels.