Creates a new object management page to aggregate information on deleting objects. Links to the page from other docs throughout. Intentionally leaves most delete information where it is in existing docs. Closes #741
19 KiB
mc replicate add
minio
Table of Contents
mc replicate add
RELEASE.2022-12-24T15-21-38Z
mc replicate add
replaces the
mc admin bucket remote add
command.
MinIO automatically creates remote targets based on a given file path or resource location (such as an IP or DNS address). Users defining a remote target no longer need to determine an ARN for the remote bucket.
Syntax
The mc replicate add
command creates a new server-side replication
<minio-bucket-replication-serverside>
rule for a bucket on
a MinIO deployment.
The remote bucket must be on a MinIO deployment running the same version of MinIO as the local deployment.
Note
Where mc mirror
only
synchronizes the current version of an object, mc replicate
synchronizes all versions, version information, and metadata for the
objects.
The MinIO deployment automatically begins synchronizing new objects to the remote MinIO deployment after creating the rule. You can optionally configure synchronization of existing objects, delete operations, and fully-deleted objects.
EXAMPLE
The following command adds a new replication rule for the
mydata
bucket on the myminio
MinIO
deployment:
mc replicate add \
--remote-bucket https://user:secret@minio.mysite.tld:9001/bucket \
--replicate "delete,delete-marker,existing-objects" \
myminio/mydata
The replication rule synchronizes versioned delete operations, delete markers, and existing objects to the remote MinIO deployment.
mc RELEASE.2024-03-03T00-13-08Z
You can use a configured ALIAS to the --remote-bucket
flag.
SYNTAX
The command has the following syntax:
mc [GLOBALFLAGS] replicate add \
--remote-bucket string \
[--bandwidth "string"] \
[--disable] \
[--disable-proxy] \
[--healthcheck-seconds integer] \
[--id "string"] \
[--limit-upload "string"] \
[--limit-download "string"] \
[--path "string"] \
[--region "string"] \
[--replicate "string"] \
[--storage-class "string"] \
[--sync] \
[--tags "string"] \
[--priority int] \
ALIAS
Parameters
ALIAS
The alias <alias>
of the MinIO deployment and full
path to the bucket or bucket prefix on which to create the replication
rule. For example:
mc replicate add --remote-bucket https://user:secret@myminio.cloudprovider.tld:9001/bucket play/mybucket
--remote-bucket
mc RELEASE.2024-03-03T00-13-08Z
The --remote-bucket
supports specifying an existing
alias <alias>
.
Specify the credentials, destination deployment, and bucket of the
remote location. Value may be an IP address, URL, or alias <alias>
/bucket.
For example, a URL based target might look like the following:
https://user:secret@myminio.cloudprovider.tld:9001/bucket
An alias based target might look like the following:
--remote-bucket minio-target/my-bucket
--bandwidth
Limit bandwidth rates to no more than the specified rate in KiB/s, MiB/s, or GiB/s. Valid units include:
B
for bytesK
for kilobytesG
for gigabytesT
for terabytesKi
for kibibytesGi
for gibibytesTi
for tebibytes
For example, to limit bandwidth rates to no more than 1 GiB/s, use the following:
--limit-upload 1Gi
If not specified, MinIO does not limit the bandwidth rate.
--disable
Creates the replication rule in the "disabled" state. MinIO does not
begin replicating objects using the rule until it is enabled using mc replicate update
.
Objects created while replication is disabled are not immediately
eligible for replication after enabling the rule. You must explicitly
enable replication of existing objects by including
"existing-objects"
to the list of replication features
specified to mc replicate update --replicate
. See minio-replication-behavior-existing-objects
for more
information.
--disable-proxy
When defining active-active replication between buckets, do not proxy.
By default, MinIO proxies.
--healthcheck-seconds
The length of time in seconds between checks on the health of the remote bucket.
If not specified, MinIO uses an interval of 60 seconds.
--id
Specify a unique ID for the replication rule. MinIO automatically generates an ID if one is not specified.
--limit-download
Limit download rates to no more than a specified rate in KiB/s, MiB/s, or GiB/s. Valid units include:
B
for bytesK
for kilobytesG
for gigabytesT
for terabytesKi
for kibibytesGi
for gibibytesTi
for tebibytes
For example, to limit download rates to no more than 1 GiB/s, use the following:
--limit-download 1G
If not specified, MinIO uses an unlimited download rate.
--limit-upload
Limit upload rates to no more than the specified rate in KiB/s, MiB/s, or GiB/s. Valid units include:
B
for bytesK
for kilobytesG
for gigabytesT
for terabytesKi
for kibibytesGi
for gibibytesTi
for tebibytes
For example, to limit upload rates to no more than 1 GiB/s, use the following:
--limit-upload 1G
If not specified, MinIO uses an unlimited upload rate.
--path
Enable path-style lookup support for the remote bucket.
Valid values include:
on
- use a path lookup to find the remote bucketoff
- use a resource locator style (such as a domain or IP address) lookup to find the remote bucketauto
- ask MinIO to identify the correct type of lookup to use to find the remote bucket
When not defined, MinIO uses the auto
value.
--priority
Specify the integer priority of the replication rule. The value must be unique among all other rules on the source bucket. Higher values imply a higher priority than all other rules.
The default value is 0
.
--region
The region of the destination bucket to replicate contents to.
--replicate
Specify a comma-separated list of the following values to enable extended replication features.
delete
- Directs MinIO to replicateDELETE operations <minio-object-delete>
to the destination bucket.delete-marker
- Directs MinIO to replicate delete markers to the destination bucket.existing-objects
- Directs MinIO to replicate objects created before replication was enabled or while replication was suspended.metadata-sync
- Directs MinIO to replicate metadata for each object. For active-active replication situations only.Omitting this value directs MinIO to stop replicating metadata-only changes back to the source.
If not specified, MinIO syncs all options.
--storage-class
Specify the MinIO storage class <minio-ec-storage-class>
to apply
to replicated objects.
--sync
Enable synchronous replication for this remote target.
By default, MinIO uses asynchronous replication.
--tags
Specify one or more ampersand &
separated key-value
pair tags which MinIO uses for filtering objects to replicate. For
example:
mc replicate add --tags "TAG1=VALUE&TAG2=VALUE&TAG3=VALUE" ALIAS
MinIO applies the replication rule to any object whose tag set contains the specified replication tags.
Global Flags
Examples
Configure Bucket Replication
The following mc replicate add
command creates a replication
configuration that synchronizes all new objects, existing objects,
delete operations, and delete markers to the remote target:
mc replicate add myminio/mybucket \
--remote-bucket https://user:secret@minio.mysite.tld/remotebucket \
--replicate "delete,delete-marker,existing-objects"
- Replace
myminio/mybucket
with the~mc replicate add ALIAS
and full bucket path for which to create the replication configuration. - Replace the
~mc replicate add --remote-bucket
value with the URL or path of the remote target. If using a file path format location, use the--path on
option. - The
~mc replicate add --replicate
flag directs MinIO to replicate all delete operations, delete markers, and existing objects to the remote. Seeminio-replication-behavior-delete
andminio-replication-behavior-existing-objects
for more information on replication behavior.
Configure Bucket Replication for Historical Data Record
The following mc replicate add
command creates a new bucket
replication configuration that synchronizes all new and existing objects
to the remote target:
mc replicate add myminio/mybucket \
--remote-bucket https://user:secret@minio.mysite.tld/remotebucket \
--replicate "existing-objects"
- Replace
myminio/mybucket
with the~mc replicate add ALIAS
and full bucket path for which to create the replication configuration. - Replace the
~mc replicate add --remote-bucket
value with the location of the remote target. If using a file path format location, use the--path on
option. - The
~mc replicate add --replicate
flag directs MinIO to replicate all existing objects to the remote. Seeminio-replication-behavior-existing-objects
for more information on replication behavior.
The resulting remote copy represents a historical record of objects on the remote, where delete operations on the source have no effect on the remote copy.
Behavior
Server-Side Replication Requires MinIO Source and Destination
MinIO server-side replication only works between MinIO deployments. Both the source and destination deployments must run MinIO.
To configure replication between arbitrary S3-compatible services,
use mc mirror
.
Enable Versioning on Source and Destination Buckets
MinIO relies on the immutability protections provided by versioning to synchronize objects between the source and replication target.
Use the mc version enable
command to enable versioning on
both the source and destination bucket before starting this
procedure:
mc version enable ALIAS/PATH
- Replace
ALIAS <mc version enable ALIAS>
with thealias <mc alias>
of the MinIO deployment. - Replace
PATH <mc version enable ALIAS>
with the bucket on which to enable versioning.
Required Permissions
MinIO strongly recommends creating users specifically for supporting
bucket replication operations. See mc admin user
and mc admin policy
for more complete documentation on
adding users and policies to a MinIO deployment.
Replication Admin
The following policy provides permissions for configuring and enabling replication on a deployment.
/extra/examples/ReplicationAdminPolicy.json
- The
"EnableRemoteBucketConfiguration"
statement grants permission for creating a remote target for supporting replication. - The
"EnableReplicationRuleConfiguration"
statement grants permission for creating replication rules on a bucket. The"arn:aws:s3:::*
resource applies the replication permissions to any bucket on the source deployment. You can restrict the user policy to specific buckets as-needed.
Use the mc admin policy create
to add this policy to each
deployment acting as a replication source. Use mc admin user add
to
create a user on the deployment and mc admin policy attach
to associate the policy to
that new user.
Replication Remote User
The following policy provides permissions for enabling synchronization of replicated data into the deployment.
/extra/examples/ReplicationRemoteUserPolicy.json
- The
"EnableReplicationOnBucket"
statement grants permission for a remote target to retrieve bucket-level configuration for supporting replication operations on all buckets in the MinIO deployment. To restrict the policy to specific buckets, specify those buckets as an element in theResource
array similar to"arn:aws:s3:::bucketName"
. - The
"EnableReplicatingDataIntoBucket"
statement grants permission for a remote target to synchronize data into any bucket in the MinIO deployment. To restrict the policy to specific buckets, specify those buckets as an element in theResource
array similar to"arn:aws:s3:::bucketName/*"
.
Use the mc admin policy create
to add this policy to each
deployment acting as a replication target. Use mc admin user add
to
create a user on the deployment and mc admin policy attach
to associate the policy to
that new user.
Replication of Existing Objects
Starting with mc
RELEASE.2021-06-13T17-48-22Z <mc/releases/tag/RELEASE.2021-06-13T17-48-22Z>
and minio
RELEASE.2021-06-07T21-40-51Z <minio/releases/tag/RELEASE.2021-06-07T21-40-51Z>
,
MinIO supports automatically replicating existing objects in a bucket.
MinIO existing object replication implements functionality similar to AWS
Replicating existing objects between S3 buckets without the overhead
of contacting technical support.
- To enable replication of existing objects when creating a new
replication rule, include
"existing-objects"
to the list of replication features specified tomc replicate add --replicate
. - To enable replication of existing objects for an existing
replication rule, add
"existing-objects"
to the list of existing replication features usingmc replicate add --replicate
. You must specify all desired replication features when editing the replication rule.
See minio-replication-behavior-existing-objects
for more
complete documentation on this behavior.
Synchronization of Metadata Changes
MinIO supports two-way active-active <minio-bucket-replication-serverside-twoway>
replication configurations, where MinIO synchronizes new and modified
objects between a bucket on two MinIO deployments. Starting with mc
RELEASE.2021-05-18T03-39-44Z <mc/releases/tag/RELEASE.2021-05-18T03-39-44Z>
,
MinIO by default synchronizes metadata-only changes to a replicated
object back to the "source" deployment. Prior to the this update, MinIO
did not support synchronizing metadata-only changes to a replicated
object.
With metadata synchronization enabled, MinIO resets the object replication status <minio-replication-process>
to indicate replication eligibility. Specifically, when an application
performs a metadata-only update to an object with the
REPLICA
status, MinIO marks the object as
PENDING
and eligible for replication.
To disable metadata synchronization, use the mc replicate update --replicate
command and omit
replica-metadata-sync
from the replication feature
list.
Replication of Delete Operations
MinIO supports replicating delete operations onto the target bucket.
Specifically, MinIO can replicate both Delete Markers <versioning-workflows.html>
and the deletion of specific versioned objects:
- For delete operations on an object, MinIO replication also creates the delete marker on the target bucket.
- For delete operations on versions of an object, MinIO replication also deletes those versions on the target bucket.
MinIO does not replicate objects deleted due to lifecycle management expiration rules <minio-lifecycle-management-expiration>
.
MinIO only replicates explicit client-driven delete operations.
MinIO requires explicitly enabling replication of delete operations
using the mc replicate add --replicate
flag. This procedure
includes the required flags for enabling replication of delete
operations and delete markers. See minio-replication-behavior-delete
for more complete
documentation on this behavior.
Replication of Encrypted Objects
MinIO supports replicating objects encrypted with automatic Server-Side Encryption (SSE-S3). Both the source and destination buckets must have automatic SSE-S3 enabled for MinIO to replicate an encrypted object.
As part of the replication process, MinIO decrypts the
object on the source bucket and transmits the unencrypted object. The
destination MinIO deployment then re-encrypts the object using the
destination bucket SSE-S3 configuration. MinIO strongly
recommends enabling TLS <minio-TLS>
on both source and
destination deployments to ensure the safety of objects during
transmission.
MinIO does not support replicating client-side encrypted objects (SSE-C).