Publish: 2016-06-14 | Modify: 2016-06-14
VPS data backup is an important task. Previously, in the article "Automatically Backup VPS Data Using Qiniu Cloud Storage", I shared how to use the QRSBox tool provided by Qiniu Cloud Storage to backup data. In this article, I will introduce another tool called qrsync provided by Qiniu. Qrsync supports resumable uploads and incremental synchronization. It can synchronize files from a local directory to Qiniu Cloud Storage. It can handle hundreds of GBs or even TBs of files without any problem.
mkdir qrsync
cd qrsync
wget http://devtools.qiniu.com/qiniu-devtools-linux_amd64-current.tar.gz
wget http://devtools.qiniu.com/qiniu-devtools-linux_386-current.tar.gz
tar -zxvf qiniu-devtools-linux_amd64-current.tar.gz
qrsync reads a JSON data as the configuration file. If you have some development experience, it is not difficult to understand the following JSON configuration file:
vi config.json
Copy the following content into the config.json file and modify the parameters as needed:
{
"src": "/home/your/sync_dir",
"dest": "qiniu:access_key=<AccessKey>&secret_key=<SecretKey>&bucket=<Bucket>&...",
"debug_level": 1
}
src
: The local source directory path. For example, in the above configuration file, /home/your/sync_dir
is the directory to be uploaded.AccessKey
and SecretKey
: After you register a Qiniu Cloud Storage account, you will have a unique AccessKey
and SecretKey
, which can be viewed in the personal panel -> key management.debug_level
: If debug_level
is set to 1, necessary logs will be obtained. Setting it to 0 will provide detailed logs.Below is a JSON configuration file from Xiaoz's blog. It means that all the contents in the /home/test
folder will be uploaded to the Qiniu space named xzbk
:
{
"src": "/home/test",
"dest": "qiniu:access_key=<AccessKey>&secret_key=<SecretKey>&bucket=xzbk",
"debug_level": 1
}
touch /home/test/abc.txt
./qrsync config.json
If the upload is successful, you will see the prompt "Sync done!". Then, log in to the Qiniu Cloud Storage console, find the xzbk
space, and you will see that the abc.txt
file has been successfully uploaded.
Users who have successfully completed Qiniu real-name authentication have 10GB of free space and 10GB of free traffic. By participating in the Qiniu Cloud Storage Green Startup Plan, you can also receive a 1000 yuan voucher for free. Using the qrsync tool to backup VPS data is a very good choice, and the upload and download speed of Qiniu Cloud Storage is very satisfactory. You may give it a try.
This article only shares the usage of the Linux client. Qrsync also supports the Windows client. For more instructions and support, please refer to the official documentation: qrsync Command Line Upload and Synchronization Tool
Recommended Readings:
I come from China and I am a freelancer. I specialize in Linux operations, PHP, Golang, and front-end development. I have developed open-source projects such as Zdir, ImgURL, CCAA, and OneNav.