bra*_*Hax 3 ubuntu synchronization amazon-s3
我有一个在 Digital Ocean 服务器上运行的应用程序,有两个文件夹正在使用用户上传的图像进行更新。
是否可以将新上传的内容从服务器文件夹自动传输到 s3 存储桶。
我已经在 ubuntu 服务器上配置了 AWS CLI。
谢谢
小智 5
您还可以尝试Minio 客户端 aka mc,它的开源和 S3 兼容 API。您可以使用mc mirror
命令来归档目录。
安装 minio 客户端:
$ wget https://dl.minio.io/client/mc/release/linux-amd64/mc
$ chmod 755 mc
$ ./mc --help
Run Code Online (Sandbox Code Playgroud)
为 Amazon S3 配置 mc:
$ ./mc config host add <ALIAS> <YOUR-S3-ENDPOINT> <YOUR-ACCESS-KEY> <YOUR-SECRET-KEY>
Run Code Online (Sandbox Code Playgroud)
例子
$ ./mc config host add mys3 https://s3.amazonaws.com BKIKJAA5BMMU2RHO6IBB V7f1CwQqAcwo80UEIJEjc5gVQUSSx5ohQ9GSrr12
Run Code Online (Sandbox Code Playgroud)
将本地文件夹复制到 AWS S3:
$ ./mc mb mys3/mys3baucket
$ ./mc mirror mylocaldir/ mys3/mys3baucket
Run Code Online (Sandbox Code Playgroud)
第一个命令创建一个名为“mys3baucket”的存储桶。第二个命令按名称将本地目录镜像到 S3 存储桶。这可以很容易地设置cron
为周期性镜像。
mc
实现以下命令:
ls List files and folders.
mb Make a bucket or folder.
cat Display contents of a file.
pipe Write contents of stdin to one or more targets. When no target is specified, it writes to stdout.
share Generate URL for sharing.
cp Copy one or more objects to a target.
mirror Mirror folders recursively from a single source to many destinations.
diff Compute differences between two folders.
rm Remove file or bucket [WARNING: Use with care].
access Manage bucket access permissions.
session Manage saved sessions of cp and mirror operations.
config Manage configuration file.
update Check for a new software update.
version Print version.
Run Code Online (Sandbox Code Playgroud)
希望能帮助到你。
免责声明:我为Minio工作
小智 3
在我看来,这里没有完美的解决方案,但您可以尝试以下两种解决方法:
这就像某种 rsync 一样。
Web 应用程序的更好实现是直接上传和检索到 S3 存储桶。S3 是专门为此用途而设计的,并提供了很好的技巧,例如基于表单的验证。
归档时间: |
|
查看次数: |
10848 次 |
最近记录: |