文章目录

  • 前言
  • 一、RCLONE是什么?
  • 二、操作步骤
    • 1.下载和安装
    • 2.配置对象存储数据源
    • 3.挂载到操作系统
      • 3.1.挂载到windows操作系统
      • 3.2.挂载到linux操作系统
  • 注意事项

前言

随着云计算的发展,公有云成为中小型企业建设业务系统的首选,而对象存储则是存储里面必不可少的存储产品,对象存储不仅可以提供海量、高可靠、安全的服务,而且价格相对普通存储来说会便宜很多,并且不受带宽的限制,仅限于本地下载和上传的网速,对象存储应用场景更适用于静态网站托管、多媒体存储、数据备份等等应用场景;对象存储使用相对来说是比较简单的我这里就不重点说了;
为什么会有云主机挂载对象存储的需求呢?这个还要来源于业务系统的要求,正常来说对象存储基本上都提供S3的一个接口提供上传下载,更是各大云厂商都提供S3的工具,华为云的OBS Browser+以及移动云的S3 Browser等等,不过这些工具无法实现自动化的操作,你想自动化操作有两种方式一种是直接程序调用对象存储的S3接口,另一个方法就说直接将对象存储挂载为本地文件夹或映射为磁盘的方式进行操作,接下来我要说的就是如何将对象存储挂载到云主机,这次采用的是RCLONE这个管理工具,下面使用linux系统进行演示,windows其实和linux操作步骤几乎一致,不过参数可能多少有点不一样,后面也把windows的简单教程放到了最后。


一、RCLONE是什么?

Rclone是一款免费的云存储管理工具,能够像使用本地文件一样便捷的使用云存储,被誉为“云存储界的瑞士军刀”。
您可以使用Rclone工具,对对象存储进行数据导入、数据同步、迁移备份或者挂载等操作。
通过使用Rclone,您可以轻松的完成以下工作:

名称 概述
数据导入 支持将存放在其它数据源上的数据导入到对象存储
数据同步 支持在对象存储不同的桶之间,或者对象存储和其它数据源之间进行数据同步
数据迁移备份 支持在对象存储不同的桶之间进行数据迁移、备份操作
挂载到本地磁盘 支持将对象存储挂载为本地磁盘,像操作本地文件一样,对云存储的数据进行操作

二、操作步骤

1.下载和安装

下载链接:https://download.csdn.net/download/KH_FC/85448323

2.配置对象存储数据源

windows打开CMD程序执行窗口,输入rclone config命令执行
linux系统直接输入rclone config命令执行

执行后屏幕将显示如下的配置向导菜单,如果已有配置编辑输入“e”,如无配置新建配置输入“n”即可;我这里新建配置

No remotes found - make a new one
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n

输入自定义的连接配置的别名后回车,此处以”test“为例:

name> EOS

选择存储类型,输入”s3“后回车:

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, ChinaMobile, 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> s3

选择服务提供商,这个选择自己的对象存储云厂商即可,我这里采用的移动云的对象存储,所以选用”ChinaMobile“即可,输入”ChinaMobile“后回车:

Option provider.
Choose your S3 provider.
Choose a number from below, or type in your own value.
Press Enter to leave empty.1 / Amazon Web Services (AWS) S3\ (AWS)2 / Alibaba Cloud Object Storage System (OSS) formerly Aliyun\ (Alibaba)3 / Ceph Object Storage\ (Ceph)4 / China Mobile Ecloud Elastic Object Storage (EOS)\ (ChinaMobile)5 / Digital Ocean Spaces\ (DigitalOcean)6 / Dreamhost DreamObjects\ (Dreamhost)7 / IBM COS S3\ (IBMCOS)8 / Seagate Lyve Cloud\ (LyveCloud)9 / Minio Object Storage\ (Minio)
10 / Netease Object Storage (NOS)\ (Netease)
11 / RackCorp Object Storage\ (RackCorp)
12 / Scaleway Object Storage\ (Scaleway)
13 / SeaweedFS S3\ (SeaweedFS)
14 / StackPath Object Storage\ (StackPath)
15 / Storj (S3 Compatible Gateway)\ (Storj)
16 / Tencent Cloud Object Storage (COS)\ (TencentCOS)
17 / Wasabi Object Storage\ (Wasabi)
18 / Any other S3 compatible provider\ (Other)
provider> ChinaMobile

选择是否开启验证,输入”false“后回车:

Option env_auth.
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.
Choose a number from below, or type in your own boolean value (true or false).
Press Enter for the default (false).1 / Enter AWS credentials in the next step.\ (false)2 / Get AWS credentials from the environment (env vars or IAM).\ (true)
env_auth> false

输入用户API认证信息中的AccessID,不同云厂商叫法不同华为云上面是使用AK/SK,其实就是名字不同而已其实都是一样:

Option access_key_id.
AWS Access Key ID.
Leave blank for anonymous access or runtime credentials.
Enter a value. Press Enter to leave empty.
access_key_id> AccessID

输入用户API认证信息中的AccessSecretKey,这里就是指的AK/SK,这个是成对出现的:

Option secret_access_key.
AWS Secret Access Key (password).
Leave blank for anonymous access or runtime credentials.
Enter a value. Press Enter to leave empty.
secret_access_key> AccessSecretKey

选择对象存储服务接口地址,这个接口地址是指的云厂商所提供的对象存储接口地址,这个云厂商一般按照资源池来定的,输入对应的数字后回车即可,我这里是移动云的,选择不同的就会出现不同的地址:

Option endpoint.
Endpoint for China Mobile Ecloud Elastic Object Storage (EOS) API.
Choose a number from below, or type in your own value.
Press Enter to leave empty./ The default endpoint - a good choice if you are unsure.1 | East China (Suzhou)\ (eos-wuxi-1.cmecloud.cn)2 / East China (Jinan)\ (eos-jinan-1.cmecloud.cn)3 / East China (Hangzhou)\ (eos-ningbo-1.cmecloud.cn)4 / East China (Shanghai-1)\ (eos-shanghai-1.cmecloud.cn)5 / Central China (Zhengzhou)\ (eos-zhengzhou-1.cmecloud.cn)6 / Central China (Changsha-1)\ (eos-hunan-1.cmecloud.cn)7 / Central China (Changsha-2)\ (eos-zhuzhou-1.cmecloud.cn)8 / South China (Guangzhou-2)\ (eos-guangzhou-1.cmecloud.cn)9 / South China (Guangzhou-3)\ (eos-dongguan-1.cmecloud.cn)
10 / North China (Beijing-1)\ (eos-beijing-1.cmecloud.cn)
11 / North China (Beijing-2)\ (eos-beijing-2.cmecloud.cn)
12 / North China (Beijing-3)\ (eos-beijing-4.cmecloud.cn)
13 / North China (Huhehaote)\ (eos-huhehaote-1.cmecloud.cn)
14 / Southwest China (Chengdu)\ (eos-chengdu-1.cmecloud.cn)
15 / Southwest China (Chongqing)\ (eos-chongqing-1.cmecloud.cn)
16 / Southwest China (Guiyang)\ (eos-guiyang-1.cmecloud.cn)
17 / Nouthwest China (Xian)\ (eos-xian-1.cmecloud.cn)
18 / Yunnan China (Kunming)\ (eos-yunnan.cmecloud.cn)
19 / Yunnan China (Kunming-2)\ (eos-yunnan-2.cmecloud.cn)
20 / Tianjin China (Tianjin)\ (eos-tianjin-1.cmecloud.cn)
21 / Jilin China (Changchun)\ (eos-jilin-1.cmecloud.cn)
22 / Hubei China (Xiangyan)\ (eos-hubei-1.cmecloud.cn)
23 / Jiangxi China (Nanchang)\ (eos-jiangxi-1.cmecloud.cn)
24 / Gansu China (Lanzhou)\ (eos-gansu-1.cmecloud.cn)
25 / Shanxi China (Taiyuan)\ (eos-shanxi-1.cmecloud.cn)
26 / Liaoning China (Shenyang)\ (eos-liaoning-1.cmecloud.cn)
27 / Hebei China (Shijiazhuang)\ (eos-hebei-1.cmecloud.cn)
28 / Fujian China (Xiamen)\ (eos-fujian-1.cmecloud.cn)
29 / Guangxi China (Nanning)\ (eos-guangxi-1.cmecloud.cn)
30 / Anhui China (Huainan)\ (eos-anhui-1.cmecloud.cn)
endpoint> 1

选择”location_constraint“,需要与之前的对象存储服务接口地址保持一致,一般这里让你选择你对象存储所存在的资源池,输入对应的数字后回车:

Option location_constraint.
Location constraint - must match endpoint.
Used when creating buckets only.
Choose a number from below, or type in your own value.
Press Enter to leave empty.1 / East China (Suzhou)\ (wuxi1)2 / East China (Jinan)\ (jinan1)3 / East China (Hangzhou)\ (ningbo1)4 / East China (Shanghai-1)\ (shanghai1)5 / Central China (Zhengzhou)\ (zhengzhou1)6 / Central China (Changsha-1)\ (hunan1)7 / Central China (Changsha-2)\ (zhuzhou1)8 / South China (Guangzhou-2)\ (guangzhou1)9 / South China (Guangzhou-3)\ (dongguan1)
10 / North China (Beijing-1)\ (beijing1)
11 / North China (Beijing-2)\ (beijing2)
12 / North China (Beijing-3)\ (beijing4)
13 / North China (Huhehaote)\ (huhehaote1)
14 / Southwest China (Chengdu)\ (chengdu1)
15 / Southwest China (Chongqing)\ (chongqing1)
16 / Southwest China (Guiyang)\ (guiyang1)
17 / Nouthwest China (Xian)\ (xian1)
18 / Yunnan China (Kunming)\ (yunnan)
19 / Yunnan China (Kunming-2)\ (yunnan2)
20 / Tianjin China (Tianjin)\ (tianjin1)
21 / Jilin China (Changchun)\ (jilin1)
22 / Hubei China (Xiangyan)\ (hubei1)
23 / Jiangxi China (Nanchang)\ (jiangxi1)
24 / Gansu China (Lanzhou)\ (gansu1)
25 / Shanxi China (Taiyuan)\ (shanxi1)
26 / Liaoning China (Shenyang)\ (liaoning1)
27 / Hebei China (Shijiazhuang)\ (hebei1)
28 / Fujian China (Xiamen)\ (fujian1)
29 / Guangxi China (Nanning)\ (guangxi1)
30 / Anhui China (Huainan)\ (anhui1)
location_constraint> 1

输入默认权限,一般设置成公共可读写即可:

Option acl.
Canned ACL used when creating buckets and storing or copying objects.
This ACL is used for creating objects and if bucket_acl isn't set, for creating buckets too.
For more info visit https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#canned-acl
Note that this ACL is applied when server-side copying objects as S3
doesn't copy the ACL from the source but rather writes a fresh one.
Choose a number from below, or type in your own value.
Press Enter to leave empty./ Owner gets FULL_CONTROL.1 | No one else has access rights (default).\ (private)/ Owner gets FULL_CONTROL.2 | The AllUsers group gets READ access.\ (public-read)/ Owner gets FULL_CONTROL.3 | The AllUsers group gets READ and WRITE access.| Granting this on a bucket is generally not recommended.\ (public-read-write)/ Owner gets FULL_CONTROL.4 | The AuthenticatedUsers group gets READ access.\ (authenticated-read)
acl> public-read-write

选择服务端加密方式,不使用该功能时直接回车:

Option server_side_encryption.
The server-side encryption algorithm used when storing this object in S3.
Choose a number from below, or type in your own value.
Press Enter to leave empty.1 / None\ ()2 / AES256\ (AES256)
server_side_encryption>

选择上传对象的默认存储类型,不选择时默认使用桶的存储类型:

Option storage_class.
The storage class to use when storing new objects in ChinaMobile.
Choose a number from below, or type in your own value.
Press Enter to leave empty.1 / Default\ ()2 / Standard storage class\ (STANDARD)3 / Archive storage mode\ (GLACIER)4 / Infrequent access storage mode\ (STANDARD_IA)
storage_class>

选择是否设置进阶配置,这里不设置,直接回车:

Edit advanced config?
y) Yes
n) No (default)
y/n>

确认刚才配置的连接信息,确认无误后输入”y“后回车,保存配置:

--------------------
[EOS]
type = s3
provider = ChinaMobile
access_key_id = AccessID
secret_access_key = AccessSecretKey
endpoint = eos-wuxi-1.cmecloud.cn
location_constraint = wuxi1
acl = private
--------------------
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d> y

此时回到了配置向导的初始菜单,刚才的配置会显示出来,可继续执行创建新的配置(输入“n”)、编辑已有的配置(输入“e”)、删除配置(输入“d”)等操作,或者完成配置向导退出(输入“q”):

Current remotes:Name                 Type
====                 ====
EOS                  s3e) 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>

到这里配置文件配置已经完成了。


3.挂载到操作系统

3.1.挂载到windows操作系统

安装依赖软件:WINFSP
下载地址:https://ecloud.10086.cn/op-help-center/doc/article/resource/file/ced6e21813cf60f2828cfc1eb0f5993325f4da56564b5afd1fdfa244830573db
下载好后直接双运行即可,安装也是按照默认的选项走就可以的





一步步安装完成即可;
下面就是挂载对象存储了,挂载也比较简单一条命令搞定

rclone mount 配置文件名称:桶名称 挂载路径  --cache-dir 缓存路径 --vfs-cache-mode writes

输入敲回车即可,你会发现对象存储已经挂载到了你想要的挂载目录上面了,这样就可以上传下载文件了

3.2.挂载到linux操作系统

安装依赖软件:FUSE
centos安装:

yum -y install fuse

ubuntu安装:

apt -y insyall fuse

等待安装完成即可,下面就是挂载对象存储了

# 创建挂载路径
mkdir -p 挂载目录
rclone mount 配置文件名称:桶名称 挂载路径 --daemon --allow-other  --cache-dir 缓存路径 --vfs-cache-mode writes

执行即可

注意事项

1. 需要注意缓存可能会和你上传文件的大小一样,默认缓存保存时间为1小时,如果需要设置缓存时间你可以加”--vfs-cache-max-age“参数设置缓存时间
2. 如果需要删除桶中的对象,建议从系统中删除,如果在对象存储控制台删除的话,会出现所挂载的目录中还是有这个文件的问题

记一次云主机如何挂载对象存储相关推荐

  1. s3fs挂载对象存储到本地

    s3fs挂载对象存储到本地 一.S3FS介绍: S3FS是Google开发的一款支持将对象存储中的bucket以文件形式导出的文件系统接口,兼容POSIX语法 S3FS基于FUSE开发的文件系统,允许 ...

  2. 如何在自己的阿里服务器上挂载对象存储(OSS)方法及使用收费

    挂载步骤和使用方法:如何在自己的阿里服务器上挂载对象存储(OSS) **使用收费:**因为OSS不只是空间收费的,他还有其他的收费项目,如下图: 所以说如果你是包月购买了以后,使用过程中还是有流量费用 ...

  3. 一个集成阿里云、腾讯云、七牛云对象存储的SDK

    概述 一个集成阿里云.腾讯云.七牛云对象存储的SDK An SDK integrating Alibaba cloud, Tencent cloud and qiniu cloud object st ...

  4. Linux系统云主机教程,新开的linux云主机磁盘挂载教程

    下面蓝队网络给大家实际操作下,挂载linux主机的第二块盘. 查看主机硬盘情况(fdisk -l): 我们看到有sda和sdb两块盘,实际上sda就是我们的系统盘,sdb是我们的第二块盘,新开的云主机 ...

  5. 百度云主机BCC挂载云盘CDS

    1.查看云磁盘. a.在没有分区和格式化云磁盘之前,执行df -h命令无法查看到云磁盘 b.执行fdisk -l查看,红色框为云磁盘初始化前的信息. 如下图所示: 2.对云磁盘进行分区. 执行命令fd ...

  6. 制作r710 linux系统盘,记一次云主机系统盘扩容及制作私有镜像的操作步骤

    一.购买弹性云服务器 1.登录华为云,首先购买弹性云服务器 2.选择弹性云主机的规格 按需计费类型,贵阳一区域价格相对便宜一些 3.镜像根据实际情况自行选择 举例:我这里选择公共镜像,CentOS7. ...

  7. 百度云磁盘CDS、对象存储BOS技术深度解析

    在BAT中,百度在公有云也有很多技术创新.比如2013年引起广泛关注的ARM存储服务器就是一个很好的例子.最近两年,百度云开始发力,其云存储体系有诸多创新之处.目前百度云存储形成了以块存储.对象存储. ...

  8. un-app部署h5项目到普通云服务器--域名解析--OOS对象存储

    在不不使用前端托管,自己买了一个云服务器的情况 首先要进行云函数的url化 之后是项目部署 服务器一般是nginx 安装nginx 可以参考菜鸟网 windows+jenkins+gitea+node ...

  9. 阿里云培训-OSS(对象存储)

    什么是对象存储OSS 阿里云对象存储OSS(Object Storage Service)是一款海量.安全.低成本.高可靠的云存储服务,可提供99.9999999999%(12个9)的数据持久性,99 ...

  10. 天翼云 Java对接OBS对象存储

    天翼云 对接OBS对象存储 前言 最近公司帮国企做一个项目,对方要求云厂商使用电信天翼云,我们之前一直都在使用阿里云,因为国企情况比较特殊,优先考虑国资背景的云厂商; 最近才改造完rocketMQ,现 ...

最新文章

  1. linux LANG变量 定义系统的主语系环境
  2. 大整数乘法---FFT算法
  3. NOIP提高模拟-20181019-T1-加密
  4. HALCON示例程序sequence_diff.hdev通过两张连续图像进行车辆流量监控
  5. Linux入门(一)之权限指令系统管理
  6. ajax提交手机号去数据库验证并返回状态值
  7. lambda表达式 java 效率_Java8新特性效率之Lambda
  8. 2017年10月21日23:43:02
  9. Ubuntu和Mac使用gdbserver远程调试android源码
  10. 【转】3个普通IO识别22个按键试验
  11. centos7安装uwsgi报错_nginx + uwsgi 发布django项目!(linux为centos7)
  12. 浅谈c语言函数调用指针
  13. 房屋租赁管理系统mysql(含论文)
  14. 2022年高压电工操作证考试题库及在线模拟考试
  15. 细说共模干扰和差模干扰(四个腿的电感是什么?有什么作用?)
  16. SWUSTOJ #69 偷菜时间表
  17. 小程序_OTA升级的一些情况说明
  18. java异步队对联_对联广告(带关闭的)
  19. android媒体焦点音量压低/暂停逻辑源码简析
  20. qemu-system-x86_64: warning: host doesn‘t support requested feature: CPUID.80000001H:ECX.svm [bit 2]

热门文章

  1. python接口自动化13-流量回放
  2. Fandis COSTECH A17M23SWB MT0 AC220V 50HZ 42W
  3. 【二分答案】JZOJ_3337 wyl8899的TLE
  4. Chia命令行P图工具
  5. python 线程锁_Python线程锁的实现
  6. 解析:为什么程序员应该有一台Mac个人电脑?
  7. 超算入门笔记:大型机上如何运行WRF模式?一文总结(并行运算、Linux基础、作业调度、WRF运行)
  8. autoit3 学习
  9. github python100天_GitHub - CherryXuan/Python-100-Days: Python - 100天从新手到大师
  10. Retrofit2 详解和使用(一)