Storage in Yandex StoreDoc
Yandex StoreDoc allows you to use network and local storage drives for database clusters. Network drives are based on network blocks, i.e., virtual drives in the Yandex Cloud infrastructure. Local drives are physically located on the database host servers.
When creating a cluster, you can select the following disk types for data storage:
-
Network HDDs (
network-hdd): Most cost-effective option for clusters with low requirements for read and write performance. -
Network SSDs (
network-ssd): Compromise solution: slower than local SSDs, network SSDs ensure data integrity in the event of Yandex Cloud hardware failure. -
Non-replicated SSDs (
network-ssd-nonreplicated): Network disks with higher performance achieved by eliminating redundancy.You can only expand this type of storage in 93 GB increments.
-
Ultra high-speed network SSDs with three replicas (
network-ssd-io-m3): Network disks that deliver performance equivalent to non-replicated SSDs while ensuring redundancy.You can only increase the size of these disks in 93 GB increments.
-
Local SSDs (
local-ssd): Highest-performing disks.You can expand such a storage as follows:
- For Intel Broadwell and Intel Cascade Lake: Only in 100 GB increments.
- For Intel Ice Lake and AMD Zen 4: Only in 368 GB increments.
For a list of host classes and corresponding platforms, see Host classes.
For clusters with hosts residing in the
ru-central1-davailability zone, local SSD storage is not available if using Intel Cascade Lake.
Block
Note
Up to 5% of disk space is reserved for system use, so the disks may have less available space than indicated when creating a cluster.
For more information about sizes and performance of different disk types, see this Yandex Compute Cloud guide.
Selecting disk type when creating a cluster
The number of hosts you can create together with a Yandex StoreDoc cluster depends on the selected disk type:
-
You can create a cluster only with three or more hosts when using the following disk types:
- Local SSDs (
local-ssd) - Non-replicated SSDs (
network-ssd-nonreplicated)
Storage on local SSDs increases your cluster costs: you pay for the cluster even if it is stopped. For more information, see the pricing policy.
- Local SSDs (
-
You can add any number of hosts within the current quota when using the following disk types:
- Network HDDs (
network-hdd) - Network SSDs (
network-ssd) * Ultra high-speed network SSDs with three replicas (network-ssd-io-m3)
- Network HDDs (
For more information about limits on the number of hosts per cluster or shard, see Quotas and limits.
Disk encryption
When creating or restoring a cluster from a backup, you can encrypt the storage disk with a custom KMS key. To encrypt a disk of an already created cluster, disable encryption, or encrypt a disk with a different key, create a backup of the cluster and restore it with the new settings.
To create an encrypted disk, you need the kms.keys.user role or higher.
If you deactivate the key used to encrypt a disk, access to the data will be suspended until you reactivate the key.
Alert
If you delete the key used to encrypt a disk or its version, you will irrevocably lose access to your data. For more information, see this Key Management Service guide.
Managing disk space
If at least one host in a Yandex StoreDoc cluster runs out of allocated disk space, the Yandex StoreDoc instance on this host will crash and the host will be disabled. If the host was a PRIMARY replica, this role will be assigned to one of the SECONDARY replicas. As a result of migrating the PRIMARY role from one host to another, you may run out of disk space on all hosts in the cluster, which will result in a complete cluster failure.
To avoid this, Yandex StoreDoc monitors how much disk space is used and automatically activates read-only mode (using the db.fsyncLock method) for those cluster hosts that have:
- Less than 500 MB of free disk space left (if the host storage size is less than 600 GB).
- Less than 5 GB of free disk space left (if the host storage size is 600 GB or more).
After switching to read-only mode:
- Write queries stop being allowed on the host. You can only make read queries.
- If the host was a primary replica before switching to read-only mode, this role will be automatically assigned to another cluster host, as the primary replica should be able to write to disk.
If the data amount in the cluster keeps growing, all hosts will enter read-only mode one by one and the cluster will eventually stop accepting data for writing.
Maintaining a cluster in operable condition
To keep your cluster up and running as the host is switching over to read-only:
-
Increase the disk space on the host. If there is enough space on the host, Yandex Cloud will clear read-only mode automatically.
-
Add more shards to the cluster. Read-only mode will not be cleared on this host, but the cluster will be able to keep working normally as long as there is free disk space on the other shards.
-
Ask support
to temporarily suspend read-only mode on this host to manually delete some of the data.Alert
If free disk space drops to zero, Yandex StoreDoc will crash and the cluster will stop operating.
-
Force data synchronization between hosts. This can help when a large amount of data was deleted from the cluster, but the disk space was not released (marked as available for reuse).
-
Run the
compactcommand. First, add the mdbDbAdmin role to the user.
Automatic storage expansion
Automatic storage expansion prevents situations where the disk runs out of free space and hosts go read-only. The storage size increases upon reaching the specified threshold percentage of the total capacity. There are two thresholds:
-
Scheduled expansion threshold: To schedule such an expansion, an algorithm analyzes data from the last few hours and estimates how quickly the storage is filling up. If the calculations show that the threshold will be exceeded by the start of the nearest maintenance window, the system schedules a storage expansion. If a check at the maintenance start shows that the threshold was indeed exceeded, the storage size is increased.
-
Immediate expansion threshold: When reached, the storage size increases immediately.
You can use either one or both thresholds. If you set both, make sure the immediate increase threshold is higher than the scheduled one.
If the specified capacity percentage is reached, the storage expands differently depending on the disk type:
-
For network HDDs and SSDs, by the higher of the two values: 20 GB or 20% of the current disk size.
-
For non-replicated SSDs and ultra high-speed network SSDs with three replicas, by 93 GB.
-
For local SSDs:
- In an Intel Broadwell or Intel Cascade Lake cluster, by 100 GB.
- In an Intel Ice Lake or AMD Zen 4 cluster, by 368 GB.
If the specified capacity percentage is reached again, the storage will automatically expand until it reaches the specified maximum. After that, you can set a new maximum storage size manually.
When you change the storage size, the cluster hosts are updated one at a time in random order. If you need to restart a host during an update, it will become unavailable for this time period.
Warning
You cannot reduce the storage size following an automatic expansion.