跳至主要内容

自己建立网盘并且设置主备盘

自己建立网盘并且设置主备盘

web管理推荐:File Browser,请参考:File Browser配置教程

File Browser配置好了我们来配置3个盘,这里用到的工具是大名鼎鼎的Rclone

我们这里把Aws S3做为主盘,Google Drive和Onedrive(E3)做备份盘.提示芳姐的Onedrive教育版无法做.因为什么的?天天折腾人家,微软受不了封主号了!

开始折腾.

一. 先准备创建3个目录

mkdir /root/s3 
mkdir /root/google
mkdir /root/onedrive
#并且给与写入权限 chmod a+x /root

二. 安装Rclone Ubuntu 18为演示版本

  1. 具体教程请看利用Google Drive的无限网盘做数据定时备份
curl https://rclone.org/install.sh | sudo bash

rclone config

S3配置

root@ip-172-26-13-159:~# rclone config
2018/10/31 06:21:18 NOTICE: Config file "/root/.config/rclone/rclone.conf" not found - using defaults
No remotes found - make a new one
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n
name> s3
Type of storage to configure.
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
1 / A stackable unification remote, which can appear to merge the contents of several remotes
\ "union"
2 / Alias for a existing remote
\ "alias"
3 / Amazon Drive
\ "amazon cloud drive"
4 / Amazon S3 Compliant Storage Providers (AWS, Ceph, Dreamhost, IBM COS, Minio)
\ "s3"
5 / Backblaze B2
\ "b2"
6 / Box
\ "box"
7 / Cache a remote
\ "cache"
8 / Dropbox
\ "dropbox"
9 / Encrypt/Decrypt a remote
\ "crypt"
10 / FTP Connection
\ "ftp"
11 / Google Cloud Storage (this is not Google Drive)
\ "google cloud storage"
12 / Google Drive
\ "drive"
13 / Hubic
\ "hubic"
14 / JottaCloud
\ "jottacloud"
15 / Local Disk
\ "local"
16 / Mega
\ "mega"
17 / Microsoft Azure Blob Storage
\ "azureblob"
18 / Microsoft OneDrive
\ "onedrive"
19 / OpenDrive
\ "opendrive"
20 / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
\ "swift"
21 / Pcloud
\ "pcloud"
22 / QingCloud Object Storage
\ "qingstor"
23 / SSH/SFTP Connection
\ "sftp"
24 / Webdav
\ "webdav"
25 / Yandex Disk
\ "yandex"
26 / http Connection
\ "http"
Storage> 4 选择4
** See help for s3 backend at: https://rclone.org/s3/ **

Choose your S3 provider.
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
1 / Amazon Web Services (AWS) S3
\ "AWS"
2 / Ceph Object Storage
\ "Ceph"
3 / Digital Ocean Spaces
\ "DigitalOcean"
4 / Dreamhost DreamObjects
\ "Dreamhost"
5 / IBM COS S3
\ "IBMCOS"
6 / Minio Object Storage
\ "Minio"
7 / Wasabi Object Storage
\ "Wasabi"
8 / Any other S3 compatible provider
\ "Other"
provider> 1 选择1
Get AWS credentials from runtime (environment variables or EC2/ECS meta data if no env vars).
Only applies if access_key_id and secret_access_key is blank.
Enter a boolean value (true or false). Press Enter for the default ("false").
Choose a number from below, or type in your own value
1 / Enter AWS credentials in the next step
\ "false"
2 / Get AWS credentials from the environment (env vars or IAM)
\ "true"
env_auth> 1 选择1
AWS Access Key ID.
Leave blank for anonymous access or runtime credentials.
Enter a string value. Press Enter for the default ("").
access_key_id> 访问密钥 ID
AWS Secret Access Key (password)
Leave blank for anonymous access or runtime credentials.
Enter a string value. Press Enter for the default ("").
secret_access_key> 私有访问密钥
Region to connect to.
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
/ The default endpoint - a good choice if you are unsure.
1 | US Region, Northern Virginia or Pacific Northwest.
| Leave location constraint empty.
\ "us-east-1"
/ US East (Ohio) Region
2 | Needs location constraint us-east-2.
\ "us-east-2"
/ US West (Oregon) Region
3 | Needs location constraint us-west-2.
\ "us-west-2"
/ US West (Northern California) Region
4 | Needs location constraint us-west-1.
\ "us-west-1"
/ Canada (Central) Region
5 | Needs location constraint ca-central-1.
\ "ca-central-1"
/ EU (Ireland) Region
6 | Needs location constraint EU or eu-west-1.
\ "eu-west-1"
/ EU (London) Region
7 | Needs location constraint eu-west-2.
\ "eu-west-2"
/ EU (Frankfurt) Region
8 | Needs location constraint eu-central-1.
\ "eu-central-1"
/ Asia Pacific (Singapore) Region
9 | Needs location constraint ap-southeast-1.
\ "ap-southeast-1"
/ Asia Pacific (Sydney) Region
10 | Needs location constraint ap-southeast-2.
\ "ap-southeast-2"
/ Asia Pacific (Tokyo) Region
11 | Needs location constraint ap-northeast-1.
\ "ap-northeast-1"
/ Asia Pacific (Seoul)
12 | Needs location constraint ap-northeast-2.
\ "ap-northeast-2"
/ Asia Pacific (Mumbai)
13 | Needs location constraint ap-south-1.
\ "ap-south-1"
/ South America (Sao Paulo) Region
14 | Needs location constraint sa-east-1.
\ "sa-east-1"
region> 11选择你所在的服务器地区,一定要写对不然挂载无法写入文件
Endpoint for S3 API.
Leave blank if using AWS to use the default endpoint for the region.
Enter a string value. Press Enter for the default ("").
endpoint>
Location constraint - must be set to match the Region.
Used when creating buckets only.
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
1 / Empty for US Region, Northern Virginia or Pacific Northwest.
\ ""
2 / US East (Ohio) Region.
\ "us-east-2"
3 / US West (Oregon) Region.
\ "us-west-2"
4 / US West (Northern California) Region.
\ "us-west-1"
5 / Canada (Central) Region.
\ "ca-central-1"
6 / EU (Ireland) Region.
\ "eu-west-1"
7 / EU (London) Region.
\ "eu-west-2"
8 / EU Region.
\ "EU"
9 / Asia Pacific (Singapore) Region.
\ "ap-southeast-1"
10 / Asia Pacific (Sydney) Region.
\ "ap-southeast-2"
11 / Asia Pacific (Tokyo) Region.
\ "ap-northeast-1"
12 / Asia Pacific (Seoul)
\ "ap-northeast-2"
13 / Asia Pacific (Mumbai)
\ "ap-south-1"
14 / South America (Sao Paulo) Region.
\ "sa-east-1"
location_constraint> 11选择你所在的服务器地区,一定要写对不然挂载无法写入文件
Canned ACL used when creating buckets and/or storing objects in S3.
For more info visit https://ift.tt/1oksq89
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
1 / Owner gets FULL_CONTROL. No one else has access rights (default).
\ "private"
2 / Owner gets FULL_CONTROL. The AllUsers group gets READ access.
\ "public-read"
/ Owner gets FULL_CONTROL. The AllUsers group gets READ and WRITE access.
3 | Granting this on a bucket is generally not recommended.
\ "public-read-write"
4 / Owner gets FULL_CONTROL. The AuthenticatedUsers group gets READ access.
\ "authenticated-read"
/ Object owner gets FULL_CONTROL. Bucket owner gets READ access.
5 | If you specify this canned ACL when creating a bucket, Amazon S3 ignores it.
\ "bucket-owner-read"
/ Both the object owner and the bucket owner get FULL_CONTROL over the object.
6 | If you specify this canned ACL when creating a bucket, Amazon S3 ignores it.
\ "bucket-owner-full-control"
acl> 1选择1
The server-side encryption algorithm used when storing this object in S3.
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
1 / None
\ ""
2 / AES256
\ "AES256"
3 / aws:kms
\ "aws:kms"
server_side_encryption> 1选择1
If using KMS ID you must provide the ARN of Key.
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
1 / None
\ ""
2 / arn:aws:kms:*
\ "arn:aws:kms:us-east-1:*"
sse_kms_key_id> 1选择1
The storage class to use when storing new objects in S3.
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
1 / Default
\ ""
2 / Standard storage class
\ "STANDARD"
3 / Reduced redundancy storage class
\ "REDUCED_REDUNDANCY"
4 / Standard Infrequent Access storage class
\ "STANDARD_IA"
5 / One Zone Infrequent Access storage class
\ "ONEZONE_IA"
storage_class> 1选择1
Edit advanced config? (y/n)
y) Yes
n) No
y/n> n选择1

Remote config

[s3]
type = s3
provider = AWS
env_auth = false
access_key_id =
secret_access_key =
region = ap-southeast-2
location_constraint = ap-northeast-1
acl = private

y) Yes this is OK
e) Edit this remote
d) Delete this remote
y/e/d> y
Current remotes:

Name Type
==== ====
s3 s3

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> q

Google盘配置

访问利用Google Drive的无限网盘做数据定时备份

Onedrive配置(只适合E3用户,下面有个人版的配置)

  1. 首页我们要在本地获取key,下载Rclone,然后执行rclone authorize "onedrive"就会出现{"access_token":"eyJ0eXAiOiJKV1QiLCJub25j.....","expiry":"2018-10-31T15:43:38.098775+08:00"}这样的字样我们要记录下来等会有用!
  2. 服务器开始配置
rclone config

root@ip-172-26-13-159:~# rclone config
Current remotes:

Name Type
==== ====
google drive
s3 s3

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> onedrive
Type of storage to configure.
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
1 / A stackable unification remote, which can appear to merge the contents of several remotes
\ "union"
2 / Alias for a existing remote
\ "alias"
3 / Amazon Drive
\ "amazon cloud drive"
4 / Amazon S3 Compliant Storage Providers (AWS, Ceph, Dreamhost, IBM COS, Minio)
\ "s3"
5 / Backblaze B2
\ "b2"
6 / Box
\ "box"
7 / Cache a remote
\ "cache"
8 / Dropbox
\ "dropbox"
9 / Encrypt/Decrypt a remote
\ "crypt"
10 / FTP Connection
\ "ftp"
11 / Google Cloud Storage (this is not Google Drive)
\ "google cloud storage"
12 / Google Drive
\ "drive"
13 / Hubic
\ "hubic"
14 / JottaCloud
\ "jottacloud"
15 / Local Disk
\ "local"
16 / Mega
\ "mega"
17 / Microsoft Azure Blob Storage
\ "azureblob"
18 / Microsoft OneDrive
\ "onedrive"
19 / OpenDrive
\ "opendrive"
20 / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
\ "swift"
21 / Pcloud
\ "pcloud"
22 / QingCloud Object Storage
\ "qingstor"
23 / SSH/SFTP Connection
\ "sftp"
24 / Webdav
\ "webdav"
25 / Yandex Disk
\ "yandex"
26 / http Connection
\ "http"
Storage> 18选择18 onedrive
** See help for onedrive backend at: https://ift.tt/2EqKyoM **

Microsoft App Client Id
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_id>回车
Microsoft App Client Secret
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_secret>回车
Edit advanced config? (y/n)
y) Yes
n) No
y/n> n选择n
Remote config
Use auto config?

  • Say Y if not sure
  • Say N if you are working on a remote or headless machine
    y) Yes
    n) No
    y/n> n选择n
    For this to work, you will need rclone available on a machine that has a web browser available.
    Execute the following on your machine:
    rclone authorize "onedrive"
    Then paste the result below:
    result> {"access_token":"eyJ0Cc","expiry":"2018-10-31T15:43:38.098775+08:00"}

    复制刚刚你在本机获取的key到这里
    2018/10/31 06:48:04 ERROR : Failed to save new token in config file: section 'onedrive' not found
    Choose a number from below, or type in an existing value
    1 / OneDrive Personal or Business
    \ "onedrive"
    2 / Root Sharepoint site
    \ "sharepoint"
    3 / Type in driveID
    \ "driveid"
    4 / Type in SiteID
    \ "siteid"
    5 / Search a Sharepoint site
    \ "search"
    Your choice> 1选择1
    Found 1 drives, please select the one you want to use:
    0: OneDrive (business) id=b!rfYKiY1pqvvFha3u
    Chose drive to use:> 0选择0
    Found drive 'root' of type 'business', URL: https://ift.tt/2Dd1LWJ
    Is that okay?
    y) Yes
    n) No
    y/n> y选择y

[onedrive]
type = onedrive
token = {"access_token":"eyJ0SCAA","expiry":"2018-10-31T15:43:38.098775+08:00"}
drive_id = b!rfYKiYCsYkOuIB9MlEcUUaBEqklDh0lEl0ALyjcqhBn8kS1hx7D8QqfpqvvFha3u
drive_type = business

y) Yes this is OK
e) Edit this remote
d) Delete this remote
y/e/d> y 选择y
Current remotes:

Name Type
==== ====
google drive
onedrive onedrive
s3 s3

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> q 选择q

没有E3的同学,可以用另外一种办法挂载onedrive的个人账户

mkdir /root/onedrive
git clone https://github.com/xybu/onedrive-d-old.git
mv onedrive-d-old onedrive-d
cd onedrive-d
./install.sh #安装
onedrive-pref #设置
onedrive-d start #启动

3个盘都挂载完毕,我们来检查一下

df -h

都挂载上了,这里有疑问的同学应该是盘大小不一样怎么做主备?其实Sandy主盘s3备盘google,onedrive只是作为arie2+电影盘.不用出墙嘛速度快拿来群晖做在线电影

挂载好了我们就来测试一下盘和盘的同步

我们在Rclone官网可以看到sync的文档里面有写到

rclone sync s3:homekey /root/google 
#这样写是s3同步google,反过来是google同步s3,注意同步是会删除目标盘里面所有的东西.所有一定要挂载干净的空目录

我们来做个测试:图1.s3 图2.googel

###图1(s3)

图2(google)

我们来执行

rclone sync s3:homekey /root/google 

我们看看图3 google目录同步的情况

图3 (google)

我们已经同步到google drive盘里面了

我们要做个crontab,让主盘每天同步一次备份盘

vi /etc/crontab
30 1 * * * rclone sync s3:homekey /root/google 
#每晚夜深人静的时候1.30分开始备份,应该你们家都没人在写数据了吧!自由发挥

主备盘教程就结束了~~~~各位看官有钱的打赏几两金子,没钱的捧个人场!

来折腾onedrive的Arie2+Nginx+rclone,折腾好了以后群晖一样用rclone挂载.然后我们就可以服务器下载利用群晖的电影APP看电影了~其他Nas只能下载一些支持nas播放的APP也可以看.这里就不详细给大家细说了!有什么问题可以加QQ群聊:

评论

此博客中的热门博文

阿里云通过Nginx中转Linode/digitalocean/AWS的V2ray协议,实现负载均衡

开篇文的废话.原因是Sandy做站服务器太多了,发现利用率不高,皮又痒了又想折腾了.v2ray是利器但是给人的感觉就是只能用一台服务器,官方也说不支持负载均衡,不会A服务器挂机,自动跳转到B服务器.这里就有点折磨人了.每个服务器挂了都要自己去改配置文件. 我们访问国外的服务器,如果没CN2的线路是非常慢的,起码不快!哈哈~现在VPS都便宜起码人手一个人有5台以上吧?这样的话我们就可以开整. 开整条件:国内VPS或者阿里云有CN2线路的机器最好是100MB-200MB的带宽的.保证你爽歪歪.但是Sandy在阿里云HK30MB下也测试了也可以达到30000KB以上,羡慕吧~我们可以开始了! 老规则工具先出: 没被gwf和谐的服务器1台(下文统称:主服务器) 国外服务器2台以上(下文统称:从服务器) nginx 1.9.5版本以上(推荐:lnmp1.4) v2ray croe 第一步: 在 主服务器 安装lnmp1.4,这里就不细说教程了.直接去 官方 看教程 安装完毕以后我们来升级Nginx让他支持stream模块 cd lnmp1.4 vi lnmp.conf 在Nginx_Modules_Options=‘’里面加入--with-stream Nginx_Modules_Options='--with-stream’ 然后执行升级命令 ./upgrade.sh nginx  第二步 修改nginx.conf文件 cd /usr/local/nginx/conf/nginx.conf 在 events { use epoll; worker_connections 51200; multi_accept on; } 下面加入 stream{ server{ listen 0.0.0.0:8080; proxy_pass v2ray_backend; proxy_timeout 10m; proxy_connect_timeout 5000ms; } upstream v2ray_backend{ server ...

Mac下Aria2安装及其配置并设置开机启动

1.安装Homebrew 注:(如已安装,请忽略) 打开终端键入以下命令,等待完成 /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 2.安装最新版本aria2并配置 1.终端下输入以下命令 ➜ ~ brew install aria2 2.等待安装完成后,下载附件 Aria2相关配置下载地址 aria2 config 3.建立aria2文件夹 cd ~ // 创建aria2文件夹 mkdir ~/.aria2 4.打开刚才创建好的aria2文件夹 ➜ ~ open ~/.aria2 5.解压下载好的附件,将 下列文件 复制到aria2文件夹内 aria2.conf aria2.log aria2.session com.aria2c.plist com.google.Chrome.mobileconfig 6.将下载文件夹内的 aria2c 文件复制到 /usr/local/Cellar/aria2/1.33.1/bin 下 操作方式,终端输入命令 cd /usr/local/Cellar/aria2/1.33.1/bin 将该文件夹里的 aria2c 文件重命名为 aria2c.bak,再将下载文件夹内的 aria2c 复制进去 注: 1.理由是官方的 aria2c 版本最多支持16线程,sarkrui改好的aria2c版本支持128线程 2.文中所说的1.33.1是我当前从brew上下载下来的版本,实际以你brew下载下来的版本为准,如果和我版本不一致,请修改相关的1.33.1这个路径 7.右键使用文本编辑或sublime打开 aria2.conf 找到如下语句,将hsuyelin(本人电脑用户名)修改为你电脑的用户,修改完成 command+s 保存退出 #文件保存路径, 默认为当前启动位置 dir=/Users/hsuyelin/Downloads # 日志保存路径 log=/Users/hsuyelin/.aria2/aria2.log # 从会话文件中读取下载任务 input-file=/Users/hsu...

Android 用户必备良药「黑域」,专治「全家桶」唤醒烦恼

显然,这不是广告! 这么好的应用,不分享给尾巴们简直说不过去,于是我决定自己动手写一篇关于「黑域」的简单介绍。 那么在聊「黑域」之前,先说一下国产 Android 应用的尴尬之处。注意,以下信息不一定准确。 众所周知,谷歌服务在国内是被你懂的 XX 所干扰,而 Android 系统的诸多服务没有了这些支持的话就会变成残缺状态。比如推送服务,Android 是和 iOS 一样拥有系统层级的推送服务,这项服务叫做 Google Cloud Messaging,现在新名称是 Firebase Cloud Messaging 。 由于这项服务被干扰,国产 Android 应用如果想要推送消息给用户,通常都会选择「小米推送」、「极光推送」、「个推」等第三方推送服务,为了确保服务的可靠性,他们就得让应用处于运行状态,而非彻底从后台任务中清除。 然后,问题就来了。 国内各大手机厂商们为了确保手机运行的流畅性和稳定性,会选择让系统杀掉那些常驻在后台的应用进程。由于各家手机厂商的系统功能完全不同,杀进程的方法也就都不一样。举个例子,采用「小米推送」服务的 Android 应用在 MIUI 下可以获得最高的消息送达率,即使应用被切到后台也没关系,正常情况下它依然能够收到通知。但如果是在 Flyme OS 的话,当这款应用切到了后台那么很可能它的进程就会被杀掉,导致消息无法正常送达。   ▲ 让人又爱又恨的某些国产应用 为此,这些 Android 应用不得不采取一些措施以确保自家应用的推送通知能够送达用户,于是……噔噔噔!掌声有请「全家桶」登场!随后就…… 一个推送通知直接把多个应用同时唤醒,后台电量哗啦啦下降,机身发热,滑动卡顿……天呐,这简直就是灾难。如果手机厂商不针对这种状况做处理,最终结果可想而知。 当然,你可别以为这些国产应用只是为了推送才要常驻后台,比如自动下载安装包什么的,因为 Google Play 商店没有入华,应用也无法实现自动更新。为了确保用户使用最新版本的应用,常驻后台自动下载安装包什么的 ,呵呵呵。 这就是没有谷歌服务的 Android 在中国大环境下的现状,它显得非常具有中国特色,但本质上它是因为先天性缺陷才造成了今天的局面,是的,这一缺陷不是你光靠科学上网就能改变得了。 说到这里,某些非 Android 用户估计又要觉...