Storage in Managed Service for MongoDB
Managed Service for MongoDB allows you to use network and local storage drives for database clusters. Network storage drives are based on network blocks, which are virtual disks in the Yandex Cloud infrastructure. Local disks are physically located in the database host servers.
When creating a cluster, you can select the following disk types for data storage:
-
Network HDD storage (
network-hdd
): Most cost-effective option for clusters that do not require high read/write performance. -
Network SSD storage (
network-ssd
): Balanced solution. Such disks are slower than local SSD storage, but, unlike local disks, they ensure data integrity in case Yandex Cloud hardware goes down. -
Non-replicated SSD storage (
network-ssd-nonreplicated
): Network SSD storage with enhanced performance but without redundancy.The storage size can only be increased in 93 GB increments.
-
Local SSDs (
local-ssd
): Disks with the fastest performance.The size of such a storage can be increased:
- For Intel Broadwell and Intel Cascade Lake: Only in 100 GB increments.
- For Intel Ice Lake: In 368 GB increments only.
For a list of host classes and their respective platforms, see MongoDB host classes.
Note
For clusters with hosts residing in the
ru-central1-d
availability zone, local SSD storage is not available if using the Intel Cascade Lake platform.
Selecting disk type during cluster creation
The number of hosts that can be created along with a MongoDB cluster depends on the selected disk type:
-
With local SSD (
local-ssd
) or non-replicated SSD (network-ssd-nonreplicated
) storage, you can create a cluster with three or more hosts.This cluster will be fault-tolerant.
Local SSD storage impacts the cost of a cluster: you are charged for it even if it is not running. You can find more information in the pricing policy.
-
With network HDD (
network-hdd
) or network SSD (network-ssd
) storage, you can add any number of hosts within the current quota.
For more information about limits on the number of hosts per cluster or shard, see Quotas and limits in Managed Service for MongoDB.
Managing disk space
If at least one host in a Managed Service for MongoDB cluster runs out of its allocated disk space, the MongoDB instance on this host will crash and the host will be disabled. If the host was a PRIMARY
replica, a SECONDARY
replica will take its role. As a result of migrating the PRIMARY
role from one host to another, you may run out of the disk space on all hosts in the cluster, which will disable the entire cluster.
To avoid this, Managed Service for MongoDB monitors disk space consumption and automatically enables read-only mode (using the db.fsyncLock
method
- 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 role requires permission to write to the disk.
If the amount of data in the cluster keeps growing, all hosts will switch to read-only mode, one by one, and the cluster will stop accepting data to write.
Maintaining the health of a cluster
To make sure your cluster is healthy when the host switches to read-only mode:
-
Increase the disk space on the host. Once there is enough space on the host, Yandex Cloud will disable read-only mode automatically.
-
Add more shards to the cluster. Read-only mode will persist on this host, but the cluster will be able to continue working normally if there is free disk space on the other shards.
-
Contact technical support
and ask them to temporarily disable this host's read-only mode to manually delete a part of the data.Alert
If you run out of free disk space completely, MongoDB will crash and the cluster will be disabled.
-
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).