changed mongodb db path from one directory to another directory
changed mongodb log path from one directory to another directory
changed the mongod.pid file from one directory to another directory
modified the variable in /etc/mongod.conf
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?
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