1

I sometimes can start the mongodb server and sometimes I cannot. What is the real problem with my mongodb server. I am using Mac and I am getting this problem for the first time.

I tried to kill the mongodb process but it didn't help me.

Any possible solutions would be highly appreciated.

The error I am getting is below.

enter image description here

For killing the process, I tried to kill 27017 and it says no process found.

  • Looks like you try to start when there is already a mongo instance in the background, try to kill it with `-9`. Also can you put the text rather than the image? – buræquete Jul 05 '19 at 06:16
  • @buræquete when I tried to kill mongodb, it says not process found. As in the above picture, the pid is 31252. When I tried to kill it, is says no any process found. – Pramish Luitel Jul 05 '19 at 06:19
  • How about rather than killing manually, [this](https://stackoverflow.com/a/14625337/3641067)? – buræquete Jul 05 '19 at 06:20
  • Possible duplicate of [unable to start mongodb local server](https://stackoverflow.com/questions/6478113/unable-to-start-mongodb-local-server) – buræquete Jul 05 '19 at 06:21

1 Answers1

2

I think you are confusing port and PID. When you kill 27017, you send the SIGKILL signal to a process whose PID is 27017. However, unless there is a coincidence, mongod does not need to have that PID. 27017 is the default port for mongod instances.

To kill it properly do the following:

ps -edf | grep mongod --> get the PID of the mongod process

Then:

kill -SIGKILL <pid>

Then start it again.

Felipe Sulser
  • 1,185
  • 8
  • 19