So im trying to setup Mongodb on Ubuntu 16.04 but im running into trouble.
when running :
sudo systemctl status mongodb
I get the following:
mongodb.service - High-performance, schema-free document-oriented database
Loaded: loaded (/etc/systemd/system/mongodb.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2016-09-10 14:02:22 CEST; 14s ago
Docs: https://docs.mongodb.org/manual
Process: 8724 ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf (code=exited, status=14)
Main PID: 8724 (code=exited, status=14)
According to the mongo-docs, status=14 is:
"Returned by MongoDB applications which encounter an unrecoverable error, an uncaught exception or uncaught signal. The system exits without performing a clean shut down."
I doesnt really point me in any particular direction.
My /etc/systemd/system/mongodb.service
looks like this:
[Unit]
Description=High-performance, schema-free document-oriented database
After=network.target
[Service]
User=mongodb
ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf
[Install]
WantedBy=multi-user.target
Any thought on what may be the cause of this?
Thank you
After googling around for a while. I found that that is because the permission settings on
/var/lib/mongodb
and/tmp/mongodb-27017.lock
are wrong. You will have to change the owner to monogdb userthen
By using this my error was gone:
TMP
directory:cd /tmp
ls *.sock
chown mongodb:mongodb <YOUR_SOCK>
sudo service mongod start
sudo service mongod status
deleting the mongod sock file solved the issue for me
sudo rm -rf /tmp/mongodb-27017.sock
then start againsudo systemctl start mongod
i tried this and it worked :
comment the "bind ip" line.
then i ran
I also got status 14 at some point, but it was not because of my .lock files.
Looks like everything in your dbPath (in my case /data/mongodb) should belong to mongodb. In my case, two files and files in the journal folder were owned by root, possibly because I have run the mongod command with sudo instead of the mongodb user (as configured in mongod.service).
In order to find my problem, it helped to set the verbosity to 5 in /etc/mongod.conf:
and run
tail /var/log/mongodb/mongodb.log -n 100
aftersudo systemctl start mongod
For this to work, mongod.conf needs to be loaded by mongod. mongod.service does that with the --config parameter.
Make sure to remove the high verbosity when your mongodb works again, because that logfile can grow very large.
for beginners only if you are trying the following and getting errors :
then try checking the status
it will show active ..
My
/var/lib/mongodb
was corrupt,rm
ing it and reinstalling mongo worked.This error occurred for me just because the disk space was full. And solved after deleting some unused files.
In my case, it was because of an incomplete repair operation, in which case I had to run
mongod --repair --dbpath /var/lib/mongodb
.