mongodb在CAP定理中站在哪里? [英] Where does mongodb stand in the CAP theorem?

查看:395
本文介绍了mongodb在CAP定理中站在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

到处都是,我看到MongoDB是CP。
但是当我挖入我看到它是最终一致。
当您使用safe = true时是否为CP?如果是这样,那是否意味着当我使用safe = true写时,所有副本都会在获得结果之前更新。

Everywhere I look, I see that MongoDB is CP. But when I dig in I see it is eventually consistent. Is it CP when you use safe=true? If so, does that mean that when I write with safe=true, all replicas will be updated before getting the result?

推荐答案

默认情况下,MongoDB是强一致的 - 如果你做一个写,然后做一个读,假设写成功,你将永远能够读取你刚刚读的结果。这是因为MongoDB是单主机系统,并且所有读取在默认情况下转到主服务器。如果您可以选择启用从次要的读取,那么MongoDB最终会一致,从而可能读取过时的结果。

MongoDB is strongly consistent by default - if you do a write and then do a read, assuming the write was successful you will always be able to read the result of the write you just read. This is because MongoDB is a single-master system and all reads go to the primary by default. If you optionally enable reading from the secondaries then MongoDB becomes eventually consistent where it's possible to read out-of-date results.

MongoDB也通过自动故障切换获得高可用性副本集: http://www.mongodb.org/display/DOCS/Replica+Sets

MongoDB also gets high-availability through automatic failover in replica sets: http://www.mongodb.org/display/DOCS/Replica+Sets

这篇关于mongodb在CAP定理中站在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆