MongoDB databases can definitely make websites faster.
However, just like any other database server, it can also malfunction.
Problems with system clock settings and incorrect file permissions can result in MongoDB exited with code 14 error.
At Bobcares, we often get requests from our customers to fix MongoDB errors as part of our Server Management Services.
Today, let’s see how our Database Engineers fix error MongoDB exited with code 14.`
What causes MongoDB exited with code 14 error
MongoDB uses schema-less databases and enables faster access to the data. Therefore it is widely used for websites.
From our experience in managing servers, we’ve seen customers facing different kinds of problems with MongoDB.
Now, let’s see the top causes of MongoDB error and how our Support Team solves them.
1. Wrong MongoDB file permissions
By default, MongoDB file permissions play a crucial role in the proper working of the database server.
Recently, one of our customers had a problem with MongoDB. He was getting an error while setting up MongoDB on the Ubuntu server.
When running the command, systemctl status mongodb
he got the following error,
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 2019-07-10 16: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)
On checking, our Support Engineers found that it was because of the wrong permission setting on /var/lib/mongodb and /tmp/mongodb-27017.sock.
So, we changed the ownership to the MongoDB user as below.
chown -R mongodb:mongodb /var/lib/mongodb
chown mongodb:mongodb /tmp/mongodb-27017.sock
This is how we fixed the problem.
2. Incorrect system clock settings
Sometimes, customers may have problems with MongoDB due to incorrect system clock settings on the server. In that case, customers may get the following error while running MongoDB.
Xxxx:mongodb_simple YYYY$ ./bin/mongod -f conf/mongod.conf
about to fork child process, waiting until server is ready for connections.
forked process: 5110
ERROR: child process failed, exited with error number 14
On checking the MongoDB log, our Support Engineers found that the system clock was off. So the SSL cert was technically invalid. Changing to the current date and time worked. To fix the system clock, we used the command date --set "<DD M Y H:M>"
This corrected the problem and MongoDB server started working fine.
[Need assistance to fix MongoDB errors? We’ll help you.]
Conclusion
In short, the error MongoDB exited with code 14 indicates the incorrect system clock settings and wrong file permissions on the server. Today, we saw the various reasons for MongoDB errors and how our Support Engineers fix them.
0 Comments