Hi
i desperately need to shrink some databases and reclaim space. from approx 260 Gb to 75 Gb. what is the best way to do this ?
The best way to reclaim space in your replica set is to perform a rolling initial sync. The general procedure can be found in Perform Maintenance on Replica Set Members. Please make sure that you have sufficient oplog size to be able to do an initial sync given your data size and your network speed. It’s also best if you ensure that your backups are current before doing any maintenance work on your deployment.
Please be very careful about running the repairDatabase process in a replica set. This process is similar to fsck
, in that it will attempt to remove corrupt documents from a single mongod
. If one of the secondaries has a corrupt copy of a document (e.g. due to storage corruption, etc.), repairDatabase
will remove this document, making this secondary having a different content than the rest of the replica set. This could lead to further issues in the future, since MongoDB assumes that all nodes in a replica set contains identical data.
Also, please note that the latest version in MongoDB 3.0 series is 3.0.15. 3.0.7 was released almost two years ago, and there has been many bugfixes and improvements since then.
Best regards,
Kevin
Hi
are people really doing rolling initial syncs with > terrabyte servers ? it takes me 20 minutes to ftp 50 Gb.
The feasibility of using rolling initial sync will of course depend on your situation, data size, downtime requirements, and the provisioning details of the deployment. It may be feasible for a certain deployment provisioned using the best hardware, but may not be as feasible when using lesser hardware. Also, long initial sync process may be tolerable in some cases, but not so in others.
One reason why initial sync is the recommended method in most cases is because it is the least risky method if your aim is to recover space in an MMAPv1 deployment, requires relatively little planning, and involve no downtime. However, if you determined that doing an initial sync is not feasible for you, please ensure that the method is thoroughly tested and verified before proceeding in a production environment.
Best regards,
Kevin