How to run mongod in the background in ubuntu

4,952 views
Skip to first unread message

prem kumar

unread,
Aug 27, 2012, 6:00:46 AM8/27/12
to mongod...@googlegroups.com
Hi,

  

How to run mongod in the background


Thanks,

Prem

Tim

unread,
Aug 27, 2012, 7:45:09 AM8/27/12
to mongod...@googlegroups.com
Hi,

try running it with "nohup 'command' &"


http://en.wikipedia.org/wiki/Nohup

Paul Aan

unread,
Aug 27, 2012, 7:49:59 AM8/27/12
to mongod...@googlegroups.com
mongod --rest --shard {your configuration} --fork --logpath=/path/to/your/mongodb.log

Within --fork and --logpath <<< mongod will run as a deamon

Cheers.

--
You received this message because you are subscribed to the Google
Groups "mongodb-user" group.
To post to this group, send email to mongod...@googlegroups.com
To unsubscribe from this group, send email to
mongodb-user...@googlegroups.com
See also the IRC channel -- freenode.net#mongodb



--
Hoài Ân
Skype: mrgluexv
0903744334


prem kumar

unread,
Aug 27, 2012, 8:14:26 AM8/27/12
to mongod...@googlegroups.com
Hi,


This  command is not working. can u help for me.

Scott Hernandez

unread,
Aug 27, 2012, 8:28:00 AM8/27/12
to mongod...@googlegroups.com
Are you using the package manager and init daemon (upstart) to run the
server? If not, why not?

Following these directions on ubuntu will get everything working
without you having to manually start the mongod process nor worry
about such things:
http://docs.mongodb.org/manual/tutorial/install-mongodb-on-debian-or-ubuntu-linux/

prem kumar

unread,
Aug 27, 2012, 8:52:04 AM8/27/12
to mongod...@googlegroups.com
Hi
 I am working on server and run the mongodb.
but how do run mongodb in background.


Thanks,
Prem

Scott Hernandez

unread,
Aug 27, 2012, 9:04:57 AM8/27/12
to mongod...@googlegroups.com
Yes, please follow those directions and les us know if you have any
trouble at any step.
http://docs.mongodb.org/manual/tutorial/install-mongodb-on-debian-or-ubuntu-linux/

If you would rather do manually, please see the general
ubuntu/debian/linux community for how to run a process outside of your
terminal session -- here are a few quick results to help get you
started:
http://stackoverflow.com/questions/5164985/how-can-i-use-nohup-to-run-process-as-a-background-process-in-linux
http://stackoverflow.com/questions/4525188/linux-running-process-background

prem kumar

unread,
Aug 27, 2012, 9:58:49 AM8/27/12
to mongod...@googlegroups.com
Hi,

 I use this link
http://mongojs.org/install-mongodb-ubuntu-11-04-natty

start for lets begin step. so it is run the server but it is not running background..

Can u help for me?

Thanks,
Prem

A. Jesse Jiryu Davis

unread,
Aug 27, 2012, 2:22:58 PM8/27/12
to mongod...@googlegroups.com
Prem, yes, we can help. Please tell us precisely what steps you've taken so far. What step are you at now? What command do you run, and what is the expected outcome, and what is the actual outcome?

Once you have completed the following two steps in the instructions you'll have a mongod process running in the background:

sudo apt-get install mongodb-10gen
sudo service mongodb start 

At this point, simply type 'mongo' to start a MongoDB shell, and it will log into the server which you have started in the background.

A. Jesse Jiryu Davis

unread,
Aug 27, 2012, 2:29:11 PM8/27/12
to mongod...@googlegroups.com
Oh, first, can you simply run:

sudo ps aux | grep mongo

... and post the output here?

prem kumar

unread,
Aug 27, 2012, 2:40:41 PM8/27/12
to mongod...@googlegroups.com
Hi,

 I did below step. but it is not running background on ubuntu..

what i do? tell me next step.
 
wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.0.1.tgz

tar xzf mongodb-linux-x86_64-2.0.1.tgz

sudo mv mongodb-linux-x86_64-2.0.1 ~

sudo mkdir /data sudo mkdir /data/db

sudo chmod 777 /data/*

cd ~/mongodb-linux-x86_64-2.0.1/bin./mongod


Thanks
Prem

A. Jesse Jiryu Davis

unread,
Aug 28, 2012, 10:46:00 AM8/28/12
to mongod...@googlegroups.com
At that point, run:

~/mongodb-linux-x86_64-2.0.1/bin/mongod --dbpath data/db --logpath mongod.log --fork

Confirm it's running:

ps aux | grep mongod

Log in:

~/mongodb-linux-x86_64-2.0.1/bin/mongo
Reply all
Reply to author
Forward
0 new messages