Replication Policy

When you create a container through the use of the object storage service, that container will have a replication policy applied to it. The default policy ensures that the container is replicated across all three regions of the Catalyst Cloud. This is done as a means to provide geographic diversity and security to your data in the event of a disaster affecting one of our regions.

However, there are some scenarios where you may not need your data to be replicated across regions or you wish to save money on a cheaper policy. In this case you can choose a replication policy that keeps three replicas of your data in a single region instead of having them spread across all of them.

What are the storage policies

The following are the storage policies available, each of these (as their names suggest) are related to one of the regions on the Catalyst cloud:

Storage class

Failure-domain

Replicas

nz--o1--mr-r3 (default)

Multi-region

3 (one in each region)

nz-wlg-2--o1--sr-r3

Single-region

3 (all in one region)

nz-por-1--o1--sr-r3

Single-region

3 (all in one region)

nz-hlz-1--o1--sr-r3

Single-region

3 (all in one region)

Warning

You cannot change the storage policy of an already existing container. The only way to change the policy of a container is during it’s creation.

There are multiple ways to create containers that use a single region policy. You can create your container via the Dashboard, by making use of the openstack CLI or by making calls to the object storage API directly. All of which are detailed below.

Dashboard method

It is a required field when creating a container, to choose a replication policy. The following will go through the process of creating a new container via the dashboard and show you how to choose your replication policy. Firstly, navigate to the ‘containers’ section under the object storage tab.

../_images/container-dash-screenshot-underline.png

Once here, we’re going to make a new container by clicking on the “+ container” button. The button will open up a new window that should look like this:

../_images/create-container.png

We will give our container a name and in the storage policy tab below, we will select the region that we want our replicas to be created in. As you can see, by default the multi-region option is selected, but for this example we are going to choose the policy for the Porirua region and then click submit. Something important to mention is even though the policy we have chosen uses the Porirua region for storing the replicas, you are still able to access this container from any of our regions.

../_images/create-container-dropdown.png

After you have created your container, it will function as normal. You should be able to see the policy that your container has when selecting it from the dashboard as seen below

../_images/container-after-create.png

Programmatic methods

The following is a tutorial that will show you how to create a container that has a single region replication policy, using the openstack command line tools. There are a number of prerequisites you will need to meet before we can continue with this tutorial:

  • You must have version 5.2.0 or above of the openstack command line tools installed.

  • You need to have sourced an OpenRC file in your console.

Once you have met these requirements we can create our container. For this container we are going to be using the Hamilton region. This means that when we use the command openstack container create we need to specify our policy with the --storage-policy flag.

Note

Even if a container only uses a single region for it’s replication policy, you are still able to access the container from any region on the Catalyst Cloud.

$ openstack container create --storage-policy nz-hlz-1--o1--sr-r3 single-region-cli
+---------------------------------------+-------------------+------------------------------------+
| account                               | container         | x-trans-id                         |
+---------------------------------------+-------------------+------------------------------------+
| AUTH_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | single-region-cli | tx4e6c8d8ec77248279a74a-005e94d751 |
+---------------------------------------+-------------------+------------------------------------+

That is it. We have created a container with the single region policy. We can see this if we use the following command:

$ openstack container show single-region-cli
+----------------+---------------------------------------+
| Field          | Value                                 |
+----------------+---------------------------------------+
| account        | AUTH_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
| bytes_used     | 0                                     |
| container      | single-region-cli                     |
| object_count   | 0                                     |
| storage_policy | nz-hlz-1--o1--sr-r3                   |
+----------------+---------------------------------------+