MinIO 客户端 mc mirror 命令用来将对象同步到远程站点。语法如下:
C:\> mc mirror -h
NAME:
mc mirror - synchronize object(s) to a remote site
USAGE:
mc mirror [FLAGS] SOURCE TARGET
FLAGS:
--overwrite overwrite object(s) on target if it differs from source
--fake perform a fake mirror operation
--watch, -w watch and synchronize changes
--remove remove extraneous object(s) on target
--region value specify region when creating new bucket(s) on target (default: "us-east-1")
--preserve, -a preserve file(s)/object(s) attributes and bucket(s) policy/locking configuration(s) on target bucket(s)
--md5 force all upload(s) to calculate md5sum checksum
--active-active enable active-active multi-site setup
--disable-multipart disable multipart upload feature
--exclude value exclude object(s) that match specified object name pattern
--older-than value filter object(s) older than L days, M hours and N minutes
--newer-than value filter object(s) newer than L days, M hours and N minutes
--storage-class value, --sc value specify storage class for new object(s) on target
--encrypt value encrypt/decrypt objects (using server-side encryption with server managed keys)
--attr value add custom metadata for all objects
--monitoring-address value if specified, a new prometheus endpoint will be created to report mirroring activity. (eg: localhost:8081)
--encrypt-key value encrypt/decrypt objects (using server-side encryption with customer provided keys)
--config-dir value, -C value path to configuration folder (default: "C:\\Users\\Administrator\\mc")
--quiet, -q disable progress bar display
--no-color disable color theme
--json enable JSON lines formatted output
--debug enable debug output
--insecure disable SSL certificate verification
--help, -h show help
ENVIRONMENT VARIABLES:
MC_ENCRYPT: list of comma delimited prefixes
MC_ENCRYPT_KEY: list of comma delimited prefix=secret values(1)递归地将一个bucket从MinIO云存储镜像到Amazon S3云存储上的一个bucket。
C:\> mc mirror play/photos/2014 s3/backup-photos(2)递归地将本地文件夹镜像到 Amazon S3 云存储。
C:\> mc mirror backup/ s3/archive(3)仅将7天10小时30分钟以上的文件镜像到Amazon S3云存储。
C:\> mc mirror --newer-than "7d10h30m" backup/s3/archive(4)将存储桶从别名 Amazon S3 云存储镜像到 Windows 上的文件夹。
C:\> mc mirror s3\documents\2014\ C:\backup\2014(5)将存储桶从别名 Amazon S3 云存储镜像到本地文件夹,使用“--overwrite”覆盖目标。
C:\> mc mirror --overwrite s3/miniocloud miniocloud-backup(6)将 MinIO 云存储中的存储桶镜像到 Amazon S3 云存储上的存储桶,并删除任何无关的 Amazon S3 云存储上的文件。
C:\> mc mirror --remove play/photos/2014 s3/backup-photos/2014(7)持续递归地将本地文件夹镜像到MinIO云存储。 '--watch' 持续关注新对象、上传和删除 Amazon S3 云存储上的无关文件。
C:\> mc mirror --remove --watch /var/lib/backups play/backups(8)不断地将站点1的所有bucket和objects镜像到site 2,移除的bucket和objects也会被反映。
C:\> mc mirror --remove --watch site1-alias/ site2-alias/(9)将存储桶从别名 Amazon S3 云存储镜像到本地文件夹。镜像时排除所有 .* 文件和 *.temp 文件。
C:\> mc mirror --exclude ".*" --exclude "*.temp" s3/test ~/test(10)将超过 10 天的对象从存储桶测试镜像到本地文件夹。
C:\> mc mirror --newer-than 10d s3/test ~/localfolder(11)将超过 30 天的对象从 Amazon S3 存储桶测试镜像到本地文件夹。
C:\> mc mirror --older-than 30d s3/test ~/test(12)将服务器加密对象从MinIO云存储镜像到Amazon S3云存储上的bucket
C:\> mc mirror --encrypt-key "minio/photos=32byteslongsecretkeymustbegiven1,s3/archive=32byteslongsecretkeymustbegiven2" minio/photos/s3/archive/(13)将服务器加密的对象从 MinIO 云存储镜像到 Amazon S3 云存储上的存储桶。如果加密密钥包含不可打印的字符,如制表符,将 base64 编码的字符串作为键传递。
C:\> mc mirror --encrypt-key "s3/photos/=32byteslongsecretkeymustbegiven1,play/archive/=MzJieXRlc2xvbmdzZWNyZXRrZQltdXN0YmVnaXZlbjE="s3/photos/play/archive/(14)递归更新所有现有对象上的“Cache-Control”标头。
C:\> mc mirror --attr "Cache-Control=max-age=90000,min-fresh=9000" myminio/video-files myminio/video-files(15)递归地将本地文件夹镜像到 Amazon S3 云存储并保留所有本地文件属性。
C:\> mc mirror -a backup/s3/archive(16)主动-主动部署中站点之间的交叉镜像。
# 站点 A
C:\> mc mirror --active-active siteA siteB
# 站点 B
C:\> mc mirror --active-active siteB siteA