I have to start my MongoDB server every time the system restarts. How do I configure it to start with my OS? I am on Ubuntu 11.04.
|
migrated from stackoverflow.com Sep 15 '11 at 7:08
|
If you install MongoDB using the Advanced Packaging Tool (apt) then it'll configure your startup scripts to automatically run Mongo when the system boots. The steps are as follows, first configure apt to be able to download the Mongo package:
Add this line to sources.list then save:
Then download and install Mongo with the apt-get utility:
If you want to make any changes to config, edit your mongodb.conf and restart:
|
|||||
|
|
Controlling all the init.d service links should be done with the update-rc.d tool i.e. to turn on the mongod daemon in the default runlevels (i.e. turn it on at boot):
See https://help.ubuntu.com/community/UbuntuBootupHowto for more information. This link tells you everything you want to know about how to set programs at boot. |
|||||
|
|
where mongodb is the name of your service |
|||||
|
|
I have consistently used this post as a starting point to get a new sharding rig up and running. It includes a section on configuring upstart that I've also used. http://joslynesser.com/blog/archives/2010/09/28/mongodb-sharding-guide-server-setup-on-ubuntu-ec2/ |
|||
|
|
If you install MongoDB with You can also take a look here for an old post that links to an In either case, the basic premise is that you're setting up a service and then configuring to start-stop with the computer. This is pretty common technique for servers, there are lots of tutorials around for doing exactly this. |
||||
|
|

