If we want to copy a bucket to another MiniO cluster, should we use "mc cp" or "mc mirror"? I have done some simple experiments and it seems that they are the same.
Thank~!
If we want to copy a bucket to another MiniO cluster, should we use "mc cp" or "mc mirror"? I have done some simple experiments and it seems that they are the same.
Thank~!
Yes, mc cp --recursive SOURCE TARGET
and mc mirror --overwrite SOURCE TARGET
will have the same effect (to the best of my experience as of 2022-01).
mc cp
allows for fine-tuned options for single files (but can bulk copy using --recursive
)mc mirror
is focussed on bulk copying and can create bucketsLooking at the Minio client guide, there are several differences between the mc mirror
and the mc cp
commands, although the result of running them can be the same.
The answer to which one should you use depends on your requirements, and both options may be acceptable for you.
The command signature differ: mc cp
allows for multiple sources while mc mirror
only allows for a single source.
In addition, the available flags are somewhat different (see below).
mc cp
offers not offered by mc mirror
--rewind value
: roll back object(s) to current version at specified time--version-id value
, --vid value
: select an object version to copy--attr
: add custom metadata for the object (format: KeyName1=string;KeyName2=string
)--continue
, -c
: create or resume copy session--tags
: apply tags to the uploaded objects (eg. key=value&key2=value2
, etc)--rewind value
: roll back object(s) to current version at specified time--recursive
, -r
flag, but that's always true for mirror
)Flags offered by mc mirror
not offered by mc clone
:
mc mirror
offers not offered by mc cp
--exclude value
: exclude object(s) that match specified object name pattern--fake
: perform a fake mirror operation--overwrite
: overwrite object(s) on target if it differs from source--region value
: specify region when creating new bucket(s) on target (default: "us-east-1")--watch
, -w
: watch and synchronize changes (This may be a big deal)Consider using rclone
as an alternative with additional flexibility. The Minio project is focussed on performance and being an excellent, simple S3 backend, not implementing every feature you could ask for (e.g., chunk size, throttling).
Important to note:
mc mirror only synchronizes the current object without any version information or metadata. To synchronize an object’s version history and metadata, consider using mc replicate or mc admin replicate.
https://min.io/docs/minio/linux/reference/minio-mc/mc-mirror.html
@Gordon Fogus: you forgot to mention that mc mirror
has also the --remove
flag in order to be sure that a file removed in remote is also removed in local.
© 2022 - 2024 — McMap. All rights reserved.