Defining object storage classes
You can use up to four object storage classes for applications with different performance and redundancy requirements. The first storage class is set automatically during the S3 cluster creation. The other three classes you can define manually by using the ostor-ctl set-storage-class
command.
Once a storage class is created, use the ostor-ctl cfg-storage
command to change its redundancy settings. With this command, you can modify all storage classes, including the first one. Note that the redundancy scheme can only be changed if you use redundancy by replication. With redundancy by erasure coding, however, changing the redundancy scheme is disabled.
You can specify the storage class when creating a new S3 object. You can also change the storage class of an existing object by making a copy of the object.
Limitations
- Changing the encoding redundancy scheme is disabled, because it may decrease cluster performance. Re-encoding demands a significant amount of cluster resources for a long period of time. If you still want to change the redundancy scheme, contact the technical support team.
Prerequisites
- The S3 cluster is created, as described in Creating the S3 cluster.
- To be able to use the AWS command-line tool, install and configure it first, as described in the official documentation Install/Update and Setup.
To create a storage class
-
Obtain the password for your storage cluster. For example:
# vinfra cluster password show +----------+---------+ | Field | Value | +----------+---------+ | id | 1 | | name | cluster | | password | W3HMNq | +----------+---------+
-
Find out the ID of the object storage volume. For example:
# ostor-ctl get-config -V VOL_ID TYPE STATE 0100000000000002 OBJ READY
-
Define a storage class specifying its numeric ID, the number of object servers it will include, and the required redundancy settings. When prompted, enter the password obtained in step 1. For example, to create the storage class 1 with 2 object servers and the redundancy scheme of 2 replicas for tier 1, run:
# ostor-ctl set-storage-class -s /mnt/vstorage/vols/ostor/ -V 0100000000000002 \ -C 1 -O 2 --vstorage-attr "replicas=2:1 tier=1" Please enter password for 'ostor-private.svc.vstoragedomain.': Storage 1 class is successfully assigned to services
This command requires the following parameters:
-s
,--storage <path>
- The path to the object storage directory
-V
,--vol <id>
- The volume ID obtained in step 2
-C
,--storage-class {1,2,3}
- The storage class ID. Can accept the following values: 1, 2, 3.
-O
,--os-count <number>
- The number of object servers to create
--vstorage-attr <attribute>
- Redundancy settings, where you can specify the desired tier, failure domain, and data redundancy scheme. Refer to the
vstorage set-attr
help message.
The S3 APIs that use the
x-amz-storage-class
header can specify one of the following storage classes:standard
,type_1
,type_2
, ortype_3
. -
Check that the new storage class is set. For example, for the storage class 1, run:
# vstorage get-attr /mnt/vstorage/vols/ostor/0100000000000002/services/sc1/ connected to MDS#1 Path: 'vstorage://hciHeat/vols/ostor/0100000000000002/services/sc1' Attributes: directory client-ssd-cache=1 replicas=2:1 failure-domain=host failure-domain.int=1 tier=1 chunk-size=268435456
To change redundancy settings of a storage class
Use the ostor-ctl cfg-storage
command. For example:
# ostor-ctl cfg-storage -r /mnt/vstorage/vols/ostor/0100000000000002/ -C 1 \ --vstorage-attr "replicas=3:2 tier=0"
This command requires the following parameters:
-r
,--root <path>
- The path to the initialized shared storage
-C
,--storage-class {0,1,2,3}
- The storage class ID. Can accept the following values: 0, 1, 2, 3. The default value is 0.
--vstorage-attr <attributes>
- Redundancy settings, where you can specify the desired tier, failure domain, and data redundancy scheme. Refer to the
vstorage set-attr
help message.
To create an object with the storage class
Use the aws s3api put-object
command. For example:
# aws s3api put-object --bucket bucket1 --key folder1/object1.zip --body object1.zip --storage-class type_1 --endpoint-url http://s3.example.com
This command requires the following parameters:
--bucket <bucket>
- Name of the destination bucket
--key <key>
- Unique name and path for a new object
--body <body>
- Object data
--endpoint-url <url>
- S3 endpoint URL
--storage-class <storage_class>
- Storage class. Possible values:
standard
,type_1
,type_2
, ortype_3
. Thestandard
storage class is used by default to store newly created objects.
To change the storage class of an object
Use the aws s3api copy-object
command. For example:
# aws s3api copy-object --copy-source bucket1/folder1/object1.zip --key object2.zip --bucket bucket2 --endpoint-url http://s3.example.com --storage-class type_2
This command requires the following parameters:
--bucket <bucket>
- Name of the destination bucket
--copy-source <source_object>
- Path to the source object
--key <key>
- Unique name and path for a new object
--endpoint-url <url>
- S3 endpoint URL
--storage-class <storage_class>
- Storage class. Possible values:
standard
,type_1
,type_2
, ortype_3
. Thestandard
storage class is used by default to store copied objects.