1

I tried to run mongo db service but it won't start. I get the message

Job for mongod.service failed. See "systemctl status mongod.service" and
"journalctl -xn" for details.

I googled and found that issue was with the configuration file which points pidfilepath to/var/run/mongodb/mongod.pid but it seems that I have no such file.

I also directly ran mongod from terminal which seems to start database server (after making directory /data/db) as root but cannot run it as normal user.

I want to run the server from service, how should my pid file be? I tried to locate it but it seems to be nowhere. Also I am running on OpenSuse 13.2.

UPDATE:: I searched for couple of pid files in my system and they all contain numbers perhaps which are mapped into PID. What is the default PID for mongodb?

UPDATE:: I again googled and found that pid is 1036 so I created a file mongod.pid with the value 1036 and changed the file ownership and file permission and it is working for now.

asked Jun 20, 2015 at 8:26
1
  • well..that will kind of work until PID 1036 dies. What is the output of journalctl -xn? Commented Jun 21, 2015 at 2:39

1 Answer 1

1

There is no such thing as a default PID for any application. PID stands for Process IDentifier. Each process is given a PID (unique among the already running programs) by the operating system when it's started. A program is likely to have a different PID at each start. Concerning your problem, have you tried what the error message says?

journalctl -xn

This would give you the precise cause of the error. Given what you posted I think the problem is permissions. You have to make sure that the user running mongodb has the right to create the pidfile.

answered Jun 20, 2015 at 11:57
1
  • The irony is that one doesn't even need PID files in the first place in order to run mongod under systemd. They are superfluous and the service unit does not need to make any mention of them whatsoever. Commented Jun 21, 2015 at 14:37

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.