views:

56

answers:

1

My particular scenario: I want to spin up a new Linode VM solo for running MongoDB. I'll have backup services and etc. for everything related to the disk, so this question about 'risk' pertains only to the following.

I've been reading the MongoDB documentation and I've gotten to the fsync portion. It mentions that data in memory is written to disk every 60 seconds by default basically as I understand it.

So if I understand that right, out the box, the inherent risk of data loss with MongoDB is at most 59 seconds in the event something like power loss or otherwise a MongoDB instance is unsafely shut down?

+2  A: 

Theoretically, yes. You can also set the default fsync to fewer than 60 seconds.

But if you have an unclean shutdown, you'll also have to do a database repair, which, depending on the size of your data set, takes time. So you'd also have to take into account any data you might not be able to collect as a result of your database being down.

Kyle Banker
You can also force fsync or completed replication for a given database update (through the drivers), if you have an update you really do not want to lose.
Thilo