Search code examples
mongodbperformancedurabilitynosql

How to avoid data loss on server failure with MongoDB on a single machine?


I have read that mongoDB don't write data to disk right away, it does this periodically.

Any thoughts on how to deal with this?


Solution

  • You can enable journaling with --journal.

    Check out http://www.adathedev.co.uk/2011/03/mongodb-journaling-performance-single.html and http://www.mongodb.org/display/DOCS/Durability+and+Repair