Cleanup of Mongo journal file
Asked Answered
F

2

12

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.

Frilling answered 10/6, 2016 at 11:51 Comment(0)
B
21

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.

Birmingham answered 2/3, 2017 at 8:53 Comment(1)
Thanks man. I realized it after some googling. Nevertheless, thanks a lot of pointing it out.Frilling
P
0

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
Plagio answered 5/4, 2021 at 17:49 Comment(2)
That cannot be right. /var/lib/mongodb/journal is a directory.Wash
Original question was about a file, not about directory. So, i assume /var/lib/mongodb/journal this is a path to file. I just based my answer on previous question path - but answered original questionPlagio

© 2022 - 2024 — McMap. All rights reserved.