Skip to content

This is the multi-page printable view of this section. .

Return to the regular view of this page.

Bucket Replication

MinIO supports server-side and client-side replication of objects between source and destination buckets.

Server-Side Bucket Replication

Configure per-bucket rules for automatically synchronizing objects between MinIO deployments. The deployment where you configure the bucket replication rule acts as the “source” while the configured remote deployment acts as the “target”. MinIO applies rules as part of object write operations (e.g. PUT) and automatically synchronizes new objects and object mutations, such as new object versions or changes to object metadata.

MinIO server-side bucket replication only supports a MinIO cluster on an identical release for the remote replication target.

Client-side Bucket Replication

Use the command process to synchronize objects between buckets within the same S3-compatible cluster or between two independent S3-compatible clusters. Client-side replication using mc mirror supports MinIO-to-S3 and similar replication configurations.

Note

Bucket vs Site Replication

Bucket Replication is distinct from and mutually exclusive with site replication.

  • Bucket Replication synchronizes data at the bucket level, such as bucket prefix paths and objects.

    You can configure bucket replication at any time, and the remote MinIO deployments may have pre-existing data on the replication target buckets.

  • Site Replication extends bucket replication to include IAM, security tokens, access keys, and bucket-level configurations.

    Site replication is typically configured when initially deploying the MinIO peer sites. Only one site can hold any bucket or objects at the time of initial configuration.

Server-Side Bucket Replication

MinIO server-side bucket replication is an automatic bucket-level configuration that synchronizes objects between a source and destination bucket. MinIO server-side replication requires the source and destination bucket be two separate MinIO clusters running the same MinIO Server version.

For each write operation to the bucket, MinIO checks all configured replication rules for the bucket and applies the matching rule with highest configured priority. MinIO synchronizes new objects and object mutations, such as new object versions or changes to object metadata. This includes metadata operations such as enabling or modifying object locking or retention settings.

MinIO server-side bucket replication is functionally similar to Amazon S3 replication while adding the following MinIO-only features:

  • Source and destination bucket names can match, supporting site-to-site use cases such as Splunk or Veeam BC/DR.
  • Simplified implementation than S3 bucket replication configuration, removing the need to configure settings like AccessControlTranslation, Metrics, and SourceSelectionCriteria.
  • Active-Active (Two-Way) replication of objects between source and destination buckets.
  • Multi-Site replication of objects between three or more MinIO deployments

Resynchronization (Disaster Recovery)

Resynchronization primarily supports recovery after partial or total loss of the data on a MinIO deployment using a healthy deployment in the replica configuration. Use the mc replicate resync command completely resynchronize the remote target (mc admin bucket remote) using the specified source bucket.

The resynchronization process checks all objects in the source bucket against all configured replication rules that include existing object replication. For each object which matches a rule, the resynchronization process places the object into the replication queue regardless of the object’s current replication status.

MinIO skips synchronizing those objects whose remote copy exactly match the source, including object metadata. MinIO otherwise does not prioritize or modify the queue with regards to the existing contents of the target.

mc replicate resync operates at the bucket level and does not support prefix-level granularity. Initiating resynchronization on a large bucket may result in a significant increase in replication-related load and traffic. Use this command with caution and only when necessary.

For buckets with object transition (Tiering) configured, replication resynchronization restores objects in a non-transitioned state with no associated transition metadata. Any data previously transitioned to the remote storage is therefore permanently disconnected from the remote MinIO deployment. For tiering configurations which specify an explicit human-readable prefix as part of the remote configuration, you can safely purge the transitioned data in that prefix to avoid costs associated to the “lost” data.

Replication of Delete Operations

MinIO supports replicating delete operations, where MinIO synchronizes deleting specific object versions and new delete markers. Delete operation replication uses the same replication process as all other replication operations.

MinIO requires explicitly enabling versioned deletes and delete marker replication . Use the mc replicate add --replicate field to specify both or either delete and delete-marker to enable versioned deletes and delete marker replication respectively. To enable both, specify both strings using a comma separator delete,delete-marker.

For delete marker replication, MinIO begins the replication process after a delete operation creates the delete marker. MinIO uses the X-Minio-Replication-DeleteMarker-Status metadata field for tracking delete marker replication status. In active-active replication configurations, MinIO may produce duplicate delete markers if both clusters concurrently create a delete marker for an object or if one or both clusters were down before the replication event synchronized.

For replicating the deletion of a specific object version, MinIO marks the object version as PENDING until replication completes. Once the remote target deletes that object version, MinIO deletes the object on the source. While this process ensures near-synchronized version deletion, it may result in listing operations returning the object version after the initial delete operation. MinIO uses the X-Minio-Replication-Delete-Status for tracking delete version replication status.

MinIO only replicates explicit client-driven delete operations. MinIO does not replicate objects deleted from the application of lifecycle management expiration rules. For active-active configurations, set the same expiration rules on all of the replication buckets to ensure consistent application of object expiration.

MinIO Trims Empty Object Prefixes on Source and Remote Bucket

If a delete operation removes the last object in a bucket prefix, MinIO recursively removes each empty part of the prefix up to the bucket root. MinIO only applies the recursive removal to prefixes created implicitly as part of object write operations - that is, the prefix was not created using an explicit directory creation command such as mc mb.

If a replication rule enables replication delete operations, the replication process also applies the implicit prefix trimming behavior on the destination MinIO cluster.

For example, consider a bucket photos with the following object prefixes:

  • photos/2021/january/myphoto.jpg
  • photos/2021/february/myotherphoto.jpg
  • photos/NYE21/NewYears.jpg

photos/NYE21 is the only prefix explicitly created using mc mb. All other prefixes were implicitly created as part of writing the object located at that prefix.

  • A command removes myphoto.jpg. MinIO automatically trims the empty /janaury prefix.
  • A command then removes the myotherphoto.jpg. MinIO automatically trims the /february prefix and the now-empty /2021 prefix.
  • A command removes the NewYears.jpg object. MinIO leaves the /NYE21 prefix remains in place since it was explicitly created.

Replication of Existing Objects

MinIO by default replicates existing objects in the source bucket to the configured remote, similar to AWS: Replicating existing objects between S3 buckets without the overhead of contacting technical support.

MinIO marks all objects or object prefixes that satisfy the replication rules as eligible for synchronization to the remote cluster and bucket. MinIO only excludes those objects without a version ID, such as those objects written before enabling versioning on the bucket.

You can disable existing object replication while configuring or modifying the bucket replication rule. You must specify all desired replication features during creation or modification:

  • For new replication rules, exclude "existing-objects" from the list of replication features specified to mc replicate add --replicate.
  • For existing replication rules, remove "existing-objects" from the list of existing replication features using mc replicate update --replicate. The new rule replaces the previous rule.

Disabling existing object replication does not remove any objects already replicated to the remote bucket.

Synchronous vs Asynchronous Replication

MinIO supports specifying either asynchronous (default) or synchronous replication for a given remote target.

With asynchronous replication, MinIO completes the originating PUT operation before placing the object into a replication queue. The originating client may therefore see a successful PUT operation before the object is replicated. While this may result in stale or missing objects on the remote, it mitigates the risk of slow write operations due to replication load.

With synchronous replication, MinIO attempts to replicate the object prior to completing the originating PUT operation. MinIO returns a successful PUT operation whether or not the replication attempt succeeds. This reduces the risk of slow write operations at a possible cost of stale or missing objects on the remote location.

You must explicitly enable synchronous replication when configuring the remote target target using the mc admin bucket remote add command with the add flag.

Replication Internals

This section documents internal replication behavior and is not critical to using or implementing replication. This documentation is provided strictly for learning and educational purposes.

Replication Process

MinIO uses a replication queuing system with multiple concurrent replication workers operating on that queue. MinIO continuously works to replicate and remove objects from the queue while scanning for new unreplicated objects to add to the queue.

Note

Changed: RELEASE.2022-07-18T17-49-40Z

MinIO queues failed replication operations and retries those operations up to three (3) times.

MinIO dequeues replication operations that fail to replicate after three attempts. The scanner can pick up those affected objects at a later time and requeue them for replication.

Note

Changed: RELEASE.2022-08-11T04-37-28Z

Failed or pending replications requeue automatically when performing a list or any GET or HEAD API method. For example, using mc stat, mc cat, or mc ls after a remote location comes back online requeues replication.

MinIO sets the X-Amz-Replication-Status metadata field according to the replication state of the object:

Replication State

Description

PENDING

The object has not yet been replicated. MinIO applies this state if the object meets one of the configured replication rules on the bucket. MinIO continuously scans for PENDING objects not yet in the replication queue and adds them to the queue as space is available.

For multi-site replication, objects remain in the PENDING state until replicated to all configured remotes for that bucket or bucket prefix.

COMPLETED

The object has successfully replicated to the remote cluster.

FAILED

The object failed to replicate to the remote cluster.

MinIO continuously scans for FAILED objects not yet in the replication queue and adds them to the queue as space is available.

REPLICA

The object is itself a replica from a remote source.

The replication process generally has one of the following flows:

  • PENDING -> COMPLETED
  • PENDING -> FAILED -> COMPLETED

1 - Requirements to Set Up Bucket Replication

Bucket replication uses rules to synchronize the contents of a bucket on one MinIO deployment to a bucket on a remote MinIO deployment.

Replication can be done in any of the following ways:

  • Active-Passive Eligible objects replicate from the source bucket to the remote bucket. Any changes on the remote bucket do not replicate back.
  • Active-Active Changes to eligible objects of either bucket replicate to the other bucket in a two-way direction.
  • Multi-Site Active-Active Changes to eligible objects on any bucket set up for bucket replication replicate to all of the other buckets.

Ensure you meet the following prerequisites before you set up any of these replication configurations.

Permissions Required for Setting Up Bucket Replication

Bucket replication requires specific permissions on the source and destination deployments to configure and enable replication rules.

The following policy provides permissions for configuring and enabling replication on a deployment.

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Action": [
                "admin:SetBucketTarget",
                "admin:GetBucketTarget",
                "admin:ListBatchJobs",
                "admin:DescribeBatchJob",
                "admin:StartBatchJob",
                "admin:CancelBatchJob"
            ],
            "Effect": "Allow",
            "Sid": "EnableRemoteBucketConfiguration"
        },
        {
            "Effect": "Allow",
            "Action": [
                "s3:GetReplicationConfiguration",
                "s3:ListBucket",
                "s3:ListBucketMultipartUploads",
                "s3:GetBucketLocation",
                "s3:GetBucketVersioning",
                "s3:GetObjectRetention",
                "s3:GetObjectLegalHold",
                "s3:PutReplicationConfiguration"
            ],
            "Resource": [
                "arn:aws:s3:::*"
            ],
            "Sid": "EnableReplicationRuleConfiguration"
        }
    ]
}
  • 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.

The following code creates a MinIO-managed user with the necessary policy. Replace the TARGET with the alias of the MinIO deployment on which you are configuring replication:

wget -O - https://silo.pgsty.com/extra/examples/ReplicationAdminPolicy.json | \
mc admin policy create TARGET ReplicationAdminPolicy /dev/stdin
mc admin user add TARGET ReplicationAdmin LongRandomSecretKey
mc admin policy attach TARGET ReplicationAdminPolicy --user=ReplicationAdmin

MinIO deployments configured for Active Directory/LDAP or OpenID Connect user management should instead create a dedicated access keys for bucket replication.

The following policy provides permissions for enabling synchronization of replicated data into the deployment.

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "s3:GetReplicationConfiguration",
                "s3:ListBucket",
                "s3:ListBucketMultipartUploads",
                "s3:GetBucketLocation",
                "s3:GetBucketVersioning",
                "s3:GetBucketObjectLockConfiguration",
                "s3:GetEncryptionConfiguration"
            ],
            "Resource": [
                "arn:aws:s3:::*"
            ],
            "Sid": "EnableReplicationOnBucket"
        },
        {
            "Effect": "Allow",
            "Action": [
                "s3:GetReplicationConfiguration",
                "s3:ReplicateTags",
                "s3:AbortMultipartUpload",
                "s3:GetObject",
                "s3:GetObjectVersion",
                "s3:GetObjectVersionTagging",
                "s3:PutObject",
                "s3:PutObjectRetention",
                "s3:PutBucketObjectLockConfiguration",
                "s3:PutObjectLegalHold",
                "s3:DeleteObject",
                "s3:ReplicateObject",
                "s3:ReplicateDelete"
            ],
            "Resource": [
                "arn:aws:s3:::*"
            ],
            "Sid": "EnableReplicatingDataIntoBucket"
        }
    ]
}
  • 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 the Resource 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 the Resource array similar to "arn:aws:s3:::bucketName/*".

The following code creates a MinIO-managed user with the necessary policy. Replace TARGET with the alias of the MinIO deployment on which you are configuring replication:

wget -O - https://silo.pgsty.com/extra/examples/ReplicationRemoteUserPolicy.json | \
mc admin policy create TARGET ReplicationRemoteUserPolicy /dev/stdin
mc admin user add TARGET ReplicationRemoteUser LongRandomSecretKey
mc admin policy attach TARGET ReplicationRemoteUserPolicy --user=ReplicationRemoteUser

MinIO deployments configured for Active Directory/LDAP or OpenID Connect user management should instead create a dedicated access keys for bucket replication.

See mc admin user, mc admin user svcacct, and mc admin policy for more complete documentation on adding users, access keys, and policies to a MinIO deployment.

Matching Object Encryption Settings for Bucket Replication

MinIO supports replication of objects encrypted using SSE-KMS and SSE-S3:

  • For objects encrypted using SSE-KMS, MinIO requires that the target bucket support SSE-KMS encryption of objects using the same key names used to encrypt objects on the source bucket.
  • For objects encrypted using SSE-S3, MinIO requires that the target bucket also support SSE-S3 encryption of objects regardless of key name.

As part of the replication process, MinIO decrypts the object on the source bucket and transmits the unencrypted object over the network. The destination MinIO deployment then re-encrypts the object using the encryption settings from the target. MinIO therefore strongly recommends enabling 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).

Bucket Replication Requires MinIO Deployments

MinIO server-side replication only works between MinIO deployments. Both the source and destination deployments must run MinIO Server with matching versions.

To configure replication between arbitrary S3-compatible services, use mc mirror.

Replication Requires Versioning

MinIO relies on the immutability protections provided by versioning to support replication and resynchronization.

Use mc version info to validate the versioning status of both the source and remote buckets. Use the mc version enable command to enable versioning as necessary.

If you exclude a prefix or folder from versioning within the source bucket, MinIO cannot replicate objects within that folder or prefix.

Matching Object Locking State With Bucket Replication

MinIO supports replicating objects held under WORM Locking. Both replication buckets must have object locking enabled for MinIO to replicate the locked object. For active-active configuration, MinIO recommends using the same retention rules on both buckets to ensure consistent behavior across sites.

You must enable object locking during bucket creation as per S3 behavior. You can then configure object retention rules at any time. Configure the necessary rules on the unhealthy target bucket prior to beginning this procedure.

2 - Enable One-Way Server-Side Bucket Replication

The procedure on this page creates a new bucket replication rule for one-way synchronization of objects from one MinIO bucket to another MinIO bucket. The buckets can be on the same MinIO deployment or on separate MinIO deployments.

Active-Passive Replication synchronizes data from a source MinIO deployment to a remote MinIO deployment.
Note

Note

To configure replication between arbitrary S3-compatible services (not necessarily MinIO), use mc mirror.

Requirements

Replication requires all participating clusters meet the following requirements. This procedure assumes you have reviewed and validated those requirements.

For more details, see the Bucket Replication Requirements page.

Considerations

Click to expand any of the following:

Replication of Existing Objects

MinIO supports automatically replicating existing objects in a bucket.

MinIO requires explicitly enabling replication of existing objects using the mc replicate add --replicate or mc replicate update --replicate and including the existing-objects replication feature flag. This procedure includes the required flags for enabling replication of existing objects.

Replication of Delete Operations

MinIO supports replicating S3 DELETE operations onto the target bucket. Specifically, MinIO can replicate versioning Delete Markers 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 requires explicitly enabling replication of delete operations using the mc replicate add --replicate or mc replicate update --replicate. This procedure includes the required flags for enabling replication of delete operations and delete markers.

MinIO does not replicate delete operations resulting from the application of lifecycle management expiration rules.

See Replication of Delete Operations and Object Deletion for more complete documentation.

Multi-Site Replication

MinIO supports configuring multiple remote targets per bucket or bucket prefix. For example, you can configure a bucket to replicate data to two or more remote MinIO deployments, where one deployment is a 1:1 copy (replication of all operations including deletions) and another is a full historical record (replication of only non-destructive write operations).

This procedure documents one-way replication to a single remote MinIO deployment. You can repeat this tutorial to replicate a single bucket to multiple remote targets.

Procedure

Configure One-Way Bucket Replication Using the Command Line mc

This procedure uses the aliases SOURCE and REMOTE to reference each MinIO deployment being configured for replication. Replace these values with the appropriate alias for your target MinIO deployments.

This procedure assumes each alias corresponds to a user with the necessary replication permissions.

Note

Changed: RELEASE.2022-12-24T15-21-38Z

mc replicate add automatically creates the necessary replication targets, removing the need for using the deprecated mc admin remote bucket add command. This procedure only documents the procedure as of that release.

1) Create a New Bucket Replication Rule

Use the mc replicate add command to add a new replication rule to each MinIO deployment.

mc replicate add ALIAS/BUCKET \
   --remote-bucket 'https://USER:PASSWORD@HOSTNAME:PORT/BUCKET' \
   --replicate "delete,delete-marker,existing-objects"
  • Replace ALIAS with the alias of the origin MinIO deployment. The name must match the bucket specified when creating the remote target in the previous step.

  • Replace BUCKET with the name of the bucket to replicate from on the origin deployment.

  • Replace the --remote-bucket to specify the remote MinIO deployment and bucket to which the ALIAS/BUCKET replicates.

    The USER:PASSWORD must correspond to a user on the remote deployment with the necessary replication permissions.

    The HOSTNAME:PORT must resolve to a reachable MinIO instance on the remote deployment. The BUCKET must exist and otherwise meet all other replication requirements.

  • The --replicate "delete,delete-marker,existing-objects" flag enables the following replication features:

    See mc replicate add --replicate for more complete documentation. Omit any field to disable replication of that component.

Specify any other supported optional arguments for mc replicate add.

2) Validate the Replication Configuration

Use mc cp to copy a new object to the replicated bucket on one of the deployments.

mc cp ~/foo.txt ALIAS/BUCKET

Use mc ls to verify the object exists on the destination bucket:

mc ls ALIAS/BUCKET
Note

See also

3 - Enable Two-Way Server-Side Bucket Replication

The procedure on this page creates a new bucket replication rule for two-way “active-active” synchronization of objects between MinIO buckets.

Active-Active Replication synchronizes data between two remote clusters.

This tutorial covers configuring Active-Active replication between two MinIO clusters. For a tutorial on multi-site replication between three or more MinIO clusters, see Enable Multi-Site Server-Side Bucket Replication.

Requirements

You must meet all of the basic requirements for bucket replication described in Bucket Replication Requirements.

In addition, to set up active-active bucket replication, you must meet the following additional requirements:

Access to Both Clusters

You must have network access and login credentials with required permissions to both deployment to set up active-active bucket replication.

You can access the deployments by installing mc and using the command line. Use the mc alias set command to create an alias for both MinIO deployments.

Alias creation requires specifying an access key for a user on the deployment. This user must have permission to create and manage users and policies on the deployment.

Specifically, ensure the user has at minimum:

Considerations

Use Consistent Replication Settings

MinIO supports customizing the replication configuration to enable or disable the following replication behaviors:

  • Replication of delete operations
  • Replication of delete markers
  • Replication of existing objects
  • Replication of metadata-only changes

When configuring replication rules for a bucket, ensure that both MinIO deployments participating in active-active replication use the same replication behaviors to ensure consistent and predictable synchronization of objects.

Replication of Existing Objects

MinIO supports automatically replicating existing objects in a bucket.

MinIO requires explicitly enabling replication of existing objects using the mc replicate add --replicate or mc replicate update --replicate and including the existing-objects replication feature flag. This procedure includes the required flags for enabling replication of existing objects.

Replication of Delete Operations

MinIO supports replicating delete operations onto the target bucket. Specifically, MinIO can replicate versioning Delete Markers 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 requires explicitly enabling replication of delete operations using the mc replicate add --replicate or mc replicate update --replicate. This procedure includes the required flags for enabling replication of delete operations and delete markers.

MinIO does not replicate delete operations resulting from the application of lifecycle management expiration rules. Configure matching expiration rules on both the source and destination bucket to ensure consistent application of object expiration.

See Replication of Delete Operations and Object Deletion for more complete documentation.

Multi-Site Replication

MinIO supports configuring multiple remote targets per bucket or bucket prefix. This enables configuring multi-site active-active replication between MinIO deployments.

This procedure covers active-active replication between two MinIO sites. You can repeat this procedure for each “pair” of MinIO deployments in the replication mesh. For a dedicated tutorial, see Enable Multi-Site Server-Side Bucket Replication.

Procedure

Configure Two-Way Bucket Replication Using the Command Line mc

This procedure creates two-way, active-active replication between two MinIO deployments.

This procedure assumes you have already defined an alias for each deployment as a user with the necessary replication permissions.

Note

Changed: RELEASE.2022-12-24T15-21-38Z

mc replicate add automatically creates the necessary replication targets, removing the need for using the deprecated mc admin remote bucket add command. This procedure only documents the procedure as of that release.

1) Create a New Bucket Replication Rule on Each Deployment

Use the mc replicate add command to add a new replication rule to each MinIO deployment.

mc replicate add ALIAS/BUCKET \
   --remote-bucket 'https://USER:PASSWORD@HOSTNAME:PORT/BUCKET' \
   --replicate "delete,delete-marker,existing-objects"
  • Replace ALIAS with the alias of the origin MinIO deployment. The name must match the bucket specified when creating the remote target in the previous step.

  • Replace BUCKET with the name of the bucket to replicate from on the origin deployment.

  • Replace the --remote-bucket to specify the remote MinIO deployment and bucket to which the ALIAS/BUCKET replicates.

    The USER:PASSWORD must correspond to a user on the remote deployment with the necessary replication permissions.

    The HOSTNAME:PORT must resolve to a reachable MinIO instance on the remote deployment. The BUCKET must exist and otherwise meet all other replication requirements.

  • The --replicate "delete,delete-marker,existing-objects" flag enables the following replication features:

    See mc replicate add --replicate for more complete documentation. Omit any field to disable replication of that component.

Specify any other supported optional arguments for mc replicate add.

Repeat this step on the other MinIO deployment. Change the ALIAS and --remote-bucket values to correspond to the first deployment.

You should have two replication rules configured at the conclusion of this step - one created on each deployment that points to the bucket on the other deployment. Use the mc replicate ls command to verify the created replication rules.

2) Validate the Replication Configuration

Use mc cp to copy a new object to the replicated bucket on one of the deployments.

mc cp ~/foo.txt ALIAS/BUCKET

Use mc ls to verify the object exists on the destination bucket:

mc ls ALIAS/BUCKET

Repeat this test by copying another object to the second deployment and verifying the object replicates to the first deployment.

Once both objects exist on both deployments, you have successfully set up two-way, active-active replication between MinIO buckets.

Note

See also

4 - Enable Multi-Site Server-Side Bucket Replication

The procedure on this page configures automatic server-side bucket replication between multiple MinIO deployments. Multi-Site Active-Active replication builds on the Enable Two-Way Server-Side Bucket Replication procedure with additional considerations required to ensure predictable replication behavior across all sites.

Active-Active Replication synchronizes data between multiple remote deployments.

Multi-Site Active-Active replication configurations can span multiple racks, datacenters, or geographic locations. Complexity of configuring and maintaining multi-site configurations generally increase with the number of sites and size of each site. Enterprises looking to implement multi-site replication should consider leveraging MinIO SUBNET support to access the expertise, planning, and engineering resources required for addressing that use case.

Note

See also

Requirements

You must meet all of the basic requirements for bucket replication described in Bucket Replication Requirements.

In addition, to create multi-site bucket replication set up, you must meet the following additional requirements:

Access to All Clusters

You must have network access and log in credentials with correct permissions to all deployments to set up multi-site active-active bucket replication.

You can access the deployments by installing mc and using the command line. Use the mc alias set command to create an alias for each MinIO deployment.

Alias creation requires specifying an access key for a user on the deployment. This user must have permission to create and manage users and policies on the deployment.

Specifically, ensure the user has at minimum:

Considerations

Click to expand any of the following:

Use Consistent Replication Settings

MinIO supports customizing the replication configuration to enable or disable the following replication behaviors:

  • Replication of delete operations
  • Replication of delete markers
  • Replication of existing objects
  • Replication of metadata-only changes

When configuring replication rules for a bucket, ensure that all MinIO deployments participating in multi-site replication use the same replication behaviors to ensure consistent and predictable synchronization of objects.

Replication of Existing Objects

MinIO supports automatically replicating existing objects in a bucket.

MinIO requires explicitly enabling replication of existing objects using the mc replicate add --replicate or mc replicate update --replicate and including the existing-objects replication feature flag. This procedure includes the required flags for enabling replication of existing objects.

Replication of Delete Operations

MinIO supports replicating delete operations onto the target bucket. Specifically, MinIO can replicate versioning Delete Markers 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 requires explicitly enabling replication of delete operations using the mc replicate add --replicate or mc replicate update --replicate. This procedure includes the required flags for enabling replication of delete operations and delete markers.

MinIO does not replicate delete operations resulting from the application of lifecycle management expiration rules. Configure matching expiration rules for the bucket on all replication sites to ensure consistent application of object expiration.

Procedure

This procedure requires repeating steps for each MinIO deployment participating in the multi-site replication configuration. Depending on the number of deployments, this procedure may require significant time and care in implementation. MinIO recommends reading through the procedure before attempting to implement the documented steps.

Configure Multi-Site Bucket Replication Using the Command Line mc

This procedure uses the placeholder ALIAS to reference the alias each MinIO deployment being configured for replication. Replace these values with the appropriate alias for each MinIO deployment.

This procedure assumes each alias corresponds to a user with the necessary replication permissions.

Note

Changed: RELEASE.2022-12-24T15-21-38Z

mc replicate add automatically creates the necessary replication targets, removing the need for using the deprecated mc admin remote bucket add command. This procedure only documents the procedure as of that release.

1) Create New Bucket Replication Rules

Use the mc replicate add command to add a new replication rule to each MinIO deployment.

mc replicate add ALIAS/BUCKET \
   --remote-bucket 'https://USER:PASSWORD@HOSTNAME:PORT/BUCKET' \
   --replicate "delete,delete-marker,existing-objects"
  • Replace ALIAS with the alias of the origin MinIO deployment. The name must match the bucket specified when creating the remote target in the previous step.

  • Replace BUCKET with the name of the bucket to replicate from on the origin deployment.

  • Replace the --remote-bucket to specify the remote MinIO deployment and bucket to which the ALIAS/BUCKET replicates.

    The USER:PASSWORD must correspond to a user on the remote deployment with the necessary replication permissions.

    The HOSTNAME:PORT must resolve to a reachable MinIO instance on the remote deployment. The BUCKET must exist and otherwise meet all other replication requirements.

  • The --replicate "delete,delete-marker,existing-objects" flag enables the following replication features:

    See mc replicate add --replicate for more complete documentation. Omit any field to disable replication of that component.

Specify any other supported optional arguments for mc replicate add.

Repeat these commands for each remote MinIO deployment participating in the multi-site replication configuration. For example, a multi-site replication configuration consisting of MinIO deployments minio1, minio2, and minio3 would require repeating this step on each deployment for each remote.

Specifically, in this scenario, perform this step twice on each deployment:

  • On the minio1 deployment, once for a rule for minio2 and again for a separate rule for minio3.
  • On the minio2 deployment, once for a rule for minio1 and again for a separate rule for minio3.
  • On the minio3 deployment, once for a rule for minio1 and again for a separate rule for minio2.

2) Validate the Replication Configuration

Use mc cp to copy a new object to the replicated bucket on one of the deployments.

mc cp ~/foo.txt ALIAS/BUCKET

Use mc ls to verify the object exists on the destination bucket:

mc ls ALIAS/BUCKET

Repeat this test on each deployment by copying a new unique file and checking that the file replicates to each of the other deployments.

You can also use mc stat to check the file to check the current replication stage of the object.

5 - Resynchronize Bucket from Remote Replica

The procedure on this page resynchronizes the contents of a MinIO bucket using a healthy replication remote. Resynchronization supports recovery after partial or total loss of data on a MinIO deployment in a replica configuration.

For example, consider a MinIO active-active replication configuration similar to the following:

Active-Active Replication synchronizes data between two remote deployments.

Resynchronization allows using the healthy data on one of the participating MinIO deployments as the source for rebuilding the other deployment.

Resynchronization is a per-bucket process. You must repeat resynchronization for each bucket on the remote which suffered partial or total data loss.

Note

Professional Support during BC/DR Operations

MinIO SUBNET users can log in and create a new issue related to resynchronization. Coordination with MinIO Engineering via SUBNET can ensure successful resynchronization and restoration of normal operations, including performance testing and health diagnostics.

Community users can seek support on the MinIO Community Slack. Community Support is best-effort only and has no SLAs around responsiveness.

Requirements

MinIO Deployments Must Be Online

Resynchronization requires both the source and target deployments be online and able to accept read and write operations. The source must have complete network connectivity to the remote.

The remote deployment may be “unhealthy” in that it has suffered partial or total data loss. Resynchronization addresses the data loss as long as both source and destination maintain connectivity.

Resynchronization Requires Existing Replication Configuration

Resynchronization requires the healthy source deployment have an existing replication configuration for the unhealthy target bucket. Additionally, resynchronization only applies to those replication rules created with the existing object replication option.

Use mc replicate ls to review the configured replication rules and targets for the healthy source bucket.

Replication Requires Matching Object Encryption Settings

MinIO supports replication of objects encrypted using SSE-KMS and SSE-S3:

  • For objects encrypted using SSE-KMS, MinIO requires that the target bucket support SSE-KMS encryption of objects using the same key names used to encrypt objects on the source bucket.
  • For objects encrypted using SSE-S3, MinIO requires that the target bucket also support SSE-S3 encryption of objects regardless of key name.

As part of the replication process, MinIO decrypts the object on the source bucket and transmits the unencrypted object over the network. The destination MinIO deployment then re-encrypts the object using the encryption settings from the target. MinIO therefore strongly recommends enabling 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).

Replication Requires MinIO Deployments

MinIO server-side replication only works between MinIO deployments. Both the source and destination deployments must run MinIO Server with matching versions.

To configure replication between arbitrary S3-compatible services, use mc mirror.

Replication Requires Versioning

MinIO relies on the immutability protections provided by versioning to support replication and resynchronization.

Use mc version info to validate the versioning status of both the source and remote buckets. Use the mc version enable command to enable versioning as necessary.

If you exclude a prefix or folder from versioning within the source bucket, MinIO cannot replicate objects within that folder or prefix.

Replication Requires Matching Object Locking State

MinIO supports replicating objects held under WORM Locking. Both replication buckets must have object locking enabled for MinIO to replicate the locked object. For active-active configuration, MinIO recommends using the same retention rules on both buckets to ensure consistent behavior across sites.

You must enable object locking during bucket creation as per S3 behavior. You can then configure object retention rules at any time. Configure the necessary rules on the unhealthy target bucket prior to beginning this procedure.

Considerations

Resynchronization Requires Time

Resynchronization is a background processes that continually checks objects in the source MinIO bucket and copies them to the remote as-needed. The time required for replication to complete may vary depending on the number and size of objects, the throughput to the remote MinIO deployment, and the load on the source MinIO deployment. Total time for completion is generally not predictable due to these variables.

MinIO recommends configuring load balancers or proxies to direct traffic only to the healthy cluster until synchronization completes. The following commands can provide insight into the resynchronization status:

  • mc replicate resync status on the source to track the resynchronization progress.
  • mc replicate status on the source and remote to track normal replication data.
  • Run mc ls -r --versions ALIAS/BUCKET | wc -l against both source and remote to validate the total number of objects and object versions on each.

Resynchronize Objects after Data Loss

This procedure uses an existing MinIO replication configuration to restore missing data to one of the MinIO deployments participating in that configuration. Specifically, a healthy MinIO deployment (the SOURCE) synchronizes it’s existing data to the unhealthy MinIO deployment (the TARGET).

This procedure assumes an existing alias for the SOURCE that has the necessary permissions for configuring replication.

You can repeat this procedure for each bucket that requires resynchronization. You can have no more than one replication job running per bucket.

1) List the Configured Replication Targets on the Healthy Source

Run the mc replicate ls command to list the configured remote targets on the healthy SOURCE deployment for the BUCKET that requires resynchronization.

mc replicate ls SOURCE/BUCKET --json
  • Replace SOURCE with the alias of the source MinIO deployment.
  • Replace BUCKET with the name of the bucket to use as the source for resynchronization.

The output resembles the following:

{
   "op": "",
   "status": "success",
   "url": "",
   "rule": {
      "ID": "cer1tuk9a3p5j68crk60",
      "Status": "Enabled",
      "Priority": 0,
      "DeleteMarkerReplication": {
         "Status": "Enabled"
      },
      "DeleteReplication": {
         "Status": "Enabled"
      },
      "Destination": {
         "Bucket": "arn:minio:replication::UUID:BUCKET"
      },
      "Filter": {
         "And": {},
         "Tag": {}
      },
      "SourceSelectionCriteria": {
         "ReplicaModifications": {
            "Status": "Enabled"
         }
      },
      "ExistingObjectReplication": {
         "Status": "Enabled"
      }
   }
}

Each document in the output represents one configured replication rule. The Destination.Bucket field specifies the ARN for a given rule on the bucket. Identify the correct ARN for the Bucket from which you want to resynchronize objects.

2) Start the Resynchronization Procedure

Run the mc replicate resync start command to begin the resynchronization process:

mc replicate resync start --remote-bucket "arn:minio:replication::UUID:BUCKET" SOURCE/BUCKET
  • Replace the --remote-bucket value with the ARN of the unhealthy BUCKET on the TARGET MinIO deployment.
  • Replaced SOURCE with the alias of the source MinIO deployment.
  • Replace the BUCKET with the name of the bucket on the healthy SOURCE MinIO deployment.

The command returns a resynchronization job ID indicating that the process has begun.

3) Monitor Resynchronization

Use the mc replicate resync status command on the source deployment to track the received replication data:

mc replicate resync status ALIAS/BUCKET

The output resembles the following:

mc replicate resync status /data
Resync status summary:
● arn:minio:replication::6593d572-4dc3-4bb9-8d90-7f79cc612f01:data
   Status: Ongoing
   Replication Status | Size (Bytes)    | Count
   Replicated         | 2.3 GiB         | 18
   Failed             | 0 B             | 0

The Status updates to Completed once the resynchronization process completes.

4) Next Steps

  • If the TARGET bucket damage extends to replication rules, you must recreate those rules to match the previous replication configuration. See Enable Two-Way Server-Side Bucket Replication for additional guidance.
  • Perform basic validation that all buckets in the replication configuration show similar results for commands such as mc ls and mc stat.
  • After restoring any replication rules and verifying replication between sites, you can configure the reverse proxy, load balancer, or other network control plane managing connections to resume sending traffic to the resynchronized deployment.