Daniel
Daniel

Reputation: 339

Mongodb will not start

It has been a while since I have used Mongodb and I am running into a problem. I have an EC2 instance that had Mongodb running on it, but I had turned off the instance for a few months. After turning the instance back on, Mongodb will not start correctly. No log file is being created so I do not know what is causing the problem.

When I type:

sudo service mongodb start

I get the message:

mongodb start/running, process 2432

but mongo is not actually running and a mongod.lock file is being created.

If I type:

mongod

by itself, Mongodb will actually start and be usable. But, I must leave the terminal window up and not cancel out of the command to keep it running. I have to open up a second terminal window to access my databases. I guess my main question is how I get the mongod service to stay running itself without having to leave a terminal window open with the command running.

Sorry if my explanation doesn't make sense. Hopefully you get what I mean. Anyone have any idea what I am missing? I had this problem before months ago and was able to solve it. Sadly, I didn't write down the missing ingredient.

Upvotes: 0

Views: 344

Answers (1)

vahid abdi
vahid abdi

Reputation: 10278

For that, run command using Nohup

nohup mongod &

Then you can terminate you terminal.

Upvotes: 1

Related Questions