ubuntu和centos系统使用s3fs挂载对象存储

S3FSgoogle开发的一款支持将对象存储中的bucket以文件形式导出的文件系统接口,是基于FUSE开发文件系统,允许Linux挂载S3的存储桶在本地文件系统,S3FS能够保持对象原来的格式。

一.ubuntu系统

sudo apt-get update
sudo apt-get install s3fs
touch /etc/passwd-s3fs (文件可以随便起名或者放哪个目录下,不过后面参数数值也需要随之改动) 
chmod 600 /etc/passwd-s3fs (修改权限)
echo ak:sk >/etc/passwd-s3fs  (将ak和sk写入到文件中,ak,sk从各云服务商获取)
mkdir /s3fs   #创建挂载目录(随便起名)
s3fs bucket_name  /s3fs  -o passwd_file=/etc/passwd-s3fs -o url=http://rgw_ip:port -o use_path_request_style -o allow_other


将挂载信息写入/etc/fstab中
echo "s3fs#bucket_name /s3fs fuse  _netdev,passwd_file=/etc/passwd-s3fs,allow_other,use_path_request_style,url=http://rgw_ip:port 0 0" >>/etc/fstab

挂载效果

二.centos系统

yum -y install epel-release
yum -y install s3fs-fuse
后面步骤同上
注意挂载加一个参数 指定挂载大小  -o bucket_size=一个可选的整数,后面跟一个乘法后缀(GB、 GiB、 TB、 TiB、 PB、 PiB、 EB、 EiB)(中间没有空格)

列如:s3fs bucket_name  /s3fs  -o passwd_file=/etc/passwd-s3fs -o url=http://rgw_ip:port -o use_path_request_style -o allow_other -o bucket_size=100TB


将挂载信息写入/etc/fstab中
echo "s3fs#bucket_name /s3fs fuse  _netdev,passwd_file=/etc/passwd-s3fs,allow_other,use_path_request_style,bucket_size=100TB,url=http://rgw_ip:port 0 0" >>/etc/fstab 

挂载效果

  • 3
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值