0

i was using mongodb and it was fine.

then i wanted to convert it to replica set and i get into some problems and i uninstalled it.

after reinstalling (10 times and doing everything on internet xD) why i check status with systemctl status it say failed with exit_code ( i know my conf file dont have problem). what can i do? i even installed the 3.3 version and even it doesnt start anymore.

i used anything that it came to my mind (purging config files & lot more...).

i really dont want to reinstall my os (really cant). this is my sudo systemctl status mongod

● mongod.service - MongoDB Database Server
     Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Thu 2021-02-18 20:05:20 +0330; 8s ago
       Docs: https://docs.mongodb.org/manual
    Process: 147513 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=1/FAILURE)
   Main PID: 147513 (code=exited, status=1/FAILURE)

Feb 18 20:05:20 nima-Lenovo-ideapad-320-15AST systemd[1]: Started MongoDB Database Server.
Feb 18 20:05:20 nima-Lenovo-ideapad-320-15AST mongod[147513]: about to fork child process, waiting until server is ready for connections.
Feb 18 20:05:20 nima-Lenovo-ideapad-320-15AST mongod[147527]: forked process: 147527
Feb 18 20:05:20 nima-Lenovo-ideapad-320-15AST mongod[147513]: ERROR: child process failed, exited with 1
Feb 18 20:05:20 nima-Lenovo-ideapad-320-15AST mongod[147513]: To see additional information in this output, start without the "--fork" option.
Feb 18 20:05:20 nima-Lenovo-ideapad-320-15AST systemd[1]: mongod.service: Main process exited, code=exited, status=1/FAILURE
Feb 18 20:05:20 nima-Lenovo-ideapad-320-15AST systemd[1]: mongod.service: Failed with result 'exit-code'.
  • Does this answer your question? [Starting mongod fork, ERROR: child process failed, exited with error number 1](https://stackoverflow.com/questions/28591101/starting-mongod-fork-error-child-process-failed-exited-with-error-number-1) – Ali Tou Feb 18 '21 at 17:00
  • @AliTou im installing it again and if the error exists i will send it to you (but i should state that when i install mongodb from tarball it works fine but again not from apt). – Nima Maskani Feb 18 '21 at 17:05

1 Answers1

0

I solved the problem by changing the default mongodb port from port 27017 to port 27018 in /etc/mongod.conf.

I'm sure this will come handy to a lot of people.

And for the last part, after uninstalling mongodb I removed mongod.service files (every file) in the system and systemd directories in root and installed mongodb again. (so I think uninstalling mongodb wasn't complete at first time. And 2 instances interfere with each other. Now everything works fine in mongodb with port 27018).

Peter O.
  • 32,158
  • 14
  • 82
  • 96