发布时间: 2024-7-12 文章作者: myluzh 分类名称: CLOUD 朗读文章
# 安装rclone yum install -y rclone # rclone挂载FUSE文件系统所必需 yum install -y fuse0x02 创建rclone配置文件
[root@iZbp151h65ix1x0tvaj1qxZ www]# rclone config n) New remote s) Set configuration password (optional) q) Quit config n/s/q> n name> myoss (你可以给它起一个你喜欢的名字) Storage> s3 provider> Alibaba env_auth> false access_key_id> (你的Access Key ID) secret_access_key> (你的Access Key Secret) region> (留空或者填写适当的区域,如 cn-hangzhou) endpoint> (如oss-cn-hangzhou.aliyuncs.com) location_constraint> (留空) acl> (留空)也可以直接修改rclone配置文件
[root@iZbp151h65ix1x0tvaj1qxZ www]# vi /root/.config/rclone/rclone.conf [aliyun-oss-dianshang] type = s3 provider = Alibaba env_auth = false access_key_id = LTAI5t8Q5uxxxxxxXbaY4hFt secret_access_key = PxtfNhdxxxxxxhkcwPQKQuJDv acl = bucket-owner-full-control endpoint = oss-cn-hangzhou-internal.aliyuncs.com保存这个配置文件后,你可以使用rclone挂载阿里云OSS。以下是一个基本的挂载命令示例:
rclone mount aliyun-oss:your-bucket-name /path/to/mountpoint0x03 通过rclone挂载oss
[root@iZbp151h65ix1x0tvaj1qxZ ~]# mkdir -p /oss2、rclone -v 可以先前台挂载 看看日志
[root@iZbp151h65ix1x0tvaj1qxZ ~]# rclone mount aliyun-oss-dianshang:dianshang-shop /oss -v 2024/07/12 09:46:39 INFO : S3 bucket dianshang-shop: poll-interval is not supported by this remote3、rclone -daemon 后台挂载
# 使用参数 -daemon 让rclone的mount后台运行,-log-file 指定日志位置。 [root@iZbp151h65ix1x0tvaj1qxZ log]# rclone mount aliyun-oss-dianshang:dianshang-shop /oss --daemon --log-file /var/log/rclone.log # 可以看到已经挂载成功了 [root@iZbp151h65ix1x0tvaj1qxZ log]# df -h | grep oss aliyun-oss-dianshang:dianshang-shop 1.0P 0 1.0P 0% /oss # 开机自动挂载 把rclone挂载命令写入/etc/rc.d/rc.local vi /etc/rc.d/rc.local ... rclone mount aliyun-oss-dianshang:dianshang-shop /oss --daemon --log-file /var/log/rclone.log ...0x04 同步文件到OSS
mkdir -p /oss/root cp /root/* /oss/root/ # 通过sync同步,--progress 选项显示进度条,更加直观。 rsync -av --progress /root/* /oss/root/ # 后台同步 nohup rsync -av --progress /root/* /oss/root/ > rsync_output.log 2>&1 &
发表评论