Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a cluster of mongo servers used for sharding and replicas.

If I have to restart a server, would I have to restart the mongod again, or would it autostart? Same for the mongo main server, if that needs restarting, would I have to set all the clusters back again?

This is also because before starting mongod, I need to start mongos as well, and this is pretty annoying to have to repeat this in case a server needs restarting, and because I would need to use mongo in production so I need something really reliable in case of a reboot.

share|improve this question
What do you mean "main server"? – gWaldo Jan 14 '12 at 2:50
Are you running MongoDB on Linux or Windows? Both can be setup to start on reboot, but the process is different. – Brian Knight Jan 14 '12 at 3:23

2 Answers 2

I can't say much for mongos, but for mongod, if you restart one of the servers in the cluster, then one of two things will happen:

  1. If the node was the primary node, then a new primary node will be selected.
  2. If the node was a secondary node, the primary node will remain the same.

So in this case, you shouldn't need to restart all the nodes. A simple way to find out would just be to test it--starting local mongo servers isn't difficult, and it would allow you to put a definite "yes" or "no" answer as to whether or not it will do what you need.

share|improve this answer

It depends. And you need to test your scenario.

If you're installing MongoDB from a package manager, I think that the startup scripts are usually taken care of for you.

If you're compiling from source or downloading binaries, you need to add it to your system's startup list (whether it's runit, monit, init, launchd, or what have you.)

MongoDB is fine for production use. (Though your final statement worries and confuses me.)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.