Immediate action to regain redundancy
- Make absolutely positively sure your data fits on the secondary. DO NOT PROCEED IF IT DOESN'T OR YOU ARE IN DOUBT. YOU HAVE BEEN WARNED!
- Shut down the secondary
- Delete the content of the secondaries
dbpath (for example
- Restart the secondary
- The secondary will now resync from the primary, creating unfragmented datafiles which will make the smallest space possible.
Change deployment (!)
If one of the members has less space available than the others, there will be a point in which it can't replicate any more and drop out of the replica set, reducing failover capabilities. This usually happens 3am on a Saturday morning, when you just got home from a party ;)
You have to make absolutely sure that your replica set members have the same amount of disk space available. If you absolutely can't do this, you have to artificially limit the space available to each member, either by creating dedicated partitions of the exact same size (preferred way) or by using MongoDB's