Biscuit Coder
Biscuit Coder

Reputation: 477

Cleanup of Mongo journal file

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.

Upvotes: 12

Views: 10689

Answers (2)

Igor Benikov
Igor Benikov

Reputation: 897

No need to restart mongod service - this is not good solution sometime. There is more simple solution if you just want to cleanup the single log file:

echo '' > /var/lib/mongodb/journal.log

Upvotes: -1

André Düwel
André Düwel

Reputation: 562

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.

Upvotes: 21

Related Questions