Replicating a bucket to another bucket using a YAML

Provide higher resiliency and better collaboration options by replicating a bucket to another bucket using the a YAML file.

Before you begin

  • Ensure you have a running Fusion Data Foundation Platform.
  • Download the MCG command-line interface for easier management.
    subscription-manager repos --enable=rh-odf-4-for-rhel-8-x86_64-rpms
    yum install mcg
    Note: Specify the appropriate architecture for enabling the repositories using the subscription manager. In case of IBM Z infrastructure, use the following command:
    subscription-manager repos --enable=rh-odf-4-for-rhel-8-s390x-rpms
  • Alternatively, you can install the MCG package from the RPMs found at Download Red Hat OpenShift Data Foundation page.

    Note: Choose the correct Product Variant according to your architecture.

About this task

Applications that require a Multicloud Object Gateway (MCG) data bucket to have a specific replication policy can create an Object Bucket Claim (OBC) and add the spec.additionalConfig.replication-policy parameter to the OBC. For more information about OBCs, see Object Bucket Claim.

Procedure

Apply the following YAML:
apiVersion: objectbucket.io/v1alpha1
kind: ObjectBucketClaim
metadata:
  name: <desired-bucket-claim>
  namespace: <desired-namespace>
spec:
  generateBucketName: <desired-bucket-name>
  storageClassName: openshift-storage.noobaa.io
  additionalConfig:
    replication-policy: [{ "rule_id": "<rule id>", "destination_bucket": "first.bucket", "filter": {"prefix": "<object name prefix>"}}]
desired-bucket-claim

Specify the name of the bucket claim.

desired-namespace

Specify the namespace.

desired-bucket-name>

Specify the prefix of the bucket name.

rule_id

Specify the ID number of the rule, for example, {"rule_id": "rule-1"}.

destination_bucket

Specify the name of the destination bucket, for example, {"destination_bucket": "first.bucket"}.

object name prefix
(Optional:) It is the prefix of the object keys that should be replicated, and you can even leave it empty, for example, {"prefix": ""}.