I am facing some issues with my installation on MongoDB Atlas. I have an M10 cluster with mongo 4.4.
This cluster needs to be configured under minimum requirements, with an M10 and 10GB of space. Something happened and the cluster storage autoscaled to 14GB (i forgot to deactivate the cluster storage autoscaling).
The culprit of the storage consumption was the oplog.rs collection, on the local database. I successfully reduced the size of the oplog collection from the Atlas console (Cluster → Configuration → Additional Settings → More configuration options → set oplog size) and this works, but i’m not able to reclaim the unused space.
The documentation says to perform a compact operation on the oplog collection:
This works on the two secondary replicas i have but the documentation specifically says that this command must not be executed on the primary replica set member. It advices to execute rs.stepDown to choose another primary but this operation is not supported on Mongodb Atlas: https://www.mongodb.com/docs/atlas/unsupported-commands/#replication.
Is there a way to do this on Atlas? I just need to promote a new primary member so i can run compact on the last member of the replicaset.
This works on the two secondary replicas i have but the documentation specifically says that this command must not be executed on the primary replica set member. It advices to execute rs.stepDown to choose another primary but this operation is not supported on Mongodb Atlas
Is there a way to do this on Atlas? I just need to promote a new primary member so i can run compact on the last member of the replicaset.
Once you have completed running compact() on all secondary members in the cluster (which seems as though you have), use the cluster’s Test failover feature to step down the current primary member and wait for them to transition to secondary.
Perform the compact() command again on the remaining member that stepped down.
Thank you! It worked perfectly. The Test failover process can take some time but it works and changes the primary.
Compacting the primary reduces the size of the oplog as explected. One thing i noticed (if someone finds this thread in the future) is that the size that Atlas counts (“Disk Usage” on the cluster panel) for the storage autoscaler is the primary size. Once changed the primary and compacted i was able to reduce the disk size.