简体   繁体   English

MongoDB写关注同步级别

[英]MongoDB write concern sync level

I am trying to understand what exactly are the limitations of using MongoDB as the primary database for a project I am working on, it can be hard to wade through the crap online to properly understand how it compares to a more traditional database choice of say MySQL. 我正在尝试了解将MongoDB用作我正在处理的项目的主数据库的确切限制是什么,很难在网上进行大量废话,以正确了解它与MySQL等传统数据库的比较。

From what I understand from reading about HADR configuration of 从我对HADR配置的了解中了解到

IBM DB2 - http://pic.dhe.ibm.com/infocenter/db2luw/v9r7/index.jsp?topic=%2Fcom.ibm.db2.luw.admin.ha.doc%2Fdoc%2Fc0011724.html , IBM DB2- http://pic.dhe.ibm.com/infocenter/db2luw/v9r7/index.jsp?topic=%2Fcom.ibm.db2.luw.admin.ha.doc%2Fdoc%2Fc0011724.html

MySQL - http://dev.mysql.com/doc/refman/5.5/en/replication-semisync.html MySQL- http://dev.mysql.com/doc/refman/5.5/en/replication-semisync.html

and MongoDB - http://docs.mongodb.org/manual/core/write-concern/ 和MongoDB- http://docs.mongodb.org/manual/core/write-concern/

It seems that Replica Acknowledged http://docs.mongodb.org/manual/core/replica-set-write-concern/ is the highest level of write concern in a replica set. 看来副本服务器http://docs.mongodb.org/manual/core/replica-set-write-concern/是副本集中最高级别的写入问题。

Is replica acknowledged the equivalent to the synchronous level in DB2 and Semisynchronous level in MySQL? 是否承认副本等同于DB2中的同步级别和MySQL中的半同步级别?

No they are not. 不,他们不是。

IBM DB2 provides a way to make sure that all members of a replica set are upto speed at the same time, it is the same as MySQLs own synchronous replication. IBM DB2提供了一种方法来确保副本集的所有成员同时达到最高速度,这与MySQL自己的同步复制相同。 It ensures full consistentcy at all times throughout the slave set. 它可确保从属设备始终保持完全一致性。

Semisynchronous replication again is not replica set majority either; 同样,半同步复制也不是副本集的majority from the documentation page: 从文档页面:

The master waits after commit only until at least one slave has received and logged the events. 主机在提交后仅等待,直到至少一个从机接收并记录了事件。

But then: 但是之后:

It does not wait for all slaves to acknowledge receipt, and it requires only receipt, not that the events have been fully executed and committed on the slave side. 它不等待所有从站都确认接收,它仅需要接收,而不是事件已在从站侧完全执行并提交。

In other words you have no idea whether or not any slaves actually performed the command. 换句话说,您不知道任何从站是否实际执行了该命令。 It is the same as w:0 or "unsafe" writes in MongoDB. 与在MongoDB中写入w:0或“不安全”相同。

With majority you have an idea that every member you send to has actually performed your command as can be seen by a cute little diagram in the documentation: http://docs.mongodb.org/manual/core/replica-set-write-concern/#verify-write-operations majority您都会想到,发送给每个成员的实际上已经执行了命令,如文档中的一个可爱的小图所示: http : //docs.mongodb.org/manual/core/replica-set-write-关注/#校验写操作

and if that doesn't convince you then the quote: 如果那不能使您信服,则引用:

The following sequence of commands creates a configuration that waits for the write operation to complete on a majority of the set members before returning: 以下命令序列创建一个配置,该配置在返回之前等待大多数set成员上的写操作完成:

From the next paragraph should. 从下一段应该。

So MySQL semisynchronous is similar to majority but it isn't the same. 因此,MySQL半同步类似于majority但并不相同。 DB2 is totally different. DB2完全不同。

The IBM documentation sums up the differences in replica/slave wirte concern quite well: IBM文档很好地总结了副本/从属关系方面的差异:

The more strict the synchronization mode configuration parameter value, the more protection your database solution has against transaction data loss, but the slower your transaction processing performance. 同步模式配置参数值越严格,数据库解决方案对事务数据丢失的保护就越强,但是事务处理性能就越慢。 You must balance the need for protection against transaction loss with the need for performance. 您必须在防止交易损失的保护需求和性能需求之间取得平衡。

This applies to DB2, MySQL and MongoDB alike. 这适用于DB2,MySQL和MongoDB。 You must choose. 您必须选择。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM