阿里云oss迁移到AWS S3

这里写自定义目录标题

0.项目背景

公司迁移要求:从阿里云oss到亚马逊s3,数据量大概500G-2T左右。

开启阿里云oss 加速模式,这样能够跨机房和区域加速。

主要采用以下两种方式同步数据,根据每个公司情况自行选择即可。

1.rclone 方式

#s3 挂载

s3fs ad-amazon-ad /ad-amazon-ad -o url=https://s3.us-east-1.amazonaws.com,endpoint=us-east-1,allow_other,uid=1000,gid=1000,mp_umask=007,use_cache=/tmp

s3fs yinta-website /yinta-website -o url=https://s3.us-east-1.amazonaws.com,endpoint=us-east-1,allow_other,uid=1000,gid=1000,mp_umask=007,use_cache=/tmp

s3fs erp-info-test /erp-info-test -o url=https://s3.ap-east-1.amazonaws.com,endpoint=ap-east-1,allow_other,uid=1000,gid=1000,mp_umask=007,use_cache=/tmp

s3fs erp-info /erp-info -o url=https://s3.ap-east-1.amazonaws.com,endpoint=ap-east-1,allow_other,uid=1000,gid=1000,mp_umask=007,use_cache=/tmp

s3fs erp-usinfo /erp-usinfo -o url=https://s3.us-east-1.amazonaws.com,endpoint=us-east-1,allow_other,uid=1000,gid=1000,mp_umask=007,use_cache=/tmp

#rclone 配置信息

aws-s3

type = s3

provider = AWS

access_key_id = xxxxx

secret_access_key = xxxxx

region = ap-east-1

endpoint = s3.ap-east-1.amazonaws.com.cn

location_constraint = ap-east-1

ali-oss

type = s3

provider = Alibaba

access_key_id = xxxx

secret_access_key = xxxxx

endpoint = oss-accelerate.aliyuncs.com

#传输命令

nohup rclone sync -P --transfers 8 --checkers 8 --s3-chunk-size 8M --s3-upload-concurrency 8 --log-file=/tmp/rclone.txt --log-level INFO ali-oss:ad-amazon-ad aws-s3-us:ad-amazon-ad>/tmp/ad-amazon-ad.log &

nohup rclone sync -P --transfers 8 --checkers 8 --s3-chunk-size 8M --s3-upload-concurrency 8 --log-file=/tmp/rclone.txt --log-level INFO ali-oss:yinta-website aws-s3-us:yinta-website>/tmp/yinta-website.log &

nohup rclone sync -P --transfers 8 --checkers 8 --s3-chunk-size 8M --s3-upload-concurrency 8 --log-file=/tmp/rclone.txt --log-level INFO ali-oss:erp-info-test aws-s3:erp-info-test >/tmp/rc-test.log &

nohup rclone sync -P --transfers 32 --checkers 16 --s3-chunk-size 15M --s3-upload-concurrency 16 --log-file=/tmp/rclone.txt --log-level INFO ali-oss:erp-usinfo aws-s3-us:erp-usinfo>/tmp/rc-us.log &

nohup rclone sync -P --transfers 32 --checkers 16 --s3-chunk-size 15M --s3-upload-concurrency 16 --log-file=/tmp/rclone.txt --log-level INFO ali-oss:erp-info aws-s3:erp-info >/tmp/rc.log &

#统计s3桶大小

aws s3 ls --summarize --human-readable --recursive s3://erp-info

s3cmd du s3://erp-info / --human-readable

erp-info-test-us 美国西部(俄勒冈) us-west-2 公开 换成弗吉尼亚地区。

参考:https://www.awstweaker.com/2022/02/16/rclone工具使用手册/

2.rsync方式

#1.挂载oss所需工具: ossfs

echo erp-info:akxxx:skxxxx > /etc/passwd-ossfs

chmod 600 /etc/passwd-ossfs

#挂载oss

ossfs erp-info /erp-info -ourl=oss-cn-hongkong-internal.aliyuncs.com

#2.挂载S3:所需工具s3fs

echo xxxxxx:xxxxxx/ > ~/.passwd-s3fs

chmod 600 ~/.passwd-s3fs

#挂载

s3fs erp-info-test /erp-info-test -o url=https://s3.ap-east-1.amazonaws.com,endpoint=ap-east-1,allow_other,uid=1000,gid=1000,mp_umask=007,use_cache=/tmp

s3fs bi-zyb /bi-zyb -o url=https://s3.ap-east-1.amazonaws.com,endpoint=ap-east-1,allow_other,uid=1000,gid=1000,mp_umask=007,use_cache=/tmp

s3fs yinta-website /yinta-website -o url=https://s3.us-east-1.amazonaws.com,endpoint=us-east-1,allow_other,uid=1000,gid=1000,mp_umask=007,use_cache=/tmp

s3fs ad-amazon-ad /ad-amazon-ad -o url=https://s3.us-east-1.amazonaws.com,endpoint=us-east-1,allow_other,uid=1000,gid=1000,mp_umask=007,use_cache=/tmp

#sync

root@docker-yinta \~\]# nohup rsync -av /erp-info-test/ root@16.163.255.57:/erp-info-test/ \>/dev/null 2\>\&1 \& \[1\] 21449 \[root@docker-yinta \~\]# nohup rsync -av /erp-usinfo/ root@16.163.255.57:/erp-usinfo/ \>/dev/null 2\>\&1 \& \[2\] 21562 \[root@docker-yinta \~\]# nohup rsync -av /erp-info/ root@16.163.255.57:/erp-info/ \>/dev/null 2\>\&1 \& \[3\] 21759 ### 3.注意 oss中带/ 的目录,用rsync ,rclone ,oss等都无法同步其中文件!!

相关推荐
卤炖阑尾炎3 分钟前
PostgreSQL 日常运维全指南:从基础操作到备份恢复
运维·数据库·postgresql
daad7771 小时前
wifi_note
运维·服务器·数据库
xixingzhe22 小时前
Mysql统计空间增量
数据库·mysql
程序员萌萌2 小时前
Redis的缓存机制和淘汰策略详解
数据库·redis·缓存机制·淘汰策略
不剪发的Tony老师3 小时前
SQLite 3.53.0版本发布,重要更新
数据库·sqlite
Bczheng13 小时前
九.Berkeley DB数据库 序列化和钱包管理(1)
数据库
cozil3 小时前
记录mysql创建数据库未指定字符集引发的问题及解决方法
数据库·mysql
架构师老Y3 小时前
013、数据库性能优化:索引、查询与连接池
数据库·python·oracle·性能优化·架构
AC赳赳老秦3 小时前
OpenClaw数据库高效操作指南:MySQL/PostgreSQL批量处理与数据迁移实战
大数据·数据库·mysql·elasticsearch·postgresql·deepseek·openclaw
一 乐3 小时前
校园线上招聘|基于springboot + vue校园线上招聘系统(源码+数据库+文档)
java·数据库·vue.js·spring boot·论文·毕设·校园线上招聘系统