mirror of
https://github.com/minio/minio.git
synced 2025-11-07 12:52:58 -05:00
Fix storage class related issues (#5322)
- Add storage class metadata validation for request header - Change storage class header values to be consistent with AWS S3 - Refactor internal method to take only the reqd argument
This commit is contained in:
committed by
Harshavardhana
parent
f25ec31565
commit
545a9e4a82
@@ -9,27 +9,27 @@ set before starting Minio server. After the data and parity disks for each stora
|
||||
you can set the storage class of an object via request metadata field `x-amz-storage-class`. Minio server then honors the storage class by
|
||||
saving the object in specific number of data and parity disks.
|
||||
|
||||
### Values for standard storage class (SS)
|
||||
### Values for standard storage class (STANDARD)
|
||||
|
||||
Standard storage class implies more parity than RRS class. So, SS parity disks should be
|
||||
`STANDARD` storage class implies more parity than `REDUCED_REDUNDANCY` class. So, `STANDARD` parity disks should be
|
||||
|
||||
- Greater than or equal to 2, if RRS parity is not set.
|
||||
- Greater than RRS parity, if it is set.
|
||||
- Greater than or equal to 2, if `REDUCED_REDUNDANCY` parity is not set.
|
||||
- Greater than `REDUCED_REDUNDANCY` parity, if it is set.
|
||||
|
||||
As parity blocks can not be higher than data blocks, Standard storage class can not be higher than N/2. (N being total number of disks)
|
||||
Parity blocks can not be higher than data blocks, so `STANDARD` storage class parity can not be higher than N/2. (N being total number of disks)
|
||||
|
||||
Default value for standard storage class is `N/2` (N is the total number of drives).
|
||||
Default value for `STANDARD` storage class is `N/2` (N is the total number of drives).
|
||||
|
||||
### Reduced redundancy storage class (RRS)
|
||||
### Reduced redundancy storage class (REDUCED_REDUNDANCY)
|
||||
|
||||
Reduced redundancy implies lesser parity than SS class. So, RRS parity disks should be
|
||||
`REDUCED_REDUNDANCY` implies lesser parity than `STANDARD` class. So,`REDUCED_REDUNDANCY` parity disks should be
|
||||
|
||||
- Less than N/2, if SS parity is not set.
|
||||
- Less than SS Parity, if it is set.
|
||||
- Less than N/2, if `STANDARD` parity is not set.
|
||||
- Less than `STANDARD` Parity, if it is set.
|
||||
|
||||
As parity below 2 is not recommended, RR storage class is not supported for 4 disks erasure coding setup.
|
||||
As parity below 2 is not recommended, `REDUCED_REDUNDANCY` storage class is not supported for 4 disks erasure coding setup.
|
||||
|
||||
Default value for reduced redundancy storage class is `2`.
|
||||
Default value for `REDUCED_REDUNDANCY` storage class is `2`.
|
||||
|
||||
## Get started with Storage Class
|
||||
|
||||
@@ -37,25 +37,25 @@ Default value for reduced redundancy storage class is `2`.
|
||||
|
||||
The format to set storage class environment variables is as follows
|
||||
|
||||
`MINIO_STORAGE_CLASS_RRS=EC:parity`
|
||||
`MINIO_STORAGE_CLASS_STANDARD=EC:parity`
|
||||
`MINIO_STORAGE_CLASS_RRS=EC:parity`
|
||||
|
||||
For example, set RRS parity 2 and SS parity 3, in 8 disk erasure code setup.
|
||||
For example, set `MINIO_STORAGE_CLASS_RRS` parity 2 and `MINIO_STORAGE_CLASS_STANDARD` parity 3
|
||||
|
||||
```sh
|
||||
export MINIO_STORAGE_CLASS_RRS=EC:2
|
||||
export MINIO_STORAGE_CLASS_STANDARD=EC:3
|
||||
export MINIO_STORAGE_CLASS_RRS=EC:2
|
||||
```
|
||||
|
||||
If storage class is not defined before starting Minio server, and subsequent PutObject metadata field has `x-amz-storage-class` present
|
||||
with values `MINIO_STORAGE_CLASS_RRS` or `MINIO_STORAGE_CLASS_STANDARD`, Minio server uses default parity values.
|
||||
with values `REDUCED_REDUNDANCY` or `STANDARD`, Minio server uses default parity values.
|
||||
|
||||
### Set metadata
|
||||
|
||||
In below example `minio-go` is used to set the storage class to `MINIO_STORAGE_CLASS_RRS`. This means this object will be split across 6 data disks and 2 parity disks (as per the storage class set in previous step).
|
||||
In below example `minio-go` is used to set the storage class to `REDUCED_REDUNDANCY`. This means this object will be split across 6 data disks and 2 parity disks (as per the storage class set in previous step).
|
||||
|
||||
```go
|
||||
s3Client, err := minio.New("s3.amazonaws.com", "YOUR-ACCESSKEYID", "YOUR-SECRETACCESSKEY", true)
|
||||
s3Client, err := minio.New("localhost:9000", "YOUR-ACCESSKEYID", "YOUR-SECRETACCESSKEY", true)
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
@@ -70,7 +70,7 @@ if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
|
||||
n, err := s3Client.PutObject("my-bucketname", "my-objectname", object, objectStat.Size(), minio.PutObjectOptions{ContentType: "application/octet-stream", StorageClass: "MINIO_STORAGE_CLASS_RRS"})
|
||||
n, err := s3Client.PutObject("my-bucketname", "my-objectname", object, objectStat.Size(), minio.PutObjectOptions{ContentType: "application/octet-stream", StorageClass: "REDUCED_REDUNDANCY"})
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user