I installed MongoDB using sudo apt install mongo-org
and followed the instruction to start and everything worked but then when I reboot the system, the MongoDB server failed
● mongodb.service - High-performance, schema-free document-oriented >database
Loaded: loaded (/etc/systemd/system/mongodb.service; enabled; vendor prese>
Active: failed (Result: exit-code) since Mon 2021-02-15 09:14:37 IST; 2min>
Process: 836 ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf (c>
Main PID: 836 (code=exited, status=48)
Feb 15 09:14:05 ubuntu systemd[1]: Started High-performance, schema-free docume>
Feb 15 09:14:37 ubuntu systemd[1]: mongodb.service: Main process exited, code=e>
Feb 15 09:14:37 ubuntu systemd[1]: mongodb.service: Failed with result 'exit-co>
I tried changing the permissions of lib/MongoDB and log/mongodb, setting the ulimit of open files to 64000, but nothing worked for me.
What I do till now to do my work is to reinstall MongoDB every time on reboot.
Okay my problem get resolved by the following steps
sudo apt --purge autoremove mongo-org*
sudo apt install mongodb
sudo service mongodb start
sudo service mongodb status
At this point it gives an error
"couldn't open /etc/mongod.conf, No such file in directory"
On checking /etc I saw that it contains
mongodb.conf
notmongod.conf
, So I edited/etc/systemd/system/mongodb.service
and changed mongod.conf to mongodb.confAfter that, I did steps 3 and 4 and everything was working.