简体   繁体   English

是否有*应用程序*驱动的理由更喜欢多主拓扑而不是集群,反之亦然?

[英]Are there *application*-driven reasons to prefer multi-primary topologies over clustering, or vice-versa?

I have an application that currently uses a single primary and I'm looking to do multi-primary by either setting up a reciprocal multi-primary (just two primaries with auto-increment-increment and auto-increment-offset set appropriately) or Clustering-with-a-capital-C.我有一个当前使用单个主节点的应用程序,我希望通过设置互惠的多主节点(仅两个具有适当设置的自动auto-increment-incrementauto-increment-offset的主节点)或集群来进行多主节点- 带大写字母-C。 The database is currently MariaDB 10.3, so the clustering would be Galera.该数据库当前是 MariaDB 10.3,因此集群将是 Galera。

My understanding of multi-primary is that the application would likely require no changes: the application would connect to a single database (doesn't matter which one), and any transaction that needed to obtain any locks would do so locally, any auto-increment values necessary would be generated, and once a COMMIT occurs, that engine would complete the commit and the likelihood of failure-to-replicate to the other node would be very low.我对多主数据库的理解是应用程序可能不需要任何更改:应用程序将连接到单个数据库(无论哪个数据库),任何需要获取任何锁的事务都将在本地进行,任何自动将生成必要的增量值,并且一旦发生COMMIT ,该引擎将完成提交,并且复制到另一个节点失败的可能性将非常低。

But for Clustering , a COMMIT actually requires that the other node(s) are updated to ensure success, the likelihood of failure during COMMIT (as opposed to during some INSERT/UPDATE/DELETE ) is much higher, and therefore the application would really require some automated retry logic to be built into it.但是对于ClusteringCOMMIT实际上需要更新其他节点以确保成功,在COMMIT期间(而不是在某些INSERT/UPDATE/DELETE期间)失败的可能性要高得多,因此应用程序确实需要内置一些自动重试逻辑。

Is the above accurate, or am I overestimating the likelihood of COMMIT -failure in a Clustered deployment, or perhaps even underestimating the likelihood of COMMIT -failure in a multi-primary environment?以上是否准确,还是我高估了集群部署中COMMIT失败的可能性,或者甚至低估了多主环境中COMMIT失败的可能性?

From what I've read, it seems that the Galera Cluster is a little more graceful about handling nodes leaving the re-joining the Cluster and adding new nodes.从我读过的内容来看,Galera Cluster 在处理节点离开重新加入集群和添加新节点方面似乎更优雅一些。 Is Galera Cluster really just multi-master with the database engine handling all the finicky setup and management, or is there some major difference between the two? Galera Cluster 真的只是多主服务器,数据库引擎处理所有繁琐的设置和管理,还是两者之间有一些主要区别?

Honestly, I'm more looking for reassurance that moving to Galera Cluster isn't going to end up being an enormous headache relative to the seemingly "easier" and "safer" move to multi-primary.老实说,相对于看似“更容易”和“更安全”的迁移到 multi-primary,迁移到 Galera Cluster 不会成为一个令人头疼的问题。

By "multi-primary", do you mean that each of the Galera nodes would be accepting writes? “多主节点”是指每个 Galera 节点都会接受写入吗? (In other contexts, "multi-primary" has a different meaning -- and only one Replica.) (在其他情况下,“multi-primary”有不同的含义——而且只有一个 Replica。)

One thing to be aware of: "Critical read".需要注意的一件事是:“批判性阅读”。

For example, when a user posts something and it writes to one node, and then that user reads from a different node, he expects his post to show up.例如,当用户发布内容并将其写入一个节点,然后该用户从另一个节点读取时,他希望他的帖子出现。 See wsrep_sync_wait .请参阅wsrep_sync_wait

(Elaborating on Bill's comment.) The COMMIT on the original write waits for each other node to say "yes, I can and will store that data", but a read on the other nodes may not immediately "see" the value. (详细说明比尔的评论。)原始写入的COMMIT等待每个其他节点说“是的,我可以并且将存储该数据”,但其他节点上的读取可能不会立即“看到”该值。 Using wsrep_sync_wait just before a SELECT makes sure the write is actually visible to the read.wsrep_sync_wait之前使用SELECT可确保写入实际上对读取可见。

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

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