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~!
The mc mirror command synchronizes content to MinIO deployment, similar to the rsync utility. mc mirror supports filesystems, MinIO deployments, and other S3-compatible hosts as the synchronization source. Note. mc mirror only synchronizes the current object without any version information or metadata.
The mc mb command creates a new bucket or directory at the specified path. You can also use mc mb against the local filesystem to produce similar results to the mkdir -p commandline tool. The following command creates a new bucket mydata on the myminio MinIO deployment.
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).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With