Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

What's the easiest and safest(low data loss, no file locking issues) way to restart mongodb on a production system?

share|improve this question
1  
"Low data loss" as being acceptable? –  EEAA Feb 24 '12 at 19:13
1  
On a write heavy app, losing less writes while restarting I meant - not about letting the existing data go. But thanks a lot. –  mixdev Feb 24 '12 at 22:44

1 Answer 1

You haven't mentioned, but I'll assume you are running in a replica set and are mainly concerned about shutting down a primary. To do that in the safest way, first step it down from Primary:

http://www.mongodb.org/display/DOCS/Forcing+a+Member+to+be+Primary

Then you can just follow the regular shutdown process, depending on your preference:

Starting And Stopping MongoDB

Or, if you have installed it from a package, just use the init/upstart script to shut it down.

If you are not running in a replica set, then you should - the fire & forget nature of writes from apps (by default, but manageable if you wish) means that if your apps could just keep sending data into the abyss until your TCP connection errors out - that's lost data but it has nothing to do with how you shut down the DB.

share|improve this answer

Your Answer

 
discard

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.