I have installed Mongo 7.0 Community on my recently updated Droplet Ubuntu 18 -> 20. Following the instrctions from here https://www.digitalocean.com/community/tutorials/how-to-install-mongodb-on-ubuntu-20-04.
when running the sudo systemctl status mongod
command I get
mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2023-09-07 19:35:20 UTC; 6s ago
Docs: https://docs.mongodb.org/manual
Process: 48528 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=14)
Main PID: 48528 (code=exited, status=14)
There were some SO that referred to changing the permissions on /var/lib/mongo
I have tried that as well to no avail.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Accepted Answer
This may have not been the correct way to fix this but it worked for me. I deleted everything so don’t do this if you’re upgrading/ don’t have a backup. I didn’t need one.
sudo apt-get remove mongodb-org
sudo apt-get purge mongodb-ord*
sudo rm -r /var/log/mongodb
sudo rm -r /var/lib/mongodb
sudo apt autoremove
Then started again with the directions from the post.
Heya,
From that information alone it would be very hard to pinpoint the exact issue.
Check your Error log and see what it say when you try to start your Mongo service. It should give a more detailed error and reason why this is happening.
You can find more detailed information about the error in the MongoDB log files. By default, MongoDB logs to /var/log/mongodb/mongodb.log
.
You can view the log using a command like this:
- sudo cat /var/log/mongodb/mongodb.log
Look for any error messages or stack traces that may provide more context about what went wrong during startup.
netstat
or ss
command to check for processes listening on MongoDB’s port (default is 27017):- sudo netstat -tuln | grep 27017
Check for available disk space: MongoDB may fail to start if there isn’t enough disk space available on your Droplet. Check the available disk space using the df
command:
Restart MongoDB: Try restarting MongoDB to see if it resolves the issue:
- sudo systemctl restart mongodb
Hope that this helps!
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.