ERROR: child process failed, exited with error number 14

created at 12-05-2021 views: 59

problem description

I used the systemctl method to start `mongo`, and once the node was abnormally terminated. When my colleague started `mongo` manually, he didn't use the systemctl method, but started it with the mongod -f configuration file. of. The database was up, but later I wanted to use the systemctl method to close the database, but found that it couldn't be closed. I used systemctl to start the database, but I couldn't get it up, and an error was reported:

ERROR: child process failed, exited with error number 14

I manually use the mongo user to execute the mongod -f configuration file and I cannot start mongo, and the same error is reported.

reasons

① Mongo is not closed normally

Should not be closed with kill -9

② The colleague started mongo as the root user by executing the mongod -f configuration file, so the owner of many files is root. However, the user in the service file called by systemctl is mongo, so mongo cannot be started in systemctl.

solution

① When closing the database started with the mongod -f configuration file, close it like this

#Enter the database, execute:
use admin;
db.shutdownServer();

② Make sure that the owner of the mongo data file directory is mongo

Modify the owner of the data file to mongo, example:

chown -R mongo:mongo /data/mongo

Start mongo again to start normally.

created at:12-05-2021
edited at: 12-05-2021: