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

六眼飞鱼酱① 提交于 2019-12-04 05:22:24

Besides --journal that is enabled by default since MongoDB 2.0 (only on 64 bit machines), there is a flag that you can set when persisting data:

  • safe => false: do not wait for a db response
  • safe => true: wait for a db response
  • safe => num: wait for that many servers to have the write before returning
  • fsync => true: fsync the write to disk before returning. fsync => true implies safe=>true, but not visa versa.

If fsync=>false and safe=>true and the write could be in successfully applied to a mmapped file but not yet written to disk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!