0

我一直在阅读一些关于 MongoDB 容错的文章,有些人抱怨它永远无法用 MongoDB 真正实现(比如这篇文章:http ://hackingdistributed.com/2013/01/29/mongo-ft/ ),这让我感到困惑。

有人可以确认(如果可能的话,向我展示适当的文档)使用 Write Concern“Journal + Majority”足以确保 100% 的驱动程序报告为成功的写入是持久写入的并且不会即使任何副本在写入后失败,也会丢失?

我说的是 3 副本设置。我对系统在发生故障时不再接受写入感到满意,但是当驱动程序报告写入成功时,我需要将其持久提交(无论之后失败的副本数量如何)。

4

1 回答 1

0

Right so if you choose a journal write you are basically ensuring the write has made it to disk of a single node. If you choose to do a majority write, you are ensuring that the write has made it to memory of at least x number of nodes in your replica set.

By default, mongodb will flush from memory to journal every 100ms. By having your replica nodes on different machines (physical or virtual), ideally in different data centres, you are very unlikely to ever see ALL nodes in a geographically ditributed replica set go down within the same 100ms before one gets to disk.

Alternatively to guarantee that write made it to disk of a single node - use journal write.

于 2013-04-22T18:07:59.223 回答