8 / 8
Nov 2021

Below steps i performed in mongodb server

  1. stopped mongod.service
  2. changed mongodb db path from one directory to another directory
  3. changed mongodb log path from one directory to another directory
  4. changed the mongod.pid file from one directory to another directory
  5. modified the variable in /etc/mongod.conf
  6. changed the content of mongod.service and point to correct PID File

now when i tried to start mongod.service , below error appears

[mongod@ghsazevdcmsdcb1 ~]$ sudo systemctl start mongod.service Job for mongod.service failed because the control process exited with error code. See "systemctl status mongod.service" and "journalctl -xe" for details

although i managed to start mongod via below command

mongod --config=/etc/mongod.conf

please help, how to fix mongod.service. Am i missing anything obvious?

Yes, you should have shared the following?

The answer is mostly there and faster to get than here. Anyway we cannot help you without what it is in there because we do not know why it failed. The command systemctl command will tell you and us why it failed.

The content of the logs is also a very good source of information to help diagnose issues.

[mongod@ghsazevdcmsdcb1 ~]$ sudo systemctl status mongod.service ● mongod.service - MongoDB Database Server Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Fri 2021-11-19 10:20:46 EST; 39s ago Docs: https://docs.mongodb.org/manual Process: 28968 ExecStart=/usr/bin/mongod $OPTIONS (code=exited, status=1/FAILURE) Process: 28965 ExecStartPre=/usr/bin/chmod 0755 /var/run/mongodb (code=exited, status=0/SUCCESS) Process: 28957 ExecStartPre=/usr/bin/chown mongod:mongod /var/run/mongodb (code=exited, status=0/SUCCESS) Process: 28949 ExecStartPre=/usr/bin/mkdir -p /var/run/mongodb (code=exited, status=0/SUCCESS) Nov 19 10:20:46 ghsazevdcmsdcb1 systemd[1]: Starting MongoDB Database Server... Nov 19 10:20:46 ghsazevdcmsdcb1 mongod[28968]: about to fork child process, waiting until server is ready for connections. Nov 19 10:20:46 ghsazevdcmsdcb1 mongod[28968]: forked process: 28990 Nov 19 10:20:46 ghsazevdcmsdcb1 mongod[28968]: ERROR: child process failed, exited with error number 1 Nov 19 10:20:46 ghsazevdcmsdcb1 mongod[28968]: To see additional information in this output, start without the "--fork" option. Nov 19 10:20:46 ghsazevdcmsdcb1 systemd[1]: mongod.service: control process exited, code=exited status=1 Nov 19 10:20:46 ghsazevdcmsdcb1 systemd[1]: Failed to start MongoDB Database Server. Nov 19 10:20:46 ghsazevdcmsdcb1 systemd[1]: Unit mongod.service en

The above does not help us help you.

What is happening? What are the errors? Where you able to terminate the running mongod?

i terrminate the running mongod with shudownserver command

and when i tried to start mongod.service… same error i am facing