Replicating a bucket to another bucket using the MCG command-line interface
Provide higher resiliency and better collaboration options by replicating a bucket to another bucket 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 to have a specific replication policy can create an Object Bucket Claim (OBC) and define the replication policy parameter in a JSON file.
Procedure
From the MCG command-line interface, run the following command to create an OBC with a
specific replication policy:
noobaa obc create <bucket-claim-name> -n openshift-storage --replication-policy /path/to/json-file.json
- bucket-claim-name
-
Specify the name of the bucket claim.
- /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 obc create my-bucket-claim -n openshift-storage --replication-policy /path/to/json-file.json