1

I am currently facing a scenario that one of the replicate server disk got completely filled up, while our primary server still has additional space left.

My confusion is that the cmd like db.compact and db.repairDatabase() has to be run on primary server or I need to run it on replicate server instance?

Along as I have no disk space left, would it be appropriate to remove it, as a replicate using db.config , delete the data files and add it again.

Need your help?

2

Immediate action to regain redundancy

  1. 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!
  2. Shut down the secondary
  3. Delete the content of the secondaries dbpath (for example /var/lib/MongoDB)
  4. Restart the secondary
  5. 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 quotaFiles option.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.