Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you keep mongo running on a remote server?

When running mongo on a remote aws server (ubuntu) what is the best way to keep a mongo instance running after sshing to it to start it?

like image 377
fancy Avatar asked Jan 11 '12 22:01

fancy


4 Answers

Take a look here. In short, you should use mongod --fork --logpath /var/log/mongod.log

like image 159
Aleksandar Vucetic Avatar answered Oct 13 '22 01:10

Aleksandar Vucetic


Start it as a service. Here's the command

sudo service mongod start

like image 25
Donald Derek Avatar answered Oct 13 '22 02:10

Donald Derek


You should be able to use the auto-generated init script if you installed the -10gen distro: http://www.mkyong.com/mongodb/how-to-install-mongodb-on-ubuntu/

like image 41
Paul Avatar answered Oct 13 '22 00:10

Paul


You can use screen too for this purpose.

First execute the command

screen

Then run your server using

mongod --dbpath=/example/dbpath

Then detach it by pressing ctrl+a and then pressing d

like image 26
VivekVarade123 Avatar answered Oct 13 '22 02:10

VivekVarade123