Setting a bucket class replication policy using the MCG command-line interface

Provide higher resiliency and better collaboration options by setting a bucket class replication policy using the MCG command-line interface.

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) bucket class to have a specific replication policy can create a bucketclass and define the replication-policy parameter in a JSON file.

It is possible to set a bucket class replication policy for two types of bucket classes:

  • Placement
  • Namespace

Procedure

From the MCG command-line interface, run the following command:
noobaa -n openshift-storage bucketclass create placement-bucketclass <bucketclass-name> --backingstores <backingstores> --replication-policy=/path/to/json-file.json
bucketclass-name

Specify the name of the bucket class.

backingstores

Specify the name of a backingstore. It is possible to pass several backingstores separated by commas.

/path/to/json-file.json

Is the path to a JSON file which defines the replication policy.

Example JSON file:

[{ "rule_id": "rule-1", "destination_bucket": "first.bucket", "filter": {"prefix": "repl"}}]
"prefix"
(Optional:) It is the prefix of the object keys that should be replicated, and you can even leave it empty, for example, {"prefix": ""}.

For example:

noobaa -n openshift-storage bucketclass create placement-bucketclass bc --backingstores azure-blob-ns --replication-policy=/path/to/json-file.json

This example creates a placement bucket class with a specific replication policy defined in the JSON file.