下载安装:https://downloads.rclone.org
配置(各家
平台存在差异,以下以腾讯、阿里、minio举例):
#腾讯云
[tencentOSS]
type = s3
provider = TencentCOS
access_key_id = AKI*****************************************ngI
secret_access_key = Vlt************************************CE0
endpoint = cos.ap-shanghai.myqcloud.com
#阿里云-上海
[oss]
type = s3
provider = Alibaba
access_key_id = LTA**************kEj
secret_access_key = ip8********************************KAk
endpoint = oss-cn-shanghai.aliyuncs.com
acl = private
#Minio
[minio]
type = s3
provider = Minio
access_key_id = YRE*******************0AB
secret_access_key = bF6********************************************ws4
region = cn-south-1
endpoint = http://192.168.55.131:9199
桶和对象的概念:
- 桶类似于目录,可以包含无数个object。
- 对象为对象存储中的存储单元,可以‘/root/aaa/bbb.txt’命名,但不存在目录结构,其中斜杠仅代表文件名。
主要命令:
1、rclone mkdir
- 创建桶(需要权限) rclone mkdir st:bucket1
- 创建目录 rclone mkdir st:bucket1/dir1
2、rclone copy
- 对象存储之间的考本:rclone copy st1:bucket1/aaa st2:bucket2/bbb (将对象存储1的bucket1下名称为aaa的对象拷贝到对象存储2下的bucket2下,并命名为bbb)
- 本地文件拷贝至对象存储:rclone copy /root/aaa.txt st:bucket1/ (将本地的aaa.txt拷贝至对象存储的bucket1下)
- 对象存储拷贝至本都目录:rclone copy st:bucket1/ /root/ (将对象存储bucket1下的所有文件考本质本地)
3、rclone delete
- 删除对象存储bucket1中的指定文件 rclone delete st:bucket1 --include=/aaa.txt (删除桶下的aaa.txt文件)
4、rclone purge
- 删除对象存储bucket1下的所有的目录 rclone lsl st:bucket1/
5、rclone lsl
- 列出对象存储bucket1下的所有文件和信息 rclone lsl st:bucket1
6、rclone check
- 校验时间和大小
- -P进行数据对比 rclone check st1:bucket1/dir1/ st2:bucket2/dir2/ -P
7、rclone mount
- 挂载:rclone mount -vv st1:bucket1 /mnt/oss/ --cache-dir /tmp --vfs-cache-mode full --vfs-cache-max-age 3h --vfs-cache-max-size 10G --vfs-read-chunk-size-limit 500M --buffer-size 1G --fast-list --allow-non-empty --allow-other --dir-perms 777 --file-perms 777 >> /var/log/mount.log 2>&1 &
- 卸载:kill -9杀死进程号