Maintenance in Managed Service for MongoDB
Maintenance means:
- Automatic installation of DBMS updates and revisions for hosts (including disabled clusters).
- Changes to the host class and storage size.
- Other maintenance activities.
Changing a major DBMS version is not part of maintenance. For more information about major version changes, see MongoDB version upgrade.
Maintenance window
You can set the preferred maintenance time when creating a cluster or updating its settings:
- The arbitrary option (default) allows performing maintenance at any time.
- The by schedule option allows setting the preferred maintenance start day and time (UTC). For example, you can choose a time when the cluster is least loaded.
Maintenance procedure
The way of running the Managed Service for MongoDB cluster maintenance depends on the number of hosts and whether there are any shards.
Non-sharded clusters
Maintenance is performed as follows:
- Secondary replicas undergo maintenance one by one. The hosts are queued randomly. A secondary replica becomes unavailable while being restarted during maintenance.
- After that, the primary replica (master) undergoes maintenance. If it is restarted and becomes unavailable, one of the secondary replicas will take its role. A single-host cluster will be unavailable during its maintenance.
Sharded cluster
In sharded clusters, maintenance is run as follows:
-
The load balancer stops.
-
The hosts with the
MONGOINFRA
role for standard sharding orMONGOCFG
for advanced sharding undergo maintenance one by one. For hosts with theMONGOINFRA
role, only the MongoCFG service undergoes maintenance. Host maintenance is run in the same way as it would in a non-sharded cluster:- Secondary replicas undergo maintenance one by one. The hosts are queued randomly. A secondary replica becomes unavailable while being restarted during maintenance.
- Then, the primary replica undergoes maintenance. If it is restarted and becomes unavailable, one of the secondary replicas will take its role.
-
Shards undergo maintenance one by one, in ascending order by shard number. Host maintenance in each shard is the same as in non-sharded clusters:
- Secondary replicas undergo maintenance one by one. The hosts are queued randomly. A secondary replica becomes unavailable while being restarted during maintenance.
- Then, the primary replica undergoes maintenance. If it is restarted and becomes unavailable, one of the secondary replicas will take its role. A single-host shard will be unavailable during its maintenance.
-
The hosts with the
MONGOINFRA
role for standard sharding orMONGOS
for advanced sharding undergo maintenance one by one. For hosts with theMONGOINFRA
role, the MongoS service undergoes maintenance. The hosts are queued randomly. If a host needs to be restarted during maintenance, it becomes unavailable while being restarted. -
The load balancer resumes its operation.