admin avatar

使用rclone同步文件到backblaze的教程以及rclone常用命令大全

🕞 by admin

rclone是一款开源的基于golang的文件同步工具,主要特性如下:

始终检查MD5 / SHA1哈希是否具有文件完整性 文件上保留的时间戳 基于整个文件支持部分同步 复制模式仅复制新的/更改的文件 同步(单向)模式,使目录相同 检查模式以检查文件哈希是否相等 可以与网络同步,例如可以与两个不同的云帐户同步 加密后端 缓存后端 块后端 联合后端 可选的FUSE挂载(rclone挂载) 多线程下载到本地磁盘 可以通过HTTP / WebDav / FTP / SFTP / dlna 提供本地或远程文件 基于实验Web的GUI 支持的众多的云存储平台,如OVH,onedrive,google drive等等。。。

backblaze介绍,摘自Wiki百科

Backblaze是数据存储提供商。它提供两种产品: B2云存储-与Amazon S3类似的对象存储服务。计算机备份-一种在线备份工具,允许Windows和macOS用户将其数据备份到异地数据中心。该服务专为企业和最终用户而设计,提供无限的存储空间并支持无限的文件大小。

主要特点是backblaze个人用户有10GB的免费存储容量,但是有读写API等现在。。。

每个用户每天有1GB的免费流量, 2,500个文件同步读取和写入。。。。

backblaze官网

https://www.backblaze.com/zh_CN/

rclone的安装

curl https://rclone.org/install.sh | sudo bash

更多系统安装参考官网文档

https://rclone.org/install/

下面配置rclone同步文件到backblaze

注册backblaze应用密匙,

添加新的应用程序密钥,记住密匙只显示一次

配置rclone

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
rclone config
e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q> n
name> testb2
选择5
1 / 1Fichier
   \ "fichier"
 2 / Alias for an existing remote
   \ "alias"
 3 / Amazon Drive
   \ "amazon cloud drive"
 4 / Amazon S3 Compliant Storage Provider (AWS, Alibaba, Ceph, Digital Ocean, Dreamhost, IBM COS, Minio, etc)
   \ "s3"
 5 / Backblaze B2
   \ "b2"
 6 / Box
   \ "box"
 7 / Cache a remote
   \ "cache"
 8 / Citrix Sharefile
   \ "sharefile"
 9 / Dropbox
   \ "dropbox"
10 / Encrypt/Decrypt a remote
   \ "crypt"
11 / FTP Connection
   \ "ftp"
12 / Google Cloud Storage (this is not Google Drive)
   \ "google cloud storage"
13 / Google Drive
   \ "drive"
14 / Google Photos
   \ "google photos"
15 / Hubic
   \ "hubic"
16 / In memory object storage system.
   \ "memory"
17 / JottaCloud
   \ "jottacloud"
18 / Koofr
   \ "koofr"
19 / Local Disk
   \ "local"
20 / Mail.ru Cloud
   \ "mailru"
21 / Mega
   \ "mega"
22 / Microsoft Azure Blob Storage
   \ "azureblob"
23 / Microsoft OneDrive
   \ "onedrive"
24 / OpenDrive
   \ "opendrive"
25 / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
   \ "swift"
26 / Pcloud
   \ "pcloud"
27 / Put.io
   \ "putio"
28 / QingCloud Object Storage
   \ "qingstor"
29 / SSH/SFTP Connection
   \ "sftp"
30 / Sugarsync
   \ "sugarsync"
31 / Transparently chunk/split large files
   \ "chunker"
32 / Union merges the contents of several remotes
   \ "union"
33 / Webdav
   \ "webdav"
34 / Yandex Disk
   \ "yandex"
35 / http Connection
   \ "http"
36 / premiumize.me
   \ "premiumizeme"

输入上面显示的密匙ID,然后再次输入密匙

看下面代码,自行修改相关密匙和id

Account ID or Application Key ID
Enter a string value. Press Enter for the default ("").
account> 93ofsdljfksljfkdsfkdsf
Application Key
Enter a string value. Press Enter for the default ("").
key> j39re0wr9reiw8s9pdfsjdlkfjsd
Permanently delete files on remote removal, otherwise hide files.
Enter a boolean value (true or false). Press Enter for the default ("false").
hard_delete> 
Edit advanced config? (y/n)
y) Yes
n) No (default)
y/n> n
Remote config
--------------------
[testb2]
type = b2
account = 93ofsdljfksljfkdsfkdsf
key = j39re0wr9reiw8s9pdfsjdlkfjsd
--------------------
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d> y

测试配置是否成功

rclone ls tetb2:filename

rclone sync -v /var/www/test/ tetb2:filename/

同步本地/var/www/test/文件夹下的所有文件到backblaze存储filename目录下

并且使用了-V参数表示显示同步进度。。。

其实sync命令相当于增量更新,也就是说源文件没有的,远程存储上的所有多余的文件都会被删除

第二次执行sycn命令时只同步修改过的文件,

其它文件则跳过~~~~这样就不担心流量和backblaze每日的API限制了

这里的filename文件夹要在backblaze自行创建,否则会报错

下面是rclone的命令

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
 about           关于
  authorize       远程认证.
  cachestats      显示远程存储的缓存
  cat             查看远程文件.
  check           检查文件的差异.
  cleanup         Clean up the remote if possible
  config          配置
  copy            复制文件
  copyto          Copy files from source to dest, skipping already copied
  copyurl         Copy url content to dest.
  cryptcheck      Cryptcheck checks the integrity of a crypted remote.
  cryptdecode     Cryptdecode returns unencrypted file names.
  dbhashsum       Produces a Dropbox hash file for all the objects in the path.
  dedupe          Interactively find duplicate files and delete/rename them.
  delete          Remove the contents of path.
  deletefile      Remove a single file from remote.
  genautocomplete Output completion script for a given shell.
  gendocs         Output markdown docs for rclone to the directory supplied.
  hashsum         Produces an hashsum file for all the objects in the path.
  help            Show help for rclone commands, flags and backends.
  link            Generate public link to file/folder.
  listremotes     List all the remotes in the config file.
  ls              List the objects in the path with size and path.
  lsd             List all directories/containers/buckets in the path.
  lsf             List directories and objects in remote:path formatted for parsing
  lsjson          List directories and objects in the path in JSON format.
  lsl             List the objects in path with modification time, size and path.
  md5sum          Produces an md5sum file for all the objects in the path.
  mkdir           Make the path if it doesn't already exist.
  mount           Mount the remote as file system on a mountpoint.
  move            Move files from source to dest.
  moveto          Move file or directory from source to dest.
  ncdu            Explore a remote with a text based user interface.
  obscure         Obscure password for use in the rclone.conf
  purge           Remove the path and all of its contents.
  rc              Run a command against a running rclone.
  rcat            Copies standard input to file on remote.
  rcd             Run rclone listening to remote control commands only.
  rmdir           Remove the path if empty.
  rmdirs          Remove empty directories under the path.
  serve           Serve a remote over a protocol.
  settier         Changes storage class/tier of objects in remote.
  sha1sum         Produces an sha1sum file for all the objects in the path.
  size            Prints the total size and number of objects in remote:path.
  sync            Make source and dest identical, modifying destination only.
  touch           Create new file or change file modification time.
  tree            List the contents of the remote in a tree like fashion.
  version         Show the version number.

熟悉Linux的应该很容易理解上面的命令

💘 相关文章

写一条评论