Why when I exit the terminal(xshell) in Ubuntu 14.10 does my mongoDB(2.6.8)server also terminate?
-
How exactly are you starting MongoDB? Please include the full command in your question. Also, Ubuntu 14.10 includes MongoDB 2.6.3, not 2.6.8. So please also include how you installed that version (and do you really need it? Ubuntu maintains it...).– gertvdijkCommented Mar 13, 2015 at 14:08
-
After installation, 2 days, and until the afternoon "mongod -dbpath / home / mg / data / db" is also only a terminal window and there was no relationship with. But I found that I like the questions above were made during the various operations. That conjure "--fork" I was well and do not need to use the same command. Still do not know what is the cause. However, it was resolved as follows reply. Thank you for your kind attention.– Song KiSeokCommented Mar 13, 2015 at 16:15
-
Okay, I see. Yes, you should start a service as a service, not in the foreground in a terminal. I see you are new here on this site. For the next time, please edit your question in case you add details, that's how this Q&A site works (it's not a discussion forum), you see? :)– gertvdijkCommented Mar 13, 2015 at 16:20
Add a comment
|
1 Answer
When you start the mongo DB server it gets created as a child process of the terminal, so when you exit the terminal the child process are also terminated. To get around this you need to run the service as a daemon, the easiest way to do this is using the service command, assuming you installed Mongo DB following the documentation.
sudo service mongod start
-
Thank you! I am a beginner. After the calm, mongoDB documentation slowly looked back, depending on the response. And he was like, and then we really worked! "Mongod --fork --logpath /home/mg/mongod.log --logappend --dbpath / home / mg / data / db" But "sudo service mongod start" command does not take effect I do not know why. This section will look at it the more I study. Thank you. Commented Mar 13, 2015 at 15:57