Appearance
本地备份也还是具有风险,这时使用网盘来二次备份
Rclone下载安装
使用脚本在系统上安装 rclone,运行:
curl https://rclone.org/install.sh | sudo bash
1
初始化配置
安装完成后输入:
rclone config
1
可以看到:
No remotes found, make a new one?
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n
name> onedrive
1
2
3
4
5
6
7
2
3
4
5
6
7
输入 n
新建一个配置,name
为你的配置名称,可以自定义,这里我输入的是 onedrive
。
然后会出现挂载的服务类型,如下:
Option Storage.
Type of storage to configure.
Choose a number from below, or type in your own value.
1 / 1Fichier
\ (fichier)
2 / Akamai NetStorage
\ (netstorage)
3 / Alias for an existing remote
\ (alias)
4 / Amazon Drive
\ (amazon cloud drive)
5 / Amazon S3 Compliant Storage Providers including AWS, Alibaba, Ceph, Digital Ocean, Dreamhost, IBM COS, Lyve Cloud, Minio, RackCorp, SeaweedFS, and Tencent COS
\ (s3)
6 / Backblaze B2
\ (b2)
7 / Better checksums for other remotes
\ (hasher)
8 / Box
\ (box)
9 / Cache a remote
\ (cache)
10 / Citrix Sharefile
\ (sharefile)
11 / Compress a remote
\ (compress)
12 / Dropbox
\ (dropbox)
13 / Encrypt/Decrypt a remote
\ (crypt)
14 / Enterprise File Fabric
\ (filefabric)
15 / FTP Connection
\ (ftp)
16 / Google Cloud Storage (this is not Google Drive)
\ (google cloud storage)
17 / Google Drive
\ (drive)
18 / Google Photos
\ (google photos)
19 / Hadoop distributed file system
\ (hdfs)
20 / Hubic
\ (hubic)
21 / In memory object storage system.
\ (memory)
22 / Jottacloud
\ (jottacloud)
23 / Koofr, Digi Storage and other Koofr-compatible storage providers
\ (koofr)
24 / Local Disk
\ (local)
25 / Mail.ru Cloud
\ (mailru)
26 / Mega
\ (mega)
27 / Microsoft Azure Blob Storage
\ (azureblob)
28 / Microsoft OneDrive
\ (onedrive)
29 / OpenDrive
\ (opendrive)
30 / OpenStack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
\ (swift)
31 / Pcloud
\ (pcloud)
32 / Put.io
\ (putio)
33 / QingCloud Object Storage
\ (qingstor)
34 / SSH/SFTP Connection
\ (sftp)
35 / Sia Decentralized Cloud
\ (sia)
36 / Storj Decentralized Cloud Storage
\ (storj)
37 / Sugarsync
\ (sugarsync)
38 / Transparently chunk/split large files
\ (chunker)
39 / Union merges the contents of several upstream fs
\ (union)
40 / Uptobox
\ (uptobox)
41 / Webdav
\ (webdav)
42 / Yandex Disk
\ (yandex)
43 / Zoho
\ (zoho)
44 / http Connection
\ (http)
45 / premiumize.me
\ (premiumizeme)
46 / seafile
\ (seafile)
Storage> 28
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
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
输入你要挂载的网盘序号,我要挂载的 OneDrive 是 28
,
注意:序号不固定,请自行确认
client_id
和 client_secret
直接回车默认即可,
然后会出现 OneDrive 区域选择,如下:
Option region.
Choose national cloud region for OneDrive.
Choose a number from below, or type in your own string value.
Press Enter for the default (global).
1 / Microsoft Cloud Global
\ (global)
2 / Microsoft Cloud for US Government
\ (us)
3 / Microsoft Cloud Germany
\ (de)
4 / Azure and Office 365 operated by 21Vianet in China
\ (cn)
region> 1
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
根据你自己的 OneDrive 版本来,这里我输入 1
选择全球,
然后是选择是否进行高级配置,保持默认回车即可:
Edit advanced config?
y) Yes
n) No (default)
1
2
3
2
3
接着是自动配置选择,如下:
Use auto config?
* Say Y if not sure
* Say N if you are working on a remote or headless machine
y) Yes (default)
n) No
1
2
3
4
5
6
2
3
4
5
6
因为你的服务器并没有图形化界面无法使用浏览器打开网页,这里需要选择 n
,
这里需要获取授权码并输入:
Option config_token.
For this to work, you will need rclone available on a machine that has
a web browser available.
For more help and alternate methods see: https://rclone.org/remote_setup/
Execute the following on the machine with the web browser (same rclone
version recommended):
rclone authorize "onedrive"
Then paste the result.
Enter a value.
config_token>
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
授权码需要在本地电脑上获取,访问 https://rclone.org/downloads/ 根据你的电脑系统版本下载对应的 Rclone,下载完成后解压,进入存放 Rclone 的目录可以看到 rclone.exe
的可执行程序,在空白处按住 shift
键鼠标右击 在 Windows 终端打开
或 在此处打开 PowerShell 窗口
,执行如下命令:
./rclone.exe authorize "onedrive"
1
浏览器应该会自动打开,如果浏览器没有打开可以根据提示复制地址访问。如果浏览器登录了 OneDrive 的话会直接显示授权确认信息,如果没有登录的话会弹出登录页面,登录 OneDrive 后也会显示授权确认信息。选择 接受
后在本地命令行会显示一串 JSON 格式的授权信息,复制授权信息包括首尾的 {},到 Linux 终端粘贴。
然后设置 OneDrive 的连接类型,如下:
Option config_type.
Type of connection
Choose a number from below, or type in an existing string value.
Press Enter for the default (onedrive).
1 / OneDrive Personal or Business
\ (onedrive)
2 / Root Sharepoint site
\ (sharepoint)
/ Sharepoint site name or URL
3 | E.g. mysite or https://contoso.sharepoint.com/sites/mysite
\ (url)
4 / Search for a Sharepoint site
\ (search)
5 / Type in driveID (advanced)
\ (driveid)
6 / Type in SiteID (advanced)
\ (siteid)
/ Sharepoint server-relative path (advanced)
7 | E.g. /teams/hr
\ (path)
config_type> 1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
这里输入 1
,
然后会显示找到的 OneDrive 账户,如下:
Drive OK?
Found drive "root" of type "business"
URL: https://xxxxxx-my.sharepoint.com/personal/xxxxxx/Documents
y) Yes (default)
n) No
y/n>
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
确认无误后输入 y
或者直接回车,接着会显示你选择的配置信息,确认无误后输入 y
保存配置。
上传OneDrive
环境依赖
apt-get install -y screen
1
备份
mongodump -h localhost -u admin -p yourpassword -o /home/beifen/dandao
1
打成压缩包
tar -zcf xxx.tar.gz dandao
1
运行
//以下任选一即可
screen rclone move /home/beifen onedrive:/dandao -P //上传后删除
screen rclone copy /home/beifen onedrive:/dandao -P //复制
screen rclone sync /home/beifen onedrive:/dandao -P //同步
-P 显示进程详情
1
2
3
4
5
6
2
3
4
5
6
这时登录onedrive即可看到看到备份文件