Cleanup of Mongo journal file

Biscuit Coder picture Biscuit Coder · Jun 10, 2016 · Viewed 7.8k times · Source

Is there a way to reset the journal file. Will it have any implications ?

Right now i have a journal file of 2GB which is occupying lot of space in ec2.

Answer

André Düwel picture André Düwel · Mar 2, 2017

You should stop the mongodb first:

service mongodb stop
rm -rf /var/lib/mongodb/journal
service mongodb start

Additional hint: you could limit the journal to 128MB by adding smallfiles=true to the config file /etc/mongodb.conf.

Solution taken from here and tested on Ubuntu 16.04.