从 1.7.5 版本开始,MongoDB 支持所谓的“单服务器持久性”。根据documentation ,这是通过使用可以在服务器崩溃时回复的预写日志来实现的。
我无法理解 MongoDB 文档中“Journaling”页面的“提交确认”部分:
You can wait for group commit acknowledgement with the getLastError command. When running with
--dur
, thefsync:true
option returns after the data is physically written to the journal (rather than actually fsync'ing). Note that the group commit interval (see above) is considerable: you may prefer to call getLastError without fsync, or with a w: parameter instead with replication. In releases after 1.8.0 the delay for commit acknowledgement will be shorter.
这是否意味着日志记录依赖于操作系统将更改刷新到磁盘?或者这是否意味着无论用户是否请求 fsync,预写日志每 100 毫秒被 fsync 一次?
最佳答案
预写日志每 100 毫秒同步一次。
关于mongodb - MongoDB(启用日志功能)何时调用 fsync()?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4872622/