Trying to start MongoDB and getting the “MongoDB exit code 100” error?
Eager to know why this error happens?
It is common to get exit code error while trying to start a MongoDB service. Incorrect file permissions and missing database directories often cause this error.
At Bobcares, we get many requests from server owners to fix MongoDB error as part of our Server Management Services.
Today, let’s have a deep look at the MongoDB exit code 100 error and how our Support Engineers fix them for the customers.
What causes MongoDB to exit with code 100?
As we all know, MongoDB is popular for its schema-less database. It does not use the concept of tables and columns, instead, it uses the concept of documents and collections. That’s why MongoDB is quite popular in container software like Docker.
It is common to get errors when starting the MongoDB service.
Fortunately, it returns codes and statuses when exiting. And these codes help in easy troubleshooting of issues with MongoDB.
But what causes it to exit with code 100?
Mongod, the daemon process of the MongoDB system, returns exit code 100 when the process throws an uncaught exception.
Let’s discuss some top causes of MongoDB error and how our Support Engineers fix them.
1. Incorrect file permissions
One main cause of exit code 100 is the incorrect file permissions.
Recently one of our customers had a problem with MongoDB. When he tried to start the mongod service in Ubuntu, he was getting the error,
root@machine ~ # service mongod start
root@machine ~ # service mongod status
● mongod.service - High-performance, schema-free document-oriented database
Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2018-02-11 09:17:55 CEST; 2s ago
Docs: https://docs.mongodb.org/manual
Process: 26942 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=100)
Main PID: 26942 (code=exited, status=100)
This occurred mainly due to permission issues with the data files. On checking, our Support Engineers found that the directory /var/lib/mongodb had root permissions.
Therefore, we changed the ownership to the MongoDB user,
chown -R mongodb:mongodb /var/lib/mongodb
This resolved the exiting error of MongoDB.
A successfully running MongoB Docker container would show up as :
2. Missing database directory
Sometimes, servers often show up MongoDB errors due to missing database directory. In Windows, they get the following error when trying to start the Mongo service,
Unexpected mongo exit code 100. Restarting.
Unexpected mongo exit code 100. Restarting.
Unexpected mongo exit code 100. Restarting.
Can't start mongod
Usually, the database directory will contain all the MongoDB files.
Missing these database directories will cause MongoDB errors. We created /data/db directory using the command,
mkdir C:\data\db
Then, we tried to start the Mongo services again and it worked fine. This is how we fixed the problem.
[ Need assistance to fix the MongoDB exit code 100 error?- We are available 24/7.]
Conclusion
In short, MongoDB exit code 100 error occurs due to the incorrect file permissions and missing database directories. Today, in this write-up, we have discussed how our Support Engineers fixed the MongoDB error for the customers.
Thank you 100% Work 🙂
Bonjour, je suis sous windows et quand je tape la commande :
mkdir C:\data\db
il me renvoie :
Un sous-répertoire ou un fichier C:\data\db existe déjà.
Mon pb erreur 100 n’est pas resolu
Hi,
Please contact our support team via live chat
Apparently, another possible cause is “Insufficient free space for journals”. At least that just now seems to be the cause of an error 100 for me. I found it by looking at /var/log/mongodb/mongod.log. Nothing else showed the error.