I need to run a
mongo in order to reclaim some
OS disk space. Can anyone provide feedback on the following procedure: let me know if its correct, if I'm missing anything, if the steps are in order, etc.
The setup is a primary/secondary on separate servers. They are both about out of disk space. My plan is to repair the database on each one separately after the other completes. As I am out of disk space, I will be using an external block storage from my cloud provider to use as a repair path.
mongo is currently running via
MongoDB start. To complete this it seems that I'll run the following:
- On the primary I step down using
- I shutdown mongo using rs.shutdownServer() - Is this correct? For the next step it seems that I shouldn't run it if
mongoalready has another instance running.
- On the primary I run mongod --config /etc/mongodb.conf --repair --repairpath PATH_TO_BLOCK_STORAGE
- When complete, do I need to copy the data in the repair path over to the original (/var/lib/mongodb)?
- Once back up, I restart
- I then wait for the
oplogsto catch up and for the
mongosto be in sync.
- Once they primary and secondary are in sync I then go onto mongodb-perf-02 and run
mongodb-perf-01is the primary again.
- Once complete I then repeat this on the secondary.